nape-repro-results / repro_scripts /claim2_predictability.py
MSGEncrypted's picture
Upload folder using huggingface_hub
4db68fa verified
Raw
History Blame Contribute Delete
2.07 kB
"""Claim 2: empirical predictability ceiling (paper Section 2.1, Figure 3).
Paper: across the 52 trajectories, 68% of all ground-truth (cell, property)
pairs are predicted by at least one frontier-LLM oracle (union over Opus 4.6,
Opus 4.7, GPT-5.4, GPT-5.5, 2 generations per step); per-trajectory median
66.3%, 44/52 trajectories exceed 50%. Figure 3 reports mean 66.0.
The repo ships the oracle output per trajectory as
data/raw/<id>/predictable_state.json with fields predictable_count,
final_state_size, coverage_pct. We aggregate those.
"""
import glob
import json
import statistics
files = sorted(glob.glob("NAPE/data/raw/*/predictable_state.json"))
rows = []
for f in files:
d = json.load(open(f))
rows.append((d["trajectory_name"], d["predictable_count"],
d["final_state_size"], d["coverage_pct"]))
n = len(rows)
tot_pred = sum(r[1] for r in rows)
tot_state = sum(r[2] for r in rows)
covs = [r[3] for r in rows]
overall = 100 * tot_pred / tot_state
over50 = sum(c > 50 for c in covs)
print(f"trajectories with oracle file : {n}")
print(f"total predictable properties : {tot_pred}")
print(f"total final-state properties : {tot_state}")
print(f"overall coverage (pooled) : {overall:.1f}% (paper: 68%)")
print(f"per-trajectory mean : {statistics.mean(covs):.1f}% (paper Fig.3: 66.0)")
print(f"per-trajectory median : {statistics.median(covs):.1f}% (paper: 66.3%)")
print(f"trajectories > 50% coverage : {over50}/{n} (paper: 44/52)")
json.dump({
"n": n, "overall_pct": round(overall, 2),
"mean_pct": round(statistics.mean(covs), 2),
"median_pct": round(statistics.median(covs), 2),
"over_50": over50,
"per_trajectory": [{"name": r[0], "coverage_pct": r[3]} for r in rows],
}, open("repro_outputs/claim2_predictability.json", "w"), indent=2)
print("\nWrote repro_outputs/claim2_predictability.json")
ok = abs(overall - 68) < 1 and abs(statistics.median(covs) - 66.3) < 0.2 and over50 == 44
print("CLAIM 2 (from shipped oracle artifacts):", "REPRODUCED" if ok else "CHECK NUMBERS")