drop safety/availability from scoring, holistic p4 rating, phase-parallel pipeline
safety and availability don't reduce to physics formulas the way power_density/range_fuel/cost_efficiency do -- they're judgment calls (risk assessment, infrastructure prevalence), and running them through the same log-normalize() built for physical quantities produced incoherent results: safety's raw value is already a "0-1" score, and normalizing it again turned 0.6 into an unexplainable 0.678 that even the LLM reviewing it could only cite, never justify (see combo 1540). Removed both from domain_metric_weights (safety from 4 domains, availability from urban_commuting) and renormalized the remaining weights to sum to 1.0. Pass 4 now produces one holistic RATING (LOW/MEDIUM/HIGH) alongside the existing VERDICT, with safety and accessibility folded in as qualitative considerations feeding that single judgment rather than scored separately -- not a checklist of independent numbers. New qualitative_rating column, filterable in the results UI. Also added domain name/description to the review prompt so the LLM judges a metric like range against what the domain actually needs (urban_commuting: 1-50km) instead of generic real-world expectations for the platform category -- confirmed live on a combo where phi4 had called a 396km range "limited" by comparing to typical aircraft rather than a domain that needs 1-50km. Pass 2 is estimator-only now -- self.llm is never consulted there, reserved entirely for pass 4. Restructured Pipeline.run() from combo-first to phase-parallel: each pass now runs to completion across every combo before the next pass starts, rather than walking each combo through all four passes before the next combo. This surfaced a real bug: domain- blocked combos (status stays "valid" by design, not "_fail") were slipping past a naive status-based skip guard and getting silently re-processed by pass 2. Fixed with a shared dead-combo check that catches both generic failures and domain blocks correctly. Also fixes a results-page display bug found while reviewing a live combo: the per-metric "position" bar showed raw distance from norm_min without inverting for lower_is_better metrics, so an excellent cost score (near the good end) rendered as a ~0%, near-empty bar -- looked bad next to its own 0.99 normalized score. Validated live against phi4 (real Ollama calls, not mocked): full-domain phase-parallel run (2,970 combos, estimator-only p2, 1.6s) followed by a real pass-4 run (111 reviewed, 11m, 0 crashes, 0 null ratings). Two tests that relied on the old LLM-driven pass 2 to force deterministic outcomes were updated to test pass 4's verdict-wiring directly instead. All 100 tests pass. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,7 +4,7 @@ from __future__ import annotations
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
from physcom.models.domain import MetricBound
|
||||
from physcom.models.domain import Domain, MetricBound
|
||||
|
||||
|
||||
class LLMRateLimitError(Exception):
|
||||
@@ -40,7 +40,7 @@ class LLMProvider(ABC):
|
||||
combination_description: str,
|
||||
raw_metrics: dict[str, float],
|
||||
normalized_scores: dict[str, float],
|
||||
metrics: list[MetricBound],
|
||||
domain: Domain,
|
||||
) -> tuple[str, bool]:
|
||||
"""Given a combination, its raw physical estimates, and their
|
||||
normalized scores, return a (text, is_plausible) tuple:
|
||||
@@ -50,6 +50,11 @@ class LLMProvider(ABC):
|
||||
normalized score) so the review can reason from the actual physics
|
||||
rather than only a compressed 0-1 number, which can look
|
||||
deceptively bad for a metric whose scale was built for a different
|
||||
kind of vehicle. `metrics` carries each metric's unit for
|
||||
formatting the raw value meaningfully."""
|
||||
kind of vehicle. `domain` carries both each metric's unit (via
|
||||
domain.metric_bounds, for formatting the raw value meaningfully)
|
||||
and the domain's own name/description, so the review judges a
|
||||
metric like range against what THIS domain actually needs rather
|
||||
than generic real-world expectations for the platform category
|
||||
(e.g. a short-hop domain shouldn't get judged against typical
|
||||
long-haul aircraft range)."""
|
||||
...
|
||||
|
||||
@@ -16,6 +16,13 @@ def parse_verdict(text: str) -> bool:
|
||||
return True
|
||||
|
||||
|
||||
def parse_rating(text: str) -> str | None:
|
||||
"""Extract RATING: LOW/MEDIUM/HIGH from response; None if absent (older
|
||||
reviews saved before this existed, or a malformed response)."""
|
||||
m = re.search(r"RATING:\s*(LOW|MEDIUM|HIGH)", text, re.IGNORECASE)
|
||||
return m.group(1).upper() if m else None
|
||||
|
||||
|
||||
def parse_metric_json(text: str, metrics: list[MetricBound]) -> dict[str, float]:
|
||||
"""Strip markdown fences and parse JSON; fall back to each metric's own
|
||||
norm_min/norm_max midpoint on error — a flat constant like 0.5 is
|
||||
|
||||
@@ -116,6 +116,14 @@ You are reviewing a transportation concept for real-world viability — could th
|
||||
actually be built and operated safely. Whether it is new, exciting, or original
|
||||
is NOT the question.
|
||||
|
||||
## Domain
|
||||
This concept is being evaluated for "{domain_name}": {domain_description}
|
||||
Judge every metric against what THIS domain actually needs, not general
|
||||
expectations for the platform category. A range far beyond what this domain
|
||||
requires is a strength or a non-issue, never a weakness -- don't reason about
|
||||
range, speed, or capacity by comparing to what other vehicles of this type
|
||||
typically have in general use; compare to what this specific domain calls for.
|
||||
|
||||
## Concept
|
||||
{description}
|
||||
|
||||
@@ -139,6 +147,14 @@ before treating the score as evidence of a problem.
|
||||
|
||||
{scores}
|
||||
|
||||
Safety and accessibility (infrastructure/regulatory availability) are NOT
|
||||
among the scores above — neither reduces to a physics formula the way the
|
||||
metrics above do, so nothing here estimates them numerically. Reason about
|
||||
both directly from the concept description: does this combination carry a
|
||||
specific safety hazard, and is the infrastructure/regulatory environment it
|
||||
needs realistic? Both feed into the RATING below as qualitative judgment
|
||||
calls, not as scores of their own.
|
||||
|
||||
## What makes something IMPLAUSIBLE
|
||||
Mark IMPLAUSIBLE if either of these is true:
|
||||
- It is physically or engineering-wise impossible given the components
|
||||
@@ -150,15 +166,13 @@ Mark IMPLAUSIBLE if either of these is true:
|
||||
fatiguing a hull over time is a real structural risk, not just "explosives
|
||||
are dangerous in general"; a fuel that's fine in the open becoming
|
||||
concentrated in a sealed tube is a real risk, not just "fuel is
|
||||
flammable"). A low given safety score is a signal the pipeline already
|
||||
found something concerning — treat it as evidence, not noise to explain
|
||||
away.
|
||||
flammable").
|
||||
- Or: a real regulatory/infrastructure barrier with no plausible workaround.
|
||||
|
||||
None of these make something implausible on their own:
|
||||
- being unoriginal or something like it already exists
|
||||
- being expensive, slow, or short-range
|
||||
- a single mediocre score on one metric that isn't safety-related
|
||||
- a single mediocre score on one metric
|
||||
|
||||
Most concepts that reach this review are ordinary and workable; reserve
|
||||
IMPLAUSIBLE for a real, specific problem you can name — but don't require
|
||||
@@ -167,14 +181,26 @@ Reason from the physics and engineering actually described here, not from
|
||||
whether something like it already exists — novelty or lack of it is not
|
||||
evidence either way.
|
||||
|
||||
## Overall Rating
|
||||
Separately from the plausibility verdict, give ONE holistic rating —
|
||||
LOW, MEDIUM, or HIGH — for how good this combination is overall. This is a
|
||||
single combined judgment, not a separate score per attribute: weigh the
|
||||
metric scores above together with your own qualitative read on safety and
|
||||
accessibility into one rating, the way a person sizing up the whole concept
|
||||
would, not a checklist of independent numbers.
|
||||
|
||||
## What to write
|
||||
In 2-4 sentences, give your reasoning, then check it against the scores
|
||||
above: if your reasoning conflicts with a score (e.g. you believe this is
|
||||
hazardous but its safety score is high), name the metric and say so
|
||||
above: if your reasoning conflicts with a score (e.g. you believe cost is
|
||||
a serious problem but its cost score is high), name the metric and say so
|
||||
explicitly — don't silently contradict a given score.
|
||||
|
||||
Finish with exactly one line:
|
||||
Finish with exactly two lines. For the first, pick exactly one:
|
||||
RATING: LOW
|
||||
RATING: MEDIUM
|
||||
RATING: HIGH
|
||||
|
||||
Then, for the second, pick exactly one:
|
||||
VERDICT: PLAUSIBLE
|
||||
or
|
||||
VERDICT: IMPLAUSIBLE
|
||||
"""
|
||||
|
||||
@@ -13,7 +13,7 @@ from physcom.llm.prompts import (
|
||||
format_metrics_for_prompt,
|
||||
format_scores_for_prompt,
|
||||
)
|
||||
from physcom.models.domain import MetricBound
|
||||
from physcom.models.domain import Domain, MetricBound
|
||||
|
||||
|
||||
class GeminiLLMProvider(LLMProvider):
|
||||
@@ -51,12 +51,14 @@ class GeminiLLMProvider(LLMProvider):
|
||||
combination_description: str,
|
||||
raw_metrics: dict[str, float],
|
||||
normalized_scores: dict[str, float],
|
||||
metrics: list[MetricBound],
|
||||
domain: Domain,
|
||||
) -> tuple[str, bool]:
|
||||
scores_str = format_scores_for_prompt(raw_metrics, normalized_scores, metrics)
|
||||
scores_str = format_scores_for_prompt(raw_metrics, normalized_scores, domain.metric_bounds)
|
||||
prompt = PLAUSIBILITY_REVIEW_PROMPT.format(
|
||||
description=combination_description,
|
||||
scores=scores_str,
|
||||
domain_name=domain.name,
|
||||
domain_description=domain.description,
|
||||
)
|
||||
try:
|
||||
response = self._client.models.generate_content(
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from physcom.llm.base import LLMProvider
|
||||
from physcom.models.domain import MetricBound
|
||||
from physcom.models.domain import Domain, MetricBound
|
||||
|
||||
|
||||
class MockLLMProvider(LLMProvider):
|
||||
@@ -25,7 +25,7 @@ class MockLLMProvider(LLMProvider):
|
||||
combination_description: str,
|
||||
raw_metrics: dict[str, float],
|
||||
normalized_scores: dict[str, float],
|
||||
metrics: list[MetricBound],
|
||||
domain: Domain,
|
||||
) -> tuple[str, bool]:
|
||||
avg = sum(normalized_scores.values()) / max(len(normalized_scores), 1)
|
||||
if avg > 0.5:
|
||||
|
||||
@@ -14,7 +14,7 @@ from physcom.llm.prompts import (
|
||||
format_metrics_for_prompt,
|
||||
format_scores_for_prompt,
|
||||
)
|
||||
from physcom.models.domain import MetricBound
|
||||
from physcom.models.domain import Domain, MetricBound
|
||||
|
||||
|
||||
class OllamaLLMProvider(LLMProvider):
|
||||
@@ -39,12 +39,14 @@ class OllamaLLMProvider(LLMProvider):
|
||||
combination_description: str,
|
||||
raw_metrics: dict[str, float],
|
||||
normalized_scores: dict[str, float],
|
||||
metrics: list[MetricBound],
|
||||
domain: Domain,
|
||||
) -> tuple[str, bool]:
|
||||
scores_str = format_scores_for_prompt(raw_metrics, normalized_scores, metrics)
|
||||
scores_str = format_scores_for_prompt(raw_metrics, normalized_scores, domain.metric_bounds)
|
||||
prompt = PLAUSIBILITY_REVIEW_PROMPT.format(
|
||||
description=combination_description,
|
||||
scores=scores_str,
|
||||
domain_name=domain.name,
|
||||
domain_description=domain.description,
|
||||
)
|
||||
text = self._generate(prompt, json_mode=False).strip()
|
||||
return (text, parse_verdict(text))
|
||||
|
||||
Reference in New Issue
Block a user