theodorebiadala's picture
add rounds 5 to 8, the reviews and the analysis
b78499d verified
Raw History Blame Contribute Delete
1.99 kB
"""Compare each arm with a base arm, counting Opus on codex and vibe answers and the vendor judge on claude answers.
interim.py REPO BASE DIR [DIR ...]
"""
import collections
import importlib.util
import json
import pathlib
import sys
repo, base, dirs = pathlib.Path(sys.argv[1]), sys.argv[2], [pathlib.Path(d) for d in sys.argv[3:]]
s = importlib.util.spec_from_file_location("run", repo / "evals" / "run.py")
run = importlib.util.module_from_spec(s)
s.loader.exec_module(run)
spec = json.loads((repo / "evals" / "cases.json").read_text())
rows = [r for d in dirs for r in run.read_rows(d / "results.jsonl")]
for r in rows:
name = "vendor" if r["model"].startswith("claude:") else "arbiter"
r["judges"] = {"mix": r["judges"][name]}
table = run.metrics(rows, spec, run.config.load(run.EVALS), "mix")
count = collections.Counter((r["arm"], r["model"]) for r in rows)
models = sorted({r["model"] for r in rows})
arms = sorted({r["arm"] for r in rows}, key=lambda a: (a != "none", a != base, a))
full = len(spec["cases"]) * 3 * len(models)
lost = run.drops(table, base)
metrics_n = len({m for _, _, m in table})
print(f"base: {base}; {metrics_n} metrics; drop when pooled p < {run.P_LIMIT}\n")
print(f"{'arm':16}" + "".join(f"{m.split(':')[1][:13]:>14}" for m in models) + " drops rows")
for arm in arms:
cells = []
for m in models:
vals = [run.rate(c) for (a, mm, _), c in table.items() if a == arm and mm == m]
cells.append(f"{sum(vals) / len(vals):14.1f}" if vals else f"{'-':>14}")
n = sum(1 for d in lost if d[0] == arm)
done = sum(count[(arm, m)] for m in models)
print(f"{arm:16}" + "".join(cells) + f" {n if arm != base else '':>5} {done}/{full}")
print("\nDrops per arm")
for arm in arms:
mine = [d for d in lost if d[0] == arm]
if mine:
print(f" {arm}")
for _, metric, before, after, p in sorted(mine, key=lambda d: d[4]):
print(f" {metric:30} {before:5.1f} -> {after:5.1f} p={p:.4f}")