arithmetic-transitions · e33e5feeadcc
Browse files- docs/explorer.js +2 -0
- reports/learnability-preregistration.md +4 -0
- src/study/learnability.py +5 -3
- src/study/learnability_analysis.py +22 -0
- src/study/learnability_report.py +15 -0
- src/study/publish.py +3 -1
- src/study/report.py +23 -1
- tests/test_learnability.py +43 -0
docs/explorer.js
CHANGED
|
@@ -107,6 +107,8 @@ async function update() {
|
|
| 107 |
const vals=Object.entries(cal?.evaluations ?? {}).filter(([,v])=>v).map(([k,v])=>k+" "+v.correct+"/"+v.n);
|
| 108 |
byId("learned").textContent=cal?.learning ? "Learning criterion "+(cal.learning.demonstrated?"met. ":"unmet. ")+vals.join(" · ") :
|
| 109 |
vals.length ? "Fresh validation outcomes · "+vals.join(" · ") : "The positive-control test compares exact-reward training with the starting solver and shuffled rewards.";
|
|
|
|
|
|
|
| 110 |
byId("results").replaceChildren();
|
| 111 |
for (const r of study.runs) row(byId("results"),[r.name,r.role,r.updates,pct(r.dev),r.dev_n,pct(r.test),r.test_n]);
|
| 112 |
const current=byId("run").value || study.runs.find(r=>r.name!=="base" && r.updates==null)?.name;
|
|
|
|
| 107 |
const vals=Object.entries(cal?.evaluations ?? {}).filter(([,v])=>v).map(([k,v])=>k+" "+v.correct+"/"+v.n);
|
| 108 |
byId("learned").textContent=cal?.learning ? "Learning criterion "+(cal.learning.demonstrated?"met. ":"unmet. ")+vals.join(" · ") :
|
| 109 |
vals.length ? "Fresh validation outcomes · "+vals.join(" · ") : "The positive-control test compares exact-reward training with the starting solver and shuffled rewards.";
|
| 110 |
+
const arithmetic=cal?.learning?.by_parse?.base?.groups?.find(g=>g.stratum==="Both parsed");
|
| 111 |
+
if (arithmetic) byId("learned").textContent += " Among "+arithmetic.n+" already parseable pairs, training corrected "+arithmetic.gains+" arithmetic traces and broke "+arithmetic.losses+".";
|
| 112 |
byId("results").replaceChildren();
|
| 113 |
for (const r of study.runs) row(byId("results"),[r.name,r.role,r.updates,pct(r.dev),r.dev_n,pct(r.test),r.test_n]);
|
| 114 |
const current=byId("run").value || study.runs.find(r=>r.name!=="base" && r.updates==null)?.name;
|
reports/learnability-preregistration.md
CHANGED
|
@@ -22,6 +22,10 @@ Compare the untrained, exact-trained and shuffled-control checkpoints on the sam
|
|
| 22 |
|
| 23 |
On the confirmed family, separately replay matched correct and single-error solutions from sixteen problems through the frozen three-judge chain. Report each judge’s sensitivity and specificity, balanced accuracy, malformed reports and whole-evidence correctness. Run the evidence-altered Judge 2 twins with Judge 3. A learnable arithmetic population can still have an unreliable learned reward. Train and report matched recursive solvers under the selected configuration before drawing conclusions about depth. Preserve the harder original evaluation as a transfer target. The original and calibrated protocols have separate result paths.
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
## Amended depth comparison after a demonstrated learning gain
|
| 26 |
|
| 27 |
Freeze the chosen arithmetic family and prompt style across every arm. Repeat the original run matrix with distinct calibrated checkpoint names, including a fresh D3 solver. Keep the timing-selected update count, within-seed prompt order, call budgets, stage order and three-seed decision rule. The calibrated primary uses the first 2,048 canonical problems from the reserved benchmark partition of the selected family. The next 128 distinct IDs serve the mechanism intervention. Apply the registered paired interval and three-point practical target to the calibrated D3-minus-D2 contrast. This is a new, conditional population and estimand.
|
|
|
|
| 22 |
|
| 23 |
On the confirmed family, separately replay matched correct and single-error solutions from sixteen problems through the frozen three-judge chain. Report each judge’s sensitivity and specificity, balanced accuracy, malformed reports and whole-evidence correctness. Run the evidence-altered Judge 2 twins with Judge 3. A learnable arithmetic population can still have an unreliable learned reward. Train and report matched recursive solvers under the selected configuration before drawing conclusions about depth. Preserve the harder original evaluation as a transfer target. The original and calibrated protocols have separate result paths.
|
| 24 |
|
| 25 |
+
### Distinguishing arithmetic gains from formatting gains
|
| 26 |
+
|
| 27 |
+
Before collecting calibration outcomes, we specified a descriptive decomposition of the same validation contrasts. For each pair of checkpoints classify each problem by whether both parses succeeded, only the trained solver parsed, only the comparator parsed, or neither parsed. Count complete-trace gains and losses within each class. A correction when both answers already parse is an arithmetic correction. Newly parseable and correct answers may improve both arithmetic and formatting, so their two contributions cannot be disentangled. These counts must reconcile to the paired gain across all problems. No stratum can change the registered learning decision. Report a matched example of each observed type of change in canonical-key order.
|
| 28 |
+
|
| 29 |
## Amended depth comparison after a demonstrated learning gain
|
| 30 |
|
| 31 |
Freeze the chosen arithmetic family and prompt style across every arm. Repeat the original run matrix with distinct calibrated checkpoint names, including a fresh D3 solver. Keep the timing-selected update count, within-seed prompt order, call budgets, stage order and three-seed decision rule. The calibrated primary uses the first 2,048 canonical problems from the reserved benchmark partition of the selected family. The next 128 distinct IDs serve the mechanism intervention. Apply the registered paired interval and three-point practical target to the calibrated D3-minus-D2 contrast. This is a new, conditional population and estimand.
|
src/study/learnability.py
CHANGED
|
@@ -7,7 +7,7 @@ from .curriculum import FAMILIES, STYLES, curriculum_problems
|
|
| 7 |
from .design import PILOTS, Run
|
| 8 |
from .evaluate import mechanisms, weights_digest
|
| 9 |
from .judging import chain
|
| 10 |
-
from .learnability_analysis import cell_metrics, choose_cell, confirmed, learning_result
|
| 11 |
from .records import expected, parse, render, solver_truth, sound, terminal
|
| 12 |
from .storage import RESULTS, Journal, append, read_json, rows, stamp, write_json
|
| 13 |
|
|
@@ -157,9 +157,11 @@ def evaluate_pilot(name):
|
|
| 157 |
|
| 158 |
def compare():
|
| 159 |
where=directory()/"evaluations"
|
| 160 |
-
samples=[{r["key"]:r
|
| 161 |
if (where/(name+".json")).is_file() else {} for name in ("base",*PILOTS)]
|
| 162 |
-
result=learning_result(*samples)
|
| 163 |
if result["status"]=="complete":
|
|
|
|
|
|
|
| 164 |
write_json(directory()/"learning.json",dict(time=stamp(),**result))
|
| 165 |
return result
|
|
|
|
| 7 |
from .design import PILOTS, Run
|
| 8 |
from .evaluate import mechanisms, weights_digest
|
| 9 |
from .judging import chain
|
| 10 |
+
from .learnability_analysis import cell_metrics, changes_by_parse, choose_cell, confirmed, learning_result
|
| 11 |
from .records import expected, parse, render, solver_truth, sound, terminal
|
| 12 |
from .storage import RESULTS, Journal, append, read_json, rows, stamp, write_json
|
| 13 |
|
|
|
|
| 157 |
|
| 158 |
def compare():
|
| 159 |
where=directory()/"evaluations"
|
| 160 |
+
samples=[{r["key"]:r for r in rows(where/(name+".jsonl"))}
|
| 161 |
if (where/(name+".json")).is_file() else {} for name in ("base",*PILOTS)]
|
| 162 |
+
result=learning_result(*({key:r["correct"] for key,r in records.items()} for records in samples))
|
| 163 |
if result["status"]=="complete":
|
| 164 |
+
base, trained, shuffled = samples
|
| 165 |
+
result["by_parse"] = {"base":changes_by_parse(trained,base), "shuffled":changes_by_parse(trained,shuffled)}
|
| 166 |
write_json(directory()/"learning.json",dict(time=stamp(),**result))
|
| 167 |
return result
|
src/study/learnability_analysis.py
CHANGED
|
@@ -36,6 +36,28 @@ def paired_change(after,before):
|
|
| 36 |
fixed=int((d>0).sum()),harmed=int((d<0).sum()))
|
| 37 |
|
| 38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
def learning_result(base,exact,shuffled):
|
| 40 |
if len(base)!=256 or base.keys()!=exact.keys() or base.keys()!=shuffled.keys():
|
| 41 |
return {"status":"pending"}
|
|
|
|
| 36 |
fixed=int((d>0).sum()),harmed=int((d<0).sum()))
|
| 37 |
|
| 38 |
|
| 39 |
+
def changes_by_parse(after, before):
|
| 40 |
+
"""Partition the paired accuracy change; choose the first canonical example per kind."""
|
| 41 |
+
if before.keys() != after.keys():
|
| 42 |
+
raise ValueError("Parse transitions require identical problem IDs")
|
| 43 |
+
labels = {(True,True):"Both parsed", (True,False):"Only trained parsed",
|
| 44 |
+
(False,True):"Only comparator parsed", (False,False):"Neither parsed"}
|
| 45 |
+
counts = {label:dict(stratum=label, n=0, gains=0, losses=0) for label in labels.values()}
|
| 46 |
+
examples = {}
|
| 47 |
+
for key in sorted(before):
|
| 48 |
+
trained, comparator = after[key], before[key]
|
| 49 |
+
label = labels[bool(trained["parsed"]), bool(comparator["parsed"])]
|
| 50 |
+
counts[label]["n"] += 1
|
| 51 |
+
change = trained["correct"] - comparator["correct"]
|
| 52 |
+
if change:
|
| 53 |
+
direction = "gain" if change > 0 else "loss"
|
| 54 |
+
counts[label]["gains" if change > 0 else "losses"] += 1
|
| 55 |
+
examples.setdefault((label,direction),dict(key=key, stratum=label, change=direction,
|
| 56 |
+
expression=trained["expression"], expected=trained["expected_values"],
|
| 57 |
+
comparator=comparator["trace"], trained=trained["trace"]))
|
| 58 |
+
return dict(groups=list(counts.values()), examples=list(examples.values()))
|
| 59 |
+
|
| 60 |
+
|
| 61 |
def learning_result(base,exact,shuffled):
|
| 62 |
if len(base)!=256 or base.keys()!=exact.keys() or base.keys()!=shuffled.keys():
|
| 63 |
return {"status":"pending"}
|
src/study/learnability_report.py
CHANGED
|
@@ -1,5 +1,7 @@
|
|
| 1 |
"""Summarize calibration cells and paired validation independently of the original benchmark."""
|
| 2 |
|
|
|
|
|
|
|
| 3 |
from .design import PILOTS
|
| 4 |
from .storage import read_json
|
| 5 |
from .tables import markdown, points, rate
|
|
@@ -27,6 +29,8 @@ def learnability_text(data):
|
|
| 27 |
chosen=screen["selected"]
|
| 28 |
out.append(f"The registered rule selected {chosen['family']} with {chosen['style']} prompts." if chosen else
|
| 29 |
"No configuration qualified under the registered rule.")
|
|
|
|
|
|
|
| 30 |
if data["confirmation"]:
|
| 31 |
c=data["confirmation"]["cell"]
|
| 32 |
passed="passed" if data["confirmation"]["confirmed"] else "failed"
|
|
@@ -46,7 +50,18 @@ def learnability_text(data):
|
|
| 46 |
if data["learning"]:
|
| 47 |
result=data["learning"]
|
| 48 |
out.append("The registered learning criterion was "+("met." if result["demonstrated"] else "unmet."))
|
|
|
|
|
|
|
| 49 |
out.append(markdown(["Exact-trained minus","Gain (pp)","95% lower (pp)","95% upper (pp)","Fixed","Harmed"],
|
| 50 |
[[label,points(r["delta"]),*(points(x) for x in r["interval"]),r["fixed"],r["harmed"]]
|
| 51 |
for label,r in (("Frozen base",result["over_base"]),("Shuffled control",result["over_shuffled"]))]))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
return "\n\n".join(out)+"\n"
|
|
|
|
| 1 |
"""Summarize calibration cells and paired validation independently of the original benchmark."""
|
| 2 |
|
| 3 |
+
from html import escape
|
| 4 |
+
|
| 5 |
from .design import PILOTS
|
| 6 |
from .storage import read_json
|
| 7 |
from .tables import markdown, points, rate
|
|
|
|
| 29 |
chosen=screen["selected"]
|
| 30 |
out.append(f"The registered rule selected {chosen['family']} with {chosen['style']} prompts." if chosen else
|
| 31 |
"No configuration qualified under the registered rule.")
|
| 32 |
+
if chosen and chosen["family"]=="one":
|
| 33 |
+
out.append("With one operation, final-answer accuracy and complete-trace accuracy coincide. The harder signed transfer cohort tests intermediate-step correctness.")
|
| 34 |
if data["confirmation"]:
|
| 35 |
c=data["confirmation"]["cell"]
|
| 36 |
passed="passed" if data["confirmation"]["confirmed"] else "failed"
|
|
|
|
| 50 |
if data["learning"]:
|
| 51 |
result=data["learning"]
|
| 52 |
out.append("The registered learning criterion was "+("met." if result["demonstrated"] else "unmet."))
|
| 53 |
+
out.append("The paired comparison also supports a reward-specific improvement." if result["reward_specific"] else
|
| 54 |
+
"The evidence did not meet the registered criterion for a reward-specific improvement.")
|
| 55 |
out.append(markdown(["Exact-trained minus","Gain (pp)","95% lower (pp)","95% upper (pp)","Fixed","Harmed"],
|
| 56 |
[[label,points(r["delta"]),*(points(x) for x in r["interval"]),r["fixed"],r["harmed"]]
|
| 57 |
for label,r in (("Frozen base",result["over_base"]),("Shuffled control",result["over_shuffled"]))]))
|
| 58 |
+
for comparator, breakdown in result.get("by_parse", {}).items():
|
| 59 |
+
out.extend([f"### Formatting and arithmetic changes against {comparator}",
|
| 60 |
+
markdown(["Parse status","Problems","Gained complete correctness","Lost complete correctness"],
|
| 61 |
+
[[g["stratum"],g["n"],g["gains"],g["losses"]] for g in breakdown["groups"]])])
|
| 62 |
+
for ex in breakdown["examples"]:
|
| 63 |
+
reference = ",".join(map(str,ex["expected"]))
|
| 64 |
+
text = (f"Problem {ex['expression']}\nExpected {reference}\nComparator\n{ex['comparator']}"
|
| 65 |
+
f"\nExact-trained\n{ex['trained']}")
|
| 66 |
+
out.append(f"{ex['stratum']} · {ex['change']}\n\n<pre>{escape(text)}</pre>")
|
| 67 |
return "\n\n".join(out)+"\n"
|
src/study/publish.py
CHANGED
|
@@ -59,7 +59,9 @@ def publish(milestone, run=None):
|
|
| 59 |
f"[Study, run matrix and evaluation]({GITHUB}). "
|
| 60 |
f"[Raw data, logs and paper](https://huggingface.co/datasets/{DATA}). "
|
| 61 |
f"[Load an adapter]({GITHUB}/blob/main/docs/usage.md#using-a-published-adapter).\n\n"
|
| 62 |
-
+(ROOT/"reports/summary.md").read_text(encoding="utf-8")
|
|
|
|
|
|
|
| 63 |
api.upload_file(path_or_fileobj=card.encode(),path_in_repo="README.md",repo_id=MODELS,
|
| 64 |
commit_message=f"Update study card at {release}")
|
| 65 |
if run and (adapter(run)/"adapter_config.json").is_file() and milestone.endswith("-trained"):
|
|
|
|
| 59 |
f"[Study, run matrix and evaluation]({GITHUB}). "
|
| 60 |
f"[Raw data, logs and paper](https://huggingface.co/datasets/{DATA}). "
|
| 61 |
f"[Load an adapter]({GITHUB}/blob/main/docs/usage.md#using-a-published-adapter).\n\n"
|
| 62 |
+
+(ROOT/"reports/summary.md").read_text(encoding="utf-8")
|
| 63 |
+
.replace("(preregistration.md)",f"({GITHUB}/blob/main/reports/preregistration.md)")
|
| 64 |
+
.replace("(learnability.md)",f"({GITHUB}/blob/main/reports/learnability.md)"))
|
| 65 |
api.upload_file(path_or_fileobj=card.encode(),path_in_repo="README.md",repo_id=MODELS,
|
| 66 |
commit_message=f"Update study card at {release}")
|
| 67 |
if run and (adapter(run)/"adapter_config.json").is_file() and milestone.endswith("-trained"):
|
src/study/report.py
CHANGED
|
@@ -320,6 +320,8 @@ def paper(data, date):
|
|
| 320 |
line(f"The amended primary population uses {config['family']} arithmetic with {config['style']} prompts for every arm. Learning was measured on a separate validation partition before this population was frozen. The primary comparison uses 2,048 new canonical problems. The following 128 form the evidence cohort. The original signed population is also evaluated for transfer.")
|
| 321 |
if config["family"]=="registered":
|
| 322 |
line("The signed-difficulty transfer and the amended primary coincide for this selection.")
|
|
|
|
|
|
|
| 323 |
if data["original_development"]:
|
| 324 |
table(["Original development","Correct complete trace","Problems"],
|
| 325 |
[[r["name"],r["correct"],r["n"]] for r in data["original_development"]])
|
|
@@ -343,6 +345,11 @@ def paper(data, date):
|
|
| 343 |
if learning["learning"]:
|
| 344 |
gain=learning["learning"]["over_base"]
|
| 345 |
line(f"Exact-reward training changed held-out development accuracy by {100*gain['delta']:+.2f} percentage points relative to the starting solver. The paired 95% interval was [{100*gain['interval'][0]:+.2f}, {100*gain['interval'][1]:+.2f}] points. The full shuffled control is in the learnability report.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 346 |
primary = data["primary"]
|
| 347 |
if "delta" in primary:
|
| 348 |
line(f"The equally weighted paired difference is {primary['delta']*100:.2f} percentage points. The conditional 95% problem-bootstrap interval is [{primary['ci'][0]*100:.2f}, {primary['ci'][1]*100:.2f}] points. The registered decision is {primary['status']}.")
|
|
@@ -455,6 +462,21 @@ def build():
|
|
| 455 |
if "delta" in primary:
|
| 456 |
status += f" Difference {100*primary['delta']:.2f} percentage points, conditional 95% interval [{100*primary['ci'][0]:.2f}, {100*primary['ci'][1]:.2f}]."
|
| 457 |
summary = status+"\n\n"+score
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 458 |
if data["original_development"]:
|
| 459 |
summary += "\n\nOn the original signed development population, "+", ".join(
|
| 460 |
f"{r['name']} solved {r['correct']}/{r['n']}" for r in data["original_development"])+"."
|
|
@@ -468,7 +490,7 @@ def build():
|
|
| 468 |
if comparisons:
|
| 469 |
summary += "\n\n" + markdown(["Contrast", "Seed", "Difference (pp)", "95% lower", "95% upper"], comparisons)
|
| 470 |
explanation = "Solver scores require every intermediate value. Judge scores require all fields of the evidence record. Intervals condition on the trained checkpoints."
|
| 471 |
-
atomic(REPORTS/"summary.md","# Study summary\n\n"+summary+"\n\n"+explanation+" [Preregistration](preregistration.md).\n")
|
| 472 |
readme = (ROOT/"README.md").read_text(encoding="utf-8")
|
| 473 |
pre, tail = readme.split("<!-- RESULTS:START -->",1)
|
| 474 |
_, post = tail.split("<!-- RESULTS:END -->",1)
|
|
|
|
| 320 |
line(f"The amended primary population uses {config['family']} arithmetic with {config['style']} prompts for every arm. Learning was measured on a separate validation partition before this population was frozen. The primary comparison uses 2,048 new canonical problems. The following 128 form the evidence cohort. The original signed population is also evaluated for transfer.")
|
| 321 |
if config["family"]=="registered":
|
| 322 |
line("The signed-difficulty transfer and the amended primary coincide for this selection.")
|
| 323 |
+
elif config["family"]=="one":
|
| 324 |
+
line("The amended primary has one operation per problem, so its final answer is the complete trace. Multi-step evidence comes from the signed, layout and length transfer cohorts.")
|
| 325 |
if data["original_development"]:
|
| 326 |
table(["Original development","Correct complete trace","Problems"],
|
| 327 |
[[r["name"],r["correct"],r["n"]] for r in data["original_development"]])
|
|
|
|
| 345 |
if learning["learning"]:
|
| 346 |
gain=learning["learning"]["over_base"]
|
| 347 |
line(f"Exact-reward training changed held-out development accuracy by {100*gain['delta']:+.2f} percentage points relative to the starting solver. The paired 95% interval was [{100*gain['interval'][0]:+.2f}, {100*gain['interval'][1]:+.2f}] points. The full shuffled control is in the learnability report.")
|
| 348 |
+
if "by_parse" in learning["learning"]:
|
| 349 |
+
groups = learning["learning"]["by_parse"]["base"]["groups"]
|
| 350 |
+
table(["Formatting on the same problem","Problems","Gains","Losses"],
|
| 351 |
+
[[g["stratum"],g["n"],g["gains"],g["losses"]] for g in groups])
|
| 352 |
+
line("A gain when both responses already parse requires a corrected arithmetic trace. A gain in a newly parseable response can combine arithmetic and formatting changes.")
|
| 353 |
primary = data["primary"]
|
| 354 |
if "delta" in primary:
|
| 355 |
line(f"The equally weighted paired difference is {primary['delta']*100:.2f} percentage points. The conditional 95% problem-bootstrap interval is [{primary['ci'][0]*100:.2f}, {primary['ci'][1]*100:.2f}] points. The registered decision is {primary['status']}.")
|
|
|
|
| 462 |
if "delta" in primary:
|
| 463 |
status += f" Difference {100*primary['delta']:.2f} percentage points, conditional 95% interval [{100*primary['ci'][0]:.2f}, {100*primary['ci'][1]:.2f}]."
|
| 464 |
summary = status+"\n\n"+score
|
| 465 |
+
learning = data["learnability"]
|
| 466 |
+
if learning["screen"]:
|
| 467 |
+
chosen = learning["screen"]["selected"]
|
| 468 |
+
if chosen:
|
| 469 |
+
summary += (f"\n\n**Benchmark difficulty.** The frozen-model screen selected {chosen['family']} with {chosen['style']} prompts. "
|
| 470 |
+
f"On {chosen['problems']} screening problems it produced a mix of correct and incorrect answers on "
|
| 471 |
+
f"{chosen['mixed_groups']} problems. [All difficulty levels](reports/learnability.md).")
|
| 472 |
+
else:
|
| 473 |
+
summary += "\n\n**Benchmark difficulty.** No setting passed the registered difficulty screen. [All difficulty levels](reports/learnability.md)."
|
| 474 |
+
if learning["learning"]:
|
| 475 |
+
change=learning["learning"]["over_base"]
|
| 476 |
+
summary += (f"\n\n**Solver learning.** Exact-reward training changed complete-trace accuracy on {change['n']} fresh "
|
| 477 |
+
f"problems by {100*change['delta']:+.1f} percentage points relative to the starting solver "
|
| 478 |
+
f"(paired 95% interval {100*change['interval'][0]:+.1f} to {100*change['interval'][1]:+.1f}). "
|
| 479 |
+
"[Shuffled control and arithmetic corrections](reports/learnability.md).")
|
| 480 |
if data["original_development"]:
|
| 481 |
summary += "\n\nOn the original signed development population, "+", ".join(
|
| 482 |
f"{r['name']} solved {r['correct']}/{r['n']}" for r in data["original_development"])+"."
|
|
|
|
| 490 |
if comparisons:
|
| 491 |
summary += "\n\n" + markdown(["Contrast", "Seed", "Difference (pp)", "95% lower", "95% upper"], comparisons)
|
| 492 |
explanation = "Solver scores require every intermediate value. Judge scores require all fields of the evidence record. Intervals condition on the trained checkpoints."
|
| 493 |
+
atomic(REPORTS/"summary.md","# Study summary\n\n"+summary.replace("(reports/learnability.md)","(learnability.md)")+"\n\n"+explanation+" [Preregistration](preregistration.md).\n")
|
| 494 |
readme = (ROOT/"README.md").read_text(encoding="utf-8")
|
| 495 |
pre, tail = readme.split("<!-- RESULTS:START -->",1)
|
| 496 |
_, post = tail.split("<!-- RESULTS:END -->",1)
|
tests/test_learnability.py
CHANGED
|
@@ -54,6 +54,49 @@ def test_learning_requires_paired_improvement_on_new_problems():
|
|
| 54 |
assert learning_result(baseline,dict(list(perfect.items())[:-1]),baseline)["status"]=="pending"
|
| 55 |
|
| 56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
def test_frozen_screen_confirmation_and_resume_with_an_artificial_backend(tmp_path,monkeypatch):
|
| 58 |
import pytest
|
| 59 |
learner=pytest.importorskip("study.learnability")
|
|
|
|
| 54 |
assert learning_result(baseline,dict(list(perfect.items())[:-1]),baseline)["status"]=="pending"
|
| 55 |
|
| 56 |
|
| 57 |
+
def test_arithmetic_and_format_transitions_account_for_every_matched_gain():
|
| 58 |
+
from study.learnability_analysis import changes_by_parse
|
| 59 |
+
|
| 60 |
+
def row(parsed, correct):
|
| 61 |
+
return dict(parsed=parsed, correct=correct, expression="2+3", trace="5" if correct else "wrong",
|
| 62 |
+
expected_values=[5])
|
| 63 |
+
before=[row(1,0),row(1,1),row(0,0),row(1,1),row(0,0),row(0,0)]
|
| 64 |
+
after =[row(1,1),row(1,0),row(1,1),row(0,0),row(0,0),row(1,1)]
|
| 65 |
+
result = changes_by_parse(dict(enumerate(after)), dict(enumerate(before)))
|
| 66 |
+
assert [(group["n"], group["gains"], group["losses"]) for group in result["groups"]] == [
|
| 67 |
+
(2,1,1), (2,2,0), (1,0,1), (1,0,0)]
|
| 68 |
+
assert [(e["stratum"], e["change"], e["key"]) for e in result["examples"]] == [
|
| 69 |
+
("Both parsed","gain",0),("Both parsed","loss",1),("Only trained parsed","gain",2),
|
| 70 |
+
("Only comparator parsed","loss",3)]
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
def test_learnability_report_regenerates_arithmetic_examples_from_validation_files(tmp_path,monkeypatch):
|
| 74 |
+
import pytest
|
| 75 |
+
learner=pytest.importorskip("study.learnability")
|
| 76 |
+
from study.design import PILOTS
|
| 77 |
+
from study.learnability_report import collect_learnability, learnability_text
|
| 78 |
+
from study.storage import append, write_json
|
| 79 |
+
|
| 80 |
+
monkeypatch.setattr(learner,"RESULTS",tmp_path)
|
| 81 |
+
root = tmp_path/"learnability"
|
| 82 |
+
write_json(root/"screen.json", {"cells":[], "selected":{"family":"one","style":"demonstrated"}})
|
| 83 |
+
for name in ("base", *PILOTS):
|
| 84 |
+
hits = 0
|
| 85 |
+
for i in range(256):
|
| 86 |
+
correct = name == PILOTS[0] or i % 4 == 0
|
| 87 |
+
parsed = correct or i % 2 == 0
|
| 88 |
+
hits += correct
|
| 89 |
+
append(root/"evaluations"/(name+".jsonl"),
|
| 90 |
+
dict(key=str(i),correct=int(correct),parsed=parsed,trace="5" if correct else "6" if parsed else "<wrong>",
|
| 91 |
+
expected_values=[5],expression="2+3"))
|
| 92 |
+
write_json(root/"evaluations"/(name+".json"), {"n":256, "parsed":256 if name==PILOTS[0] else 128,"correct":hits})
|
| 93 |
+
outcome=learner.compare()
|
| 94 |
+
assert outcome["reward_specific"] and outcome["over_base"]["fixed"]==192
|
| 95 |
+
assert sum(g["gains"] for g in outcome["by_parse"]["base"]["groups"])==192
|
| 96 |
+
text=learnability_text(collect_learnability(tmp_path))
|
| 97 |
+
assert "Both parsed | 128 | 64 | 0" in text and "<wrong>" in text
|
| 98 |
+
|
| 99 |
+
|
| 100 |
def test_frozen_screen_confirmation_and_resume_with_an_artificial_backend(tmp_path,monkeypatch):
|
| 101 |
import pytest
|
| 102 |
learner=pytest.importorskip("study.learnability")
|