omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / train / omega-llm / tools / combined / experiment / summarize.py
| 1 | """Audit the sealed per-task decisions and decide whether the registered method advances.""" |
| 2 | from collections import Counter |
| 3 | import json |
| 4 | from pathlib import Path |
| 5 | import statistics |
| 6 | import sys |
| 7 | |
| 8 | |
| 9 | def summarize(directory): |
| 10 | counts={} |
| 11 | for arm in ("baseline","improved_cli","fixed","adaptive"): |
| 12 | rows=json.loads((directory/f"{arm}.json").read_text()) |
| 13 | sealed=list(map(json.loads,(directory/f"{arm}.sealed.jsonl").read_text().splitlines())) |
| 14 | assert all(all(row[key]==value for key,value in choice.items()) |
| 15 | for row,choice in zip(rows,sealed,strict=True)) |
| 16 | ids=[r["id"] for r in rows] |
| 17 | assert len(set(ids))==len(ids)==80 |
| 18 | groups={} |
| 19 | for group,n in Counter(r["group"] for r in rows).items(): |
| 20 | assert n==20 |
| 21 | groups[group]=dict(Counter(r["verdict"] for r in rows if r["group"]==group)) |
| 22 | budget=max(r["query_count"] for r in rows) |
| 23 | assert all(len({tuple(q[0]) for q in r["queries"]})==r["query_count"]<=8 for r in rows) |
| 24 | assert all(r["query_count"]==8 for r in rows if r["verdict"]!="error") |
| 25 | times=[r["seconds"] for r in rows] |
| 26 | counts[arm]=dict(verdicts=dict(Counter(r["verdict"] for r in rows)),groups=groups, |
| 27 | query_max=budget,selection_total_seconds=sum(times), |
| 28 | selection_median_seconds=statistics.median(times), |
| 29 | final_scoring_total_seconds=sum(r["scoring_seconds"] for r in rows)) |
| 30 | a,b=counts["adaptive"],counts["baseline"] |
| 31 | criteria=dict(more_correct=a["verdicts"].get("correct",0)>b["verdicts"].get("correct",0), |
| 32 | no_more_wrong=a["verdicts"].get("wrong",0)<=b["verdicts"].get("wrong",0), |
| 33 | fewer_wrong_branches=a["groups"]["branch"].get("wrong",0)<b["groups"]["branch"].get("wrong",0), |
| 34 | within_budget=a["query_max"]<=8) |
| 35 | interrupted = (directory/"interruption.json").exists() |
| 36 | return dict(arms=counts,criteria=criteria,interrupted=interrupted, |
| 37 | decision="advance" if all(criteria.values()) and not interrupted else "experimental") |
| 38 | |
| 39 | |
| 40 | if __name__=="__main__": |
| 41 | print(json.dumps(summarize(Path(sys.argv[1])),indent=2)) |