diff --git a/scripts/bench-chat-paired.py b/scripts/bench-chat-paired.py index 4758099a..b50f7e7d 100755 --- a/scripts/bench-chat-paired.py +++ b/scripts/bench-chat-paired.py @@ -211,7 +211,9 @@ def summarize(rows, paired): pair["candidate"]["wall_seconds"] / pair["baseline"]["wall_seconds"] for pair in complete), "same_normalized_output": sum( - normalized_output(pair["baseline"]) == normalized_output(pair["candidate"]) + pair["baseline"]["http_status"] == pair["candidate"]["http_status"] == 200 + and normalized_output(pair["baseline"]) is not None + and normalized_output(pair["baseline"]) == normalized_output(pair["candidate"]) for pair in complete), "both_quality_passed": sum( pair["baseline"]["quality"]["passed"] and diff --git a/scripts/compare-chat-reports.py b/scripts/compare-chat-reports.py index 5bd2b600..5d2dab65 100644 --- a/scripts/compare-chat-reports.py +++ b/scripts/compare-chat-reports.py @@ -101,7 +101,9 @@ def main(): "candidate_over_baseline_wall_ratio": c["wall_seconds"] / b["wall_seconds"], "baseline_quality_passed": b["quality"]["passed"], "candidate_quality_passed": c["quality"]["passed"], - "same_normalized_output": normalized(b) == normalized(c), + "same_normalized_output": (b["http_status"] == c["http_status"] == 200 + and normalized(b) is not None + and normalized(b) == normalized(c)), "baseline_usage": b["response"].get("usage") if isinstance(b["response"], dict) else None, "candidate_usage": c["response"].get("usage") if isinstance(c["response"], dict) else None, "baseline_timings": (b["response"].get("timings") or {}) diff --git a/scripts/test-benchmark-harness.py b/scripts/test-benchmark-harness.py index 91ba5454..3fa7c285 100644 --- a/scripts/test-benchmark-harness.py +++ b/scripts/test-benchmark-harness.py @@ -60,6 +60,11 @@ def main(): prompt = benchmark.materialize_messages(long_case["messages"])[0]["content"] assert prompt.count("filler row:") == 4400 assert prompt.count("VALID AUDIT CODE: amber-731") == 1 + failed = [{"arm": arm, "case_id": "broken", "repeat": 0, "warmup": False, + "wall_seconds": 1.0, "http_status": 500, "response": {}, + "quality": {"passed": False}} + for arm in ("baseline", "candidate")] + assert benchmark.summarize(failed, True)["paired"]["same_normalized_output"] == 0 server = http.server.ThreadingHTTPServer(("127.0.0.1", 0), Handler) thread = threading.Thread(target=server.serve_forever, daemon=True) thread.start()