File size: 2,220 Bytes
a2b0c04 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | """Print and save the learnability verdicts for one or more runs.
python scripts/report.py runs/day1 [runs/day1-high ...]
Episodes from all given runs are pooled per suite (so a later Beam-high run adds a rung to day1's ladder).
Writes <first run>/report.json and report.md.
"""
import json
import sys
from collections import defaultdict
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from shortlist.checks import check_suite # noqa: E402
def fmt(x, nd=2):
return "–" if x is None else (f"{x:.{nd}f}" if isinstance(x, float) else str(x))
def main() -> None:
runs = [Path(p) for p in sys.argv[1:]]
pooled: dict[str, list[dict]] = defaultdict(list)
for run in runs:
for path in sorted(run.glob("*.jsonl")):
pooled[path.stem] += [json.loads(l) for l in path.read_text().splitlines() if l.strip()]
results = [check_suite(s, rows) for s, rows in sorted(pooled.items())]
(runs[0] / "report.json").write_text(json.dumps(results, indent=2))
lines = ["| Environment | Verdict | Floor (do-nothing/random) | Beam by effort | GRPO signal | Beam output tokens |", "|---|---|---|---|---|---|"]
for r in results:
t = r["tiers"]
def rung(name):
s = t.get(name)
if not s:
return None
return f"{s['mean']:.2f}" + (f" ({s['pass@1']:.0%} solved)" if "pass@1" in s else "")
floor = " / ".join(x for x in (rung("null"), rung("random")) if x) or "–"
beams = ", ".join(f"{k[5:]}: {rung(k)}" for k in t if k.startswith("beam-")) or "–"
tokens = sum(v["out_tokens"] for k, v in t.items() if k.startswith("beam-"))
grpo = ", ".join(f"{k[5:]}: {v['grpo_signal']:.0%}" for k, v in t.items() if k.startswith("beam-") and v.get("grpo_signal") is not None) or "–"
lines.append(f"| {r['suite']} | {r['verdict']} | {floor} | {beams} | {grpo} | {tokens:,} |")
md = "\n".join(lines)
(runs[0] / "report.md").write_text(md + "\n")
print(md)
for r in results:
if r.get("error_examples"):
print(f"\n{r['suite']} errors ({r['errors']}): {r['error_examples']}")
if __name__ == "__main__":
main()
|