BurnyCoder commited on
Commit
fba5d74
·
verified ·
1 Parent(s): 0aa6bb2

matched-depth-implementation · 72b892124fe4

Browse files
docs/assets/study.json CHANGED
@@ -4,6 +4,7 @@
4
  "name": "base",
5
  "role": "solver",
6
  "reward": "untrained",
 
7
  "diagnostic": false,
8
  "family": "two-add",
9
  "seed": 17,
@@ -326,6 +327,7 @@
326
  "name": "d3-17",
327
  "role": "solver",
328
  "reward": "d3",
 
329
  "diagnostic": false,
330
  "family": "two-add",
331
  "seed": 17,
@@ -9192,6 +9194,7 @@
9192
  "name": "d2-17",
9193
  "role": "solver",
9194
  "reward": "d2",
 
9195
  "diagnostic": false,
9196
  "family": "two-add",
9197
  "seed": 17,
@@ -18051,6 +18054,7 @@
18051
  "name": "d1-17",
18052
  "role": "solver",
18053
  "reward": "d1",
 
18054
  "diagnostic": false,
18055
  "family": "two-add",
18056
  "seed": 17,
@@ -26903,6 +26907,7 @@
26903
  "name": "flat-17",
26904
  "role": "solver",
26905
  "reward": "flat",
 
26906
  "diagnostic": false,
26907
  "family": "two-add",
26908
  "seed": 17,
@@ -35755,6 +35760,7 @@
35755
  "name": "oracle-17",
35756
  "role": "solver",
35757
  "reward": "oracle",
 
35758
  "diagnostic": false,
35759
  "family": "two-add",
35760
  "seed": 17,
@@ -44555,6 +44561,7 @@
44555
  "name": "hybrid-17",
44556
  "role": "solver",
44557
  "reward": "hybrid",
 
44558
  "diagnostic": false,
44559
  "family": "two-add",
44560
  "seed": 17,
@@ -53421,6 +53428,7 @@
53421
  "name": "shuffle-17",
53422
  "role": "solver",
53423
  "reward": "shuffle",
 
53424
  "diagnostic": false,
53425
  "family": "two-add",
53426
  "seed": 17,
@@ -62287,6 +62295,7 @@
62287
  "name": "exact-j1",
62288
  "role": "j1",
62289
  "reward": "exact",
 
62290
  "diagnostic": false,
62291
  "family": "two-add",
62292
  "seed": 17,
@@ -71051,6 +71060,7 @@
71051
  "name": "exact-j2",
71052
  "role": "j2",
71053
  "reward": "exact",
 
71054
  "diagnostic": false,
71055
  "family": "two-add",
71056
  "seed": 17,
@@ -79801,6 +79811,7 @@
79801
  "name": "exact-j3",
79802
  "role": "j3",
79803
  "reward": "exact",
 
79804
  "diagnostic": false,
79805
  "family": "two-add",
79806
  "seed": 17,
@@ -88591,6 +88602,7 @@
88591
  "name": "top-j2",
88592
  "role": "j2",
88593
  "reward": "teacher",
 
88594
  "diagnostic": false,
88595
  "family": "two-add",
88596
  "seed": 17,
@@ -97348,6 +97360,7 @@
97348
  "name": "top-j1",
97349
  "role": "j1",
97350
  "reward": "teacher",
 
97351
  "diagnostic": false,
97352
  "family": "two-add",
97353
  "seed": 17,
@@ -106105,6 +106118,7 @@
106105
  "name": "exact-prefix1",
106106
  "role": "solver",
106107
  "reward": "d3",
 
106108
  "diagnostic": false,
106109
  "family": "two-add",
106110
  "seed": 17,
@@ -114971,6 +114985,7 @@
114971
  "name": "exact-prefix2",
114972
  "role": "solver",
114973
  "reward": "d3",
 
114974
  "diagnostic": false,
114975
  "family": "two-add",
114976
  "seed": 17,
@@ -123837,6 +123852,7 @@
123837
  "name": "exact-prefix3",
123838
  "role": "solver",
123839
  "reward": "d3",
 
123840
  "diagnostic": false,
123841
  "family": "two-add",
123842
  "seed": 17,
@@ -132703,6 +132719,7 @@
132703
  "name": "top-prefix1",
132704
  "role": "solver",
132705
  "reward": "d3",
 
132706
  "diagnostic": false,
132707
  "family": "two-add",
132708
  "seed": 17,
@@ -141569,6 +141586,7 @@
141569
  "name": "top-prefix2",
141570
  "role": "solver",
141571
  "reward": "d3",
 
141572
  "diagnostic": false,
141573
  "family": "two-add",
141574
  "seed": 17,
@@ -150435,6 +150453,7 @@
150435
  "name": "top-prefix3",
150436
  "role": "solver",
150437
  "reward": "d3",
 
150438
  "diagnostic": false,
150439
  "family": "two-add",
150440
  "seed": 17,
@@ -159301,6 +159320,7 @@
159301
  "name": "alt-exact-j1",
159302
  "role": "j1",
159303
  "reward": "exact",
 
159304
  "diagnostic": false,
159305
  "family": "two-add",
159306
  "seed": 17,
@@ -168065,6 +168085,7 @@
168065
  "name": "alt-exact-j2",
168066
  "role": "j2",
168067
  "reward": "exact",
 
168068
  "diagnostic": false,
168069
  "family": "two-add",
168070
  "seed": 17,
@@ -176815,6 +176836,7 @@
176815
  "name": "alt-exact-j3",
176816
  "role": "j3",
176817
  "reward": "exact",
 
176818
  "diagnostic": false,
176819
  "family": "two-add",
176820
  "seed": 17,
@@ -185605,6 +185627,7 @@
185605
  "name": "alt-exact-solver",
185606
  "role": "solver",
185607
  "reward": "d3",
 
185608
  "diagnostic": false,
185609
  "family": "two-add",
185610
  "seed": 17,
@@ -194471,6 +194494,7 @@
194471
  "name": "learn-oracle-17",
194472
  "role": "solver",
194473
  "reward": "oracle",
 
194474
  "diagnostic": true,
194475
  "family": "two-add",
194476
  "seed": 17,
@@ -198931,6 +198955,7 @@
198931
  "name": "learn-shuffle-17",
198932
  "role": "solver",
198933
  "reward": "oracle-shuffle",
 
198934
  "diagnostic": true,
198935
  "family": "two-add",
198936
  "seed": 17,
 
4
  "name": "base",
5
  "role": "solver",
6
  "reward": "untrained",
7
+ "supplemental": false,
8
  "diagnostic": false,
9
  "family": "two-add",
10
  "seed": 17,
 
327
  "name": "d3-17",
328
  "role": "solver",
329
  "reward": "d3",
330
+ "supplemental": false,
331
  "diagnostic": false,
332
  "family": "two-add",
333
  "seed": 17,
 
9194
  "name": "d2-17",
9195
  "role": "solver",
9196
  "reward": "d2",
9197
+ "supplemental": false,
9198
  "diagnostic": false,
9199
  "family": "two-add",
9200
  "seed": 17,
 
18054
  "name": "d1-17",
18055
  "role": "solver",
18056
  "reward": "d1",
18057
+ "supplemental": false,
18058
  "diagnostic": false,
18059
  "family": "two-add",
18060
  "seed": 17,
 
26907
  "name": "flat-17",
26908
  "role": "solver",
26909
  "reward": "flat",
26910
+ "supplemental": false,
26911
  "diagnostic": false,
26912
  "family": "two-add",
26913
  "seed": 17,
 
35760
  "name": "oracle-17",
35761
  "role": "solver",
35762
  "reward": "oracle",
35763
+ "supplemental": false,
35764
  "diagnostic": false,
35765
  "family": "two-add",
35766
  "seed": 17,
 
44561
  "name": "hybrid-17",
44562
  "role": "solver",
44563
  "reward": "hybrid",
44564
+ "supplemental": false,
44565
  "diagnostic": false,
44566
  "family": "two-add",
44567
  "seed": 17,
 
53428
  "name": "shuffle-17",
53429
  "role": "solver",
53430
  "reward": "shuffle",
53431
+ "supplemental": false,
53432
  "diagnostic": false,
53433
  "family": "two-add",
53434
  "seed": 17,
 
62295
  "name": "exact-j1",
62296
  "role": "j1",
62297
  "reward": "exact",
62298
+ "supplemental": false,
62299
  "diagnostic": false,
62300
  "family": "two-add",
62301
  "seed": 17,
 
71060
  "name": "exact-j2",
71061
  "role": "j2",
71062
  "reward": "exact",
71063
+ "supplemental": false,
71064
  "diagnostic": false,
71065
  "family": "two-add",
71066
  "seed": 17,
 
79811
  "name": "exact-j3",
79812
  "role": "j3",
79813
  "reward": "exact",
79814
+ "supplemental": false,
79815
  "diagnostic": false,
79816
  "family": "two-add",
79817
  "seed": 17,
 
88602
  "name": "top-j2",
88603
  "role": "j2",
88604
  "reward": "teacher",
88605
+ "supplemental": false,
88606
  "diagnostic": false,
88607
  "family": "two-add",
88608
  "seed": 17,
 
97360
  "name": "top-j1",
97361
  "role": "j1",
97362
  "reward": "teacher",
97363
+ "supplemental": false,
97364
  "diagnostic": false,
97365
  "family": "two-add",
97366
  "seed": 17,
 
106118
  "name": "exact-prefix1",
106119
  "role": "solver",
106120
  "reward": "d3",
106121
+ "supplemental": false,
106122
  "diagnostic": false,
106123
  "family": "two-add",
106124
  "seed": 17,
 
114985
  "name": "exact-prefix2",
114986
  "role": "solver",
114987
  "reward": "d3",
114988
+ "supplemental": false,
114989
  "diagnostic": false,
114990
  "family": "two-add",
114991
  "seed": 17,
 
123852
  "name": "exact-prefix3",
123853
  "role": "solver",
123854
  "reward": "d3",
123855
+ "supplemental": false,
123856
  "diagnostic": false,
123857
  "family": "two-add",
123858
  "seed": 17,
 
132719
  "name": "top-prefix1",
132720
  "role": "solver",
132721
  "reward": "d3",
132722
+ "supplemental": false,
132723
  "diagnostic": false,
132724
  "family": "two-add",
132725
  "seed": 17,
 
141586
  "name": "top-prefix2",
141587
  "role": "solver",
141588
  "reward": "d3",
141589
+ "supplemental": false,
141590
  "diagnostic": false,
141591
  "family": "two-add",
141592
  "seed": 17,
 
150453
  "name": "top-prefix3",
150454
  "role": "solver",
150455
  "reward": "d3",
150456
+ "supplemental": false,
150457
  "diagnostic": false,
150458
  "family": "two-add",
150459
  "seed": 17,
 
159320
  "name": "alt-exact-j1",
159321
  "role": "j1",
159322
  "reward": "exact",
159323
+ "supplemental": false,
159324
  "diagnostic": false,
159325
  "family": "two-add",
159326
  "seed": 17,
 
168085
  "name": "alt-exact-j2",
168086
  "role": "j2",
168087
  "reward": "exact",
168088
+ "supplemental": false,
168089
  "diagnostic": false,
168090
  "family": "two-add",
168091
  "seed": 17,
 
176836
  "name": "alt-exact-j3",
176837
  "role": "j3",
176838
  "reward": "exact",
176839
+ "supplemental": false,
176840
  "diagnostic": false,
176841
  "family": "two-add",
176842
  "seed": 17,
 
185627
  "name": "alt-exact-solver",
185628
  "role": "solver",
185629
  "reward": "d3",
185630
+ "supplemental": false,
185631
  "diagnostic": false,
185632
  "family": "two-add",
185633
  "seed": 17,
 
194494
  "name": "learn-oracle-17",
194495
  "role": "solver",
194496
  "reward": "oracle",
194497
+ "supplemental": false,
194498
  "diagnostic": true,
194499
  "family": "two-add",
194500
  "seed": 17,
 
198955
  "name": "learn-shuffle-17",
198956
  "role": "solver",
198957
  "reward": "oracle-shuffle",
198958
+ "supplemental": false,
198959
  "diagnostic": true,
198960
  "family": "two-add",
198961
  "seed": 17,
docs/explorer.js CHANGED
@@ -118,7 +118,7 @@ async function update() {
118
  study = await response.json();
119
  const p=study.primary;
120
  byId("primary").textContent=p.delta == null ? "Awaiting matched final checkpoints for all registered seeds." : "Three judges minus two: "+(p.delta*100).toFixed(2)+" points. 95% interval "+p.ci.map(x=>(100*x).toFixed(2)).join(" to ")+". Decision: "+p.status+".";
121
- byId("progress").textContent=study.runs.filter(r=>r.updates != null && !r.diagnostic).length+" of "+study.planned+" registered training blocks completed. "+(study.sealed?"Checkpoint manifest sealed.":"Final test sealed during development.");
122
  if (study.profile?.family) byId("progress").textContent += " Amended benchmark · "+study.profile.family+" arithmetic with "+study.profile.style+" prompts.";
123
  showMatched(study.matched_depth ?? []);
124
  const cal=study.learnability;
 
118
  study = await response.json();
119
  const p=study.primary;
120
  byId("primary").textContent=p.delta == null ? "Awaiting matched final checkpoints for all registered seeds." : "Three judges minus two: "+(p.delta*100).toFixed(2)+" points. 95% interval "+p.ci.map(x=>(100*x).toFixed(2)).join(" to ")+". Decision: "+p.status+".";
121
+ byId("progress").textContent=study.runs.filter(r=>r.updates != null && !r.diagnostic && !r.supplemental).length+" of "+study.planned+" registered training blocks completed. "+(study.sealed?"Checkpoint manifest sealed.":"Final test sealed during development.");
122
  if (study.profile?.family) byId("progress").textContent += " Amended benchmark · "+study.profile.family+" arithmetic with "+study.profile.style+" prompts.";
123
  showMatched(study.matched_depth ?? []);
124
  const cal=study.learnability;
docs/usage.md CHANGED
@@ -12,6 +12,8 @@ The README’s depth diagnosis regrades training and development records each ti
12
 
13
  After the final campaign completion receipt exists, the same report command regenerates `reports/reviews/final.md`. It re-executes every primary and transfer solution, checks natural and evidence-altered reviews, tests the observed training and development IDs against the reserved populations, verifies the seal, and tabulates matched gains and losses for each depth comparison. [Final review implementation](../src/study/final_review.py)
14
 
 
 
15
  Model inputs, token chunks and full outputs are printed and saved in timestamped JSONL under `logs`. Raw training and evaluation records live in `results`. Each row includes an expression identity. Training outputs include their assigned reward and independently computed complete-record label. Natural replay keeps all three reports and the three flat ballots on the identical solution. Twin interventions keep observed and expected records in both conditions.
16
 
17
  The explorer shows every completed optimizer group for the selected run and the latest greedy development probe. Counts under each replay rule distinguish verdict agreement from whole-record evidence accuracy. Generation cost counts non-padding input and output tokens. CUDA-event durations measure elapsed device time around a batched generation call, including gaps between kernels. The pretrained judges share the pinned Qwen backbone. A frozen-adapter checksum with no input tensors means the run loaded no fitted judge adapters.
 
12
 
13
  After the final campaign completion receipt exists, the same report command regenerates `reports/reviews/final.md`. It re-executes every primary and transfer solution, checks natural and evidence-altered reviews, tests the observed training and development IDs against the reserved populations, verifies the seal, and tabulates matched gains and losses for each depth comparison. [Final review implementation](../src/study/final_review.py)
14
 
15
+ The calibrated campaign automatically runs the four additional matched-depth solvers and two fixed-answer judge-stack replays. In a calibrated environment, individual examples of the same entry points are `uv run study train --run exact-depth2` and `uv run study stack-replay --route exact`. The held-out extension requires both the original and additional checkpoint seals. [Matched-depth protocol](../reports/matched-depth-protocol.md)
16
+
17
  Model inputs, token chunks and full outputs are printed and saved in timestamped JSONL under `logs`. Raw training and evaluation records live in `results`. Each row includes an expression identity. Training outputs include their assigned reward and independently computed complete-record label. Natural replay keeps all three reports and the three flat ballots on the identical solution. Twin interventions keep observed and expected records in both conditions.
18
 
19
  The explorer shows every completed optimizer group for the selected run and the latest greedy development probe. Counts under each replay rule distinguish verdict agreement from whole-record evidence accuracy. Generation cost counts non-padding input and output tokens. CUDA-event durations measure elapsed device time around a batched generation call, including gaps between kernels. The pretrained judges share the pinned Qwen backbone. A frozen-adapter checksum with no input tensors means the run loaded no fitted judge adapters.
src/study/cli.py CHANGED
@@ -10,7 +10,8 @@ import time
10
  from functools import partial
11
  from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer
12
 
13
- from .design import PILOTS, Run, matrix
 
14
  from .storage import ORIGINAL_RESULTS, RESULTS, ROOT, STATE, TRACK, read_json, stamp, write_json
15
 
16
 
@@ -20,7 +21,10 @@ def run_spec(name):
20
  if name in PILOTS:
21
  from .learnability import pilot_spec
22
  return pilot_spec(name)
23
- return next(row for row in matrix() if row.name == name)
 
 
 
24
 
25
 
26
  def worker(*args):
@@ -77,6 +81,16 @@ def campaign(public, registered_only=False):
77
  worker("report")
78
  write_json(STATE/"local-milestones"/(milestone+".json"), {"time":stamp()})
79
 
 
 
 
 
 
 
 
 
 
 
80
  with study_lock("campaign"):
81
  if public:
82
  if not (STATE/"publication/protocol.json").exists():
@@ -99,13 +113,23 @@ def campaign(public, registered_only=False):
99
  for run in matrix():
100
  stage("train",run.name,"trained")
101
  stage("evaluate",run.name,"development")
102
- if not (RESULTS/"seal.json").exists():
 
 
 
 
 
 
103
  worker("seal")
104
  if public:
105
  worker("publish","--milestone","sealed-checkpoints")
106
  for name in ("base", *(r.name for r in matrix())):
107
  stage("evaluate",name,"final")
108
- write_json(RESULTS/"completed.json",{"time":stamp(),"arms":len(matrix())})
 
 
 
 
109
  if public:
110
  worker("publish","--milestone","complete")
111
  else:
@@ -165,7 +189,7 @@ def main():
165
  schedule.add_argument("--publish",action="store_true")
166
  schedule.add_argument("--registered-only", action="store_true",
167
  help="Reproduce the original signed-arithmetic matrix independently")
168
- names=[r.name for r in matrix({})]
169
  actions.add_parser("train").add_argument("--run",required=True,choices=["timing",*PILOTS,*names])
170
  calibration=actions.add_parser("learnability",description="Calibrate arithmetic and test actual solver improvement")
171
  calibration.add_argument("phase",choices=["screen","confirm","audit","evaluate","compare","campaign"])
@@ -174,6 +198,9 @@ def main():
174
  evaluate=actions.add_parser("evaluate")
175
  evaluate.add_argument("--run",required=True,choices=["base",*names])
176
  evaluate.add_argument("--final",action="store_true")
 
 
 
177
  actions.add_parser("seal")
178
  actions.add_parser("report")
179
  actions.add_parser("dashboard").add_argument("--port",default=8765,type=int)
@@ -214,6 +241,10 @@ def main():
214
  from .evaluate import evaluate
215
  with study_lock("evaluate-"+args.run+("-final" if args.final else "-dev")):
216
  evaluate(args.run,args.final)
 
 
 
 
217
  elif args.action == "seal":
218
  from .evaluate import seal
219
  seal()
 
10
  from functools import partial
11
  from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer
12
 
13
+ from .benchmark import active_profile
14
+ from .design import MATCHED_NAMES, PILOTS, ROUTES, Run, matched_runs, matrix
15
  from .storage import ORIGINAL_RESULTS, RESULTS, ROOT, STATE, TRACK, read_json, stamp, write_json
16
 
17
 
 
21
  if name in PILOTS:
22
  from .learnability import pilot_spec
23
  return pilot_spec(name)
24
+ if name in MATCHED_NAMES and TRACK!="calibrated":
25
+ raise ValueError("The matched-depth solver runs require STUDY_TRACK=calibrated")
26
+ profile=active_profile()
27
+ return next(row for row in [*matrix(profile),*matched_runs(profile)] if row.name==name)
28
 
29
 
30
  def worker(*args):
 
81
  worker("report")
82
  write_json(STATE/"local-milestones"/(milestone+".json"), {"time":stamp()})
83
 
84
+ def fitted_replays(phase):
85
+ for route in ROUTES:
86
+ milestone=f"stack-{route}-{phase}"
87
+ if not (RESULTS/"matched-depth"/f"{route}-{phase}.json").exists():
88
+ worker("stack-replay","--route",route,*(("--final",) if phase=="final" else ()))
89
+ if public and not (STATE/"publication"/(milestone+".json")).exists():
90
+ worker("publish","--milestone",milestone)
91
+ elif not public:
92
+ worker("report")
93
+
94
  with study_lock("campaign"):
95
  if public:
96
  if not (STATE/"publication/protocol.json").exists():
 
113
  for run in matrix():
114
  stage("train",run.name,"trained")
115
  stage("evaluate",run.name,"development")
116
+ if TRACK=="calibrated" and run.name=="alt-top-j3":
117
+ # The supplemental arms reuse trained judges and the unchanged original solver schedule.
118
+ fitted_replays("development")
119
+ for extra in matched_runs(active_profile()):
120
+ stage("train",extra.name,"trained")
121
+ stage("evaluate",extra.name,"development")
122
+ if not (RESULTS/"seal.json").exists() or (TRACK=="calibrated" and not (RESULTS/"matched-depth/seal.json").exists()):
123
  worker("seal")
124
  if public:
125
  worker("publish","--milestone","sealed-checkpoints")
126
  for name in ("base", *(r.name for r in matrix())):
127
  stage("evaluate",name,"final")
128
+ if TRACK=="calibrated":
129
+ fitted_replays("final")
130
+ for extra in matched_runs(active_profile()):
131
+ stage("evaluate",extra.name,"final")
132
+ write_json(RESULTS/"completed.json",{"time":stamp(),"arms":len(matrix()),"matched_depth_arms":len(matched_runs(active_profile()))})
133
  if public:
134
  worker("publish","--milestone","complete")
135
  else:
 
189
  schedule.add_argument("--publish",action="store_true")
190
  schedule.add_argument("--registered-only", action="store_true",
191
  help="Reproduce the original signed-arithmetic matrix independently")
192
+ names=[*(r.name for r in matrix({})),*MATCHED_NAMES]
193
  actions.add_parser("train").add_argument("--run",required=True,choices=["timing",*PILOTS,*names])
194
  calibration=actions.add_parser("learnability",description="Calibrate arithmetic and test actual solver improvement")
195
  calibration.add_argument("phase",choices=["screen","confirm","audit","evaluate","compare","campaign"])
 
198
  evaluate=actions.add_parser("evaluate")
199
  evaluate.add_argument("--run",required=True,choices=["base",*names])
200
  evaluate.add_argument("--final",action="store_true")
201
+ stacks=actions.add_parser("stack-replay",description="Measure each fitted judge depth on fixed base-solver answers")
202
+ stacks.add_argument("--route",choices=ROUTES,required=True)
203
+ stacks.add_argument("--final",action="store_true")
204
  actions.add_parser("seal")
205
  actions.add_parser("report")
206
  actions.add_parser("dashboard").add_argument("--port",default=8765,type=int)
 
241
  from .evaluate import evaluate
242
  with study_lock("evaluate-"+args.run+("-final" if args.final else "-dev")):
243
  evaluate(args.run,args.final)
244
+ elif args.action=="stack-replay":
245
+ from .evaluate import stack_replay
246
+ with study_lock(f"stack-{args.route}-{'final' if args.final else 'development'}"):
247
+ stack_replay(args.route,args.final)
248
  elif args.action == "seal":
249
  from .evaluate import seal
250
  seal()
src/study/design.py CHANGED
@@ -4,6 +4,8 @@ from dataclasses import dataclass, replace
4
 
5
  SEEDS = (17, 29, 43)
6
  PILOTS = ("learn-oracle-17","learn-shuffle-17")
 
 
7
  BASE = "Qwen/Qwen2.5-1.5B-Instruct"
8
  REVISION = "989aa7980e4cf806f80c7fef2b1adb7bc71aa306"
9
  PROJECT = "verifying-verifier-of-verifier-llm-reinforcement-learning"
@@ -35,8 +37,7 @@ def matrix(profile=None):
35
  from .benchmark import active_profile
36
  profile = active_profile()
37
  rows = [Run(f"{arm}-17", reward=arm) for arm in ("d3", "d2", "d1", "flat", "oracle", "hybrid", "shuffle")]
38
- direct = tuple(f"exact-j{i}" for i in (1, 2, 3))
39
- top = ("top-j1", "top-j2", direct[2])
40
  rows.extend(Run(name, role=f"j{i}", reward="exact") for i, name in enumerate(direct, 1))
41
  rows.extend((Run(top[1], role="j2", reward="teacher", teacher=direct[2]),
42
  Run(top[0], role="j1", reward="teacher", teacher=top[1])))
@@ -59,6 +60,15 @@ def matrix(profile=None):
59
  return rows
60
 
61
 
 
 
 
 
 
 
 
 
 
62
  def permute_groups(values, rng):
63
  if len(values) % 4:
64
  raise ValueError("A shuffled GRPO reward requires complete groups of four")
 
4
 
5
  SEEDS = (17, 29, 43)
6
  PILOTS = ("learn-oracle-17","learn-shuffle-17")
7
+ ROUTES = {"exact":("exact-j1","exact-j2","exact-j3"), "top":("top-j1","top-j2","exact-j3")}
8
+ MATCHED_NAMES = tuple(f"{route}-depth{d}" for route in ROUTES for d in (1,2))
9
  BASE = "Qwen/Qwen2.5-1.5B-Instruct"
10
  REVISION = "989aa7980e4cf806f80c7fef2b1adb7bc71aa306"
11
  PROJECT = "verifying-verifier-of-verifier-llm-reinforcement-learning"
 
37
  from .benchmark import active_profile
38
  profile = active_profile()
39
  rows = [Run(f"{arm}-17", reward=arm) for arm in ("d3", "d2", "d1", "flat", "oracle", "hybrid", "shuffle")]
40
+ direct, top = ROUTES["exact"], ROUTES["top"]
 
41
  rows.extend(Run(name, role=f"j{i}", reward="exact") for i, name in enumerate(direct, 1))
42
  rows.extend((Run(top[1], role="j2", reward="teacher", teacher=direct[2]),
43
  Run(top[0], role="j1", reward="teacher", teacher=top[1])))
 
60
  return rows
61
 
62
 
63
+ def matched_runs(profile):
64
+ """Clone each fresh deep solver's complete training recipe and vary only the reward depth."""
65
+ if not profile:
66
+ return []
67
+ originals = {r.name:r for r in matrix(profile)}
68
+ return [replace(originals[route+"-prefix3"],name=f"{route}-depth{level}",reward=f"d{level}")
69
+ for route in ROUTES for level in (1,2)]
70
+
71
+
72
  def permute_groups(values, rng):
73
  if len(values) % 4:
74
  raise ValueError("A shuffled GRPO reward requires complete groups of four")
src/study/evaluate.py CHANGED
@@ -4,7 +4,7 @@ import hashlib
4
 
5
  from .backend import Backend, stream_seed
6
  from .benchmark import active_profile, population
7
- from .design import matrix
8
  from .domain import problems
9
  from .exposures import check_exposures
10
  from .judging import chain, majority, twin, votes
@@ -36,6 +36,20 @@ def seal():
36
  if not previous:
37
  exposures = check_exposures(RESULTS, matrix())
38
  write_json(path, {"time": stamp(), "weights": manifest, "ordered_training_exposures": exposures})
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
 
40
 
41
  def batches(split, n, path, size=8, population=None):
@@ -48,7 +62,7 @@ def batches(split, n, path, size=8, population=None):
48
  yield pos, batch, seen
49
 
50
 
51
- def solutions(backend, run, snapshots, split, n, path, replay, stored_traces=None, pool=None):
52
  policy = run.name if run and run.role == "solver" else None
53
  for pos, batch, seen in batches(split, n, path, population=pool):
54
  seed = stream_seed("eval", split, pos)
@@ -57,7 +71,7 @@ def solutions(backend, run, snapshots, split, n, path, replay, stored_traces=Non
57
  else:
58
  traces = backend.generate([backend.prompt("solver", p) for p in batch], policy, "eval_solver", seed, False)
59
  histories = chain(backend, batch, traces, snapshots, 3, seed) if replay else [[] for _ in batch]
60
- ballots = votes(backend, batch, traces, seed, snapshots) if replay else [[] for _ in batch]
61
  for p, t, h, v in zip(batch, traces, histories, ballots, strict=True):
62
  if p.key in seen:
63
  continue
@@ -68,7 +82,7 @@ def solutions(backend, run, snapshots, split, n, path, replay, stored_traces=Non
68
  malformed=numbers is None, split=split, reports=h, votes=v)
69
  if replay:
70
  bits = [terminal(report, i) for i, report in enumerate(h, 1)]
71
- entry.update(verdicts=bits, flat=majority(v), full_report_correct=[
72
  int(sound(report, expected(p, t, h[:i]))) for i, report in enumerate(h)],
73
  judge_malformed=[parse(report, 3 if i == 0 else 6) is None for i, report in enumerate(h)],
74
  fixed=int(bits[1] != oracle[0] and bits[2] == oracle[0]),
@@ -124,7 +138,8 @@ def evaluate(name, final=False):
124
  marker = directory / (phase+".json")
125
  if marker.is_file():
126
  return read_json(marker)
127
- run = next((r for r in matrix() if r.name == name), None)
 
128
  if not run and name != "base":
129
  raise ValueError(f"Unknown evaluation {name}")
130
  snapshots = list(run.judges if run else (None,)*3)
@@ -132,12 +147,16 @@ def evaluate(name, final=False):
132
  snapshots[int(run.role[1:])-1] = run.name
133
  if final:
134
  frozen = read_json(RESULTS / "seal.json")
 
 
135
  used = {s for s in snapshots if s}
136
  if run:
137
  used.add(name)
138
- if not frozen or any(frozen["weights"].get(s) != weights_digest(s) for s in used):
 
 
 
139
  raise RuntimeError("Final evaluation requires every participating checkpoint to match the seal")
140
- profile = active_profile()
141
  backend = Backend(Journal(name+"-"+phase), frozen=[*snapshots, name if run else None])
142
  backend.prompt_style = profile.get("style", "registered")
143
  evidence_sources = {}
@@ -172,3 +191,38 @@ def evaluate(name, final=False):
172
  **generation_cost(name+"-"+phase,backend.totals), "evidence_sources": evidence_sources, "profile": profile}
173
  write_json(marker, result)
174
  return result
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
  from .backend import Backend, stream_seed
6
  from .benchmark import active_profile, population
7
+ from .design import MATCHED_NAMES, ROUTES, matched_runs, matrix
8
  from .domain import problems
9
  from .exposures import check_exposures
10
  from .judging import chain, majority, twin, votes
 
36
  if not previous:
37
  exposures = check_exposures(RESULTS, matrix())
38
  write_json(path, {"time": stamp(), "weights": manifest, "ordered_training_exposures": exposures})
39
+ extra = matched_runs(active_profile())
40
+ if extra:
41
+ weights = {r.name:weights_digest(r.name) for r in extra}
42
+ for r in extra:
43
+ if weights[r.name] != read_json(RESULTS/r.name/"development.json",{}).get("weights"):
44
+ raise RuntimeError(f"Unverified matched-depth checkpoint for {r.name}")
45
+ references = [r for r in matrix() if r.name in ("d1-17","d2-17","d3-17","exact-prefix3","top-prefix3")]
46
+ exposures = check_exposures(RESULTS,[*references,*extra])
47
+ extra_path = RESULTS/"matched-depth/seal.json"
48
+ recorded = read_json(extra_path)
49
+ if recorded and (recorded["weights"]!=weights or recorded["ordered_training_exposures"]!=exposures):
50
+ raise RuntimeError("The matched-depth seal differs from the realized solver checkpoints or inputs")
51
+ if not recorded:
52
+ write_json(extra_path,dict(time=stamp(),weights=weights,ordered_training_exposures=exposures))
53
 
54
 
55
  def batches(split, n, path, size=8, population=None):
 
62
  yield pos, batch, seen
63
 
64
 
65
+ def solutions(backend, run, snapshots, split, n, path, replay, stored_traces=None, pool=None, panel=True):
66
  policy = run.name if run and run.role == "solver" else None
67
  for pos, batch, seen in batches(split, n, path, population=pool):
68
  seed = stream_seed("eval", split, pos)
 
71
  else:
72
  traces = backend.generate([backend.prompt("solver", p) for p in batch], policy, "eval_solver", seed, False)
73
  histories = chain(backend, batch, traces, snapshots, 3, seed) if replay else [[] for _ in batch]
74
+ ballots = votes(backend, batch, traces, seed, snapshots) if replay and panel else [[] for _ in batch]
75
  for p, t, h, v in zip(batch, traces, histories, ballots, strict=True):
76
  if p.key in seen:
77
  continue
 
82
  malformed=numbers is None, split=split, reports=h, votes=v)
83
  if replay:
84
  bits = [terminal(report, i) for i, report in enumerate(h, 1)]
85
+ entry.update(verdicts=bits, flat=majority(v) if panel else None, full_report_correct=[
86
  int(sound(report, expected(p, t, h[:i]))) for i, report in enumerate(h)],
87
  judge_malformed=[parse(report, 3 if i == 0 else 6) is None for i, report in enumerate(h)],
88
  fixed=int(bits[1] != oracle[0] and bits[2] == oracle[0]),
 
138
  marker = directory / (phase+".json")
139
  if marker.is_file():
140
  return read_json(marker)
141
+ profile = active_profile()
142
+ run = next((r for r in [*matrix(profile),*matched_runs(profile)] if r.name == name), None)
143
  if not run and name != "base":
144
  raise ValueError(f"Unknown evaluation {name}")
145
  snapshots = list(run.judges if run else (None,)*3)
 
147
  snapshots[int(run.role[1:])-1] = run.name
148
  if final:
149
  frozen = read_json(RESULTS / "seal.json")
150
+ if profile and not (RESULTS/"matched-depth/seal.json").is_file():
151
+ raise RuntimeError("The calibrated final evaluation also requires the matched-depth seal")
152
  used = {s for s in snapshots if s}
153
  if run:
154
  used.add(name)
155
+ weights = dict((frozen or {}).get("weights",{}))
156
+ if name in MATCHED_NAMES:
157
+ weights.update(read_json(RESULTS/"matched-depth/seal.json",{}).get("weights",{}))
158
+ if not frozen or any(weights.get(s) != weights_digest(s) for s in used):
159
  raise RuntimeError("Final evaluation requires every participating checkpoint to match the seal")
 
160
  backend = Backend(Journal(name+"-"+phase), frozen=[*snapshots, name if run else None])
161
  backend.prompt_style = profile.get("style", "registered")
162
  evidence_sources = {}
 
191
  **generation_cost(name+"-"+phase,backend.totals), "evidence_sources": evidence_sources, "profile": profile}
192
  write_json(marker, result)
193
  return result
194
+
195
+
196
+ def stack_replay(route,final=False):
197
+ """Score all prefixes of the fitted stack on the literal responses archived for the starting solver."""
198
+ profile = active_profile()
199
+ if not profile:
200
+ raise ValueError("The matched-depth extension uses the calibrated benchmark")
201
+ phase = "final" if final else "development"
202
+ split = "test" if final else "dev"
203
+ count = 128 if final else 32
204
+ target = RESULTS/"matched-depth"/f"{route}-{phase}"
205
+ if target.with_suffix(".json").exists():
206
+ return
207
+ if not (RESULTS/"base"/(phase+".json")).is_file():
208
+ raise RuntimeError("Wait for the base evaluation receipt")
209
+ pool = population(profile,split,count)
210
+ source = RESULTS/"base"/("judge-test.jsonl" if final else "replay.jsonl")
211
+ saved = list(rows(source))
212
+ if [(r["key"],r["expression"]) for r in saved] != [(p.key,p.expression) for p in pool]:
213
+ raise ValueError("The fitted stack requires the complete saved base-solver answers in registered order")
214
+ snapshots = ROUTES[route]
215
+ weights = {name:weights_digest(name) for name in snapshots}
216
+ if final:
217
+ sealed = read_json(RESULTS/"seal.json",{}).get("weights",{})
218
+ if not (RESULTS/"matched-depth/seal.json").exists() or any(sealed.get(k)!=v for k,v in weights.items()):
219
+ raise RuntimeError("Fitted-stack final evaluation requires both recorded seals")
220
+ name = f"stack-{route}-{phase}"
221
+ backend = Backend(Journal(name),frozen=snapshots)
222
+ backend.prompt_style = profile["style"]
223
+ traces = {r["key"]:r["trace"] for r in saved}
224
+ solutions(backend,None,snapshots,split,count,target.with_suffix(".jsonl"),True,traces,pool,panel=False)
225
+ from .matched_tables import read_cohort
226
+ scored = read_cohort(target.with_suffix(".jsonl"),saved,judge=True)
227
+ write_json(target.with_suffix(".json"),dict(time=stamp(),phase=phase,weights=weights,source=source.name,n=len(scored),
228
+ **generation_cost(name,backend.totals)))
src/study/final_review.py CHANGED
@@ -6,7 +6,7 @@ from math import isclose
6
  from .benchmark import population
7
  from .curriculum import EXAMPLES
8
  from .depth_review import numbers
9
- from .design import SEEDS, matrix
10
  from .domain import Problem, problems
11
  from .exposures import check_exposures
12
  from .learning_review import execute_steps
@@ -31,7 +31,7 @@ def cohort_rows(path, pool, split):
31
  raise ValueError(f"Incomplete cohort in {path}")
32
 
33
 
34
- def grade_solutions(path, pool, split, fixed_traces=None):
35
  """Execute the recorded steps and separately check the submitted trace, last value and format."""
36
  outcomes = {}
37
  for p,r in cohort_rows(path,pool,split):
@@ -46,9 +46,9 @@ def grade_solutions(path, pool, split, fixed_traces=None):
46
  reports = r["reports"]
47
  bits = [terminal(report,i) for i,report in enumerate(reports,1)]
48
  sound = [numbers(raw,3 if i==0 else 6) == expected(p,r["trace"],reports[:i]) for i,raw in enumerate(reports)]
49
- flat = sum(terminal(v,1) for v in r["votes"]) >= 2
50
  correct = outcomes[p.key]
51
- if (r["trace"] != fixed_traces[p.key] or len(bits) != 3 or len(r["votes"]) != 3 or
52
  bits != r["verdicts"] or sound != r["full_report_correct"] or flat != r["flat"] or
53
  (r["fixed"],r["harmed"]) != (bits[1]!=correct and bits[2]==correct, bits[1]==correct and bits[2]!=correct)):
54
  raise ValueError(f"Natural review mismatch in {path} at {p.key}")
@@ -92,6 +92,13 @@ def review_completed(original, data):
92
  if (set(seal["weights"]) != {r.name for r in schedule} or
93
  seal["ordered_training_exposures"] != check_exposures(root,schedule)):
94
  raise ValueError("The training exposures or checkpoint manifest differ from the published seal")
 
 
 
 
 
 
 
95
  suites = dict(test=2048,layout=128,long=128,mechanism=128)
96
  if profile and profile["family"] != "registered":
97
  suites["original-difficulty"] = 2048
@@ -108,16 +115,17 @@ def review_completed(original, data):
108
  if leakage:
109
  raise ValueError(f"Found {leakage} final IDs among previously observed study examples")
110
 
111
- sealed_at = datetime.fromisoformat(seal["time"])
112
  outcomes, origins = {}, {}
113
  graded = natural = twins = 0
114
  unique_twins = {}
115
- names = {"base":"solver",**{r.name:r.role for r in schedule}}
116
  prefix = dict(list(pools["test"].items())[:128])
117
  for name,role in names.items():
118
  directory = root/name
119
  dev, final = [read_json(directory/(phase+".json")) for phase in ("development","final")]
120
- weights = seal["weights"].get(name,"frozen base")
 
 
121
  if (dev["weights"] != weights or final["weights"] != weights or
122
  not datetime.fromisoformat(dev["time"]) <= sealed_at <= datetime.fromisoformat(final["time"])):
123
  raise ValueError(f"Evaluation receipt does not match the checkpoint seal for {name}")
@@ -145,6 +153,12 @@ def review_completed(original, data):
145
  twins += count
146
  unique_twins[source,filename] = count
147
 
 
 
 
 
 
 
148
  comparisons = []
149
  for reference in ("d2","flat","d1"):
150
  seeds = SEEDS[:1] if reference=="d1" else SEEDS
@@ -158,7 +172,7 @@ def review_completed(original, data):
158
  if not isclose(change,published,abs_tol=1e-12):
159
  raise ValueError("Paired published effect differs from independently rescored solutions")
160
  comparisons.append([seed,reference.upper(),len(a),gains,losses,f"{100*change:+.2f}"])
161
- return dict(checkpoints=len(schedule),prior_ids=len(old),test_ids=len(all_test),overlap=leakage,solver_grades=graded,
162
  natural_reviews=natural,paired_records=twins,distinct_paired_records=sum(unique_twins.values()),
163
  comparisons=comparisons)
164
 
 
6
  from .benchmark import population
7
  from .curriculum import EXAMPLES
8
  from .depth_review import numbers
9
+ from .design import ROUTES, SEEDS, matched_runs, matrix
10
  from .domain import Problem, problems
11
  from .exposures import check_exposures
12
  from .learning_review import execute_steps
 
31
  raise ValueError(f"Incomplete cohort in {path}")
32
 
33
 
34
+ def grade_solutions(path, pool, split, fixed_traces=None, panel=True):
35
  """Execute the recorded steps and separately check the submitted trace, last value and format."""
36
  outcomes = {}
37
  for p,r in cohort_rows(path,pool,split):
 
46
  reports = r["reports"]
47
  bits = [terminal(report,i) for i,report in enumerate(reports,1)]
48
  sound = [numbers(raw,3 if i==0 else 6) == expected(p,r["trace"],reports[:i]) for i,raw in enumerate(reports)]
49
+ flat = sum(terminal(v,1) for v in r["votes"]) >= 2 if panel else None
50
  correct = outcomes[p.key]
51
+ if (r["trace"] != fixed_traces[p.key] or len(bits) != 3 or len(r["votes"]) != (3 if panel else 0) or
52
  bits != r["verdicts"] or sound != r["full_report_correct"] or flat != r["flat"] or
53
  (r["fixed"],r["harmed"]) != (bits[1]!=correct and bits[2]==correct, bits[1]==correct and bits[2]!=correct)):
54
  raise ValueError(f"Natural review mismatch in {path} at {p.key}")
 
92
  if (set(seal["weights"]) != {r.name for r in schedule} or
93
  seal["ordered_training_exposures"] != check_exposures(root,schedule)):
94
  raise ValueError("The training exposures or checkpoint manifest differ from the published seal")
95
+ extra=matched_runs(profile)
96
+ supplemental_seal = read_json(root/"matched-depth/seal.json",{})
97
+ if extra:
98
+ references=[r for r in schedule if r.name in ("d1-17","d2-17","d3-17","exact-prefix3","top-prefix3")]
99
+ if (set(supplemental_seal.get("weights",{}))!={r.name for r in extra} or
100
+ supplemental_seal.get("ordered_training_exposures")!=check_exposures(root,[*references,*extra])):
101
+ raise ValueError("Unmatched input exposure or checkpoint manifest in the depth extension")
102
  suites = dict(test=2048,layout=128,long=128,mechanism=128)
103
  if profile and profile["family"] != "registered":
104
  suites["original-difficulty"] = 2048
 
115
  if leakage:
116
  raise ValueError(f"Found {leakage} final IDs among previously observed study examples")
117
 
 
118
  outcomes, origins = {}, {}
119
  graded = natural = twins = 0
120
  unique_twins = {}
121
+ names = {"base":"solver",**{r.name:r.role for r in [*schedule,*extra]}}
122
  prefix = dict(list(pools["test"].items())[:128])
123
  for name,role in names.items():
124
  directory = root/name
125
  dev, final = [read_json(directory/(phase+".json")) for phase in ("development","final")]
126
+ manifest = supplemental_seal if name in supplemental_seal.get("weights",{}) else seal
127
+ sealed_at = datetime.fromisoformat(manifest["time"])
128
+ weights = manifest["weights"].get(name,"frozen base")
129
  if (dev["weights"] != weights or final["weights"] != weights or
130
  not datetime.fromisoformat(dev["time"]) <= sealed_at <= datetime.fromisoformat(final["time"])):
131
  raise ValueError(f"Evaluation receipt does not match the checkpoint seal for {name}")
 
153
  twins += count
154
  unique_twins[source,filename] = count
155
 
156
+ for route in ROUTES if extra else ():
157
+ fixed = root/"matched-depth"/f"{route}-final"
158
+ marker=read_json(fixed.with_suffix(".json"))
159
+ if marker["weights"]!={j:seal["weights"][j] for j in ROUTES[route]}:
160
+ raise ValueError(f"Fixed-solver judge stack differs from its seal for {route}")
161
+ natural += len(grade_solutions(fixed.with_suffix(".jsonl"),prefix,"test",origins["base"],panel=False))
162
  comparisons = []
163
  for reference in ("d2","flat","d1"):
164
  seeds = SEEDS[:1] if reference=="d1" else SEEDS
 
172
  if not isclose(change,published,abs_tol=1e-12):
173
  raise ValueError("Paired published effect differs from independently rescored solutions")
174
  comparisons.append([seed,reference.upper(),len(a),gains,losses,f"{100*change:+.2f}"])
175
+ return dict(checkpoints=len(schedule)+len(extra),prior_ids=len(old),test_ids=len(all_test),overlap=leakage,solver_grades=graded,
176
  natural_reviews=natural,paired_records=twins,distinct_paired_records=sum(unique_twins.values()),
177
  comparisons=comparisons)
178
 
src/study/matched_tables.py CHANGED
@@ -1,11 +1,11 @@
1
  """Compare judge depths only when the arithmetic questions or saved solver answers are identical."""
2
 
3
- from .storage import read_json, rows
 
4
  from .tables import markdown
5
 
6
 
7
  HEADERS = ["Training condition","One judge · J1","Two judges · J2 checks J1","Three judges · J3 checks J2"]
8
- ROUTES = {"exact":("exact-j1","exact-j2","exact-j3"), "top":("top-j1","top-j2","exact-j3")}
9
  PENDING = "Pending"
10
 
11
 
@@ -75,8 +75,9 @@ def accuracy_grid(root,profile):
75
  if replay.with_suffix(".json").is_file():
76
  records = read_cohort(replay.with_suffix(".jsonl"),shared,judge=True)
77
  fitted = [score(records,i) for i in range(3)]
78
- if fitted[0] != isolated[0]:
79
- raise ValueError(f"Identical trained Judge 1 differs across {route} conditions")
 
80
  judge_table.append([label+" · all participating judges trained",*fitted])
81
  grids.append(dict(phase=phase,solver=solver_table,judge=judge_table,solver_n=len(base),judge_n=len(shared),
82
  frozen_solver=cell(sum(r["correct"] for r in base),len(base))))
 
1
  """Compare judge depths only when the arithmetic questions or saved solver answers are identical."""
2
 
3
+ from .design import ROUTES
4
+ from .storage import rows
5
  from .tables import markdown
6
 
7
 
8
  HEADERS = ["Training condition","One judge · J1","Two judges · J2 checks J1","Three judges · J3 checks J2"]
 
9
  PENDING = "Pending"
10
 
11
 
 
75
  if replay.with_suffix(".json").is_file():
76
  records = read_cohort(replay.with_suffix(".jsonl"),shared,judge=True)
77
  fitted = [score(records,i) for i in range(3)]
78
+ first = read_cohort(root/ROUTES[route][0]/judge_file,shared,judge=True)
79
+ if any(a["reports"][0]!=b["reports"][0] for a,b in zip(first,records,strict=True)):
80
+ raise ValueError(f"Identical trained Judge 1 reports differ across {route} conditions")
81
  judge_table.append([label+" · all participating judges trained",*fitted])
82
  grids.append(dict(phase=phase,solver=solver_table,judge=judge_table,solver_n=len(base),judge_n=len(shared),
83
  frozen_solver=cell(sum(r["correct"] for r in base),len(base))))
src/study/report.py CHANGED
@@ -8,7 +8,7 @@ from zoneinfo import ZoneInfo
8
 
9
  from .analysis import evidence_fields, paired_comparison, paired_primary, replay_metrics
10
  from .depth_review import collect_depth_review, readme_depth, review_text as depth_review_text
11
- from .design import GITHUB, PAGES, PILOTS, Run, matrix
12
  from .final_review import review_completed, review_text as final_review_text
13
  from .learnability_report import collect_learnability, learnability_text, learning_figure
14
  from .learning_review import check_release, review_text
@@ -41,6 +41,7 @@ def collect():
41
  source = calibrated if profile else ORIGINAL_RESULTS
42
  manifest = {r.name: r for r in matrix(profile)}
43
  registered=len(manifest)
 
44
  learning=collect_learnability(ORIGINAL_RESULTS)
45
  chosen=(learning["screen"] or {}).get("selected")
46
  if chosen:
@@ -93,7 +94,7 @@ def collect():
93
  matched = e["correct"] if depth == 0 else e["full_report_correct"][depth-1]
94
  common_example = dict(key=e["key"], expression=e["expression"], actual=actual,
95
  expected=render(reference), correct=matched)
96
- runs.append(dict(name=name, role=role, reward=spec.reward if spec else "untrained",
97
  diagnostic=name in PILOTS, family=spec.family if spec else profile.get("family"),
98
  seed=spec.seed if spec else 17, updates=trained.get("updates"), observations=len(training),
99
  initial=spec.initial if spec else None, judges=spec.judges if spec else (None,)*3,
@@ -614,9 +615,14 @@ def build():
614
  methods_table=markdown(["Run","Role","Reward","Seed","Problem source","Dev. parsed","Dev. exact","Held-out exact"],methods)
615
  atomic(experiments/"experiments.md","# Experiment index\n\nAll learned models use grouped reinforcement learning with one active LoRA adapter on the shared, quantized Qwen2.5-1.5B-Instruct backbone. The solver predicts values in signed-integer expression trees. Judges predict exact evidence records about earlier outputs. A parsed output supplies the required number of integers. An exact output also gets every field right.\n\n"+methods_table+"\n\n[Update counts and sample sizes](../summary.md) · [Objectives and curricula](../planned-runs.md) · [Analysis protocol](../preregistration.md)\n\n"+references+"\n")
616
  atomic(experiments/"learnings.md","# Experimental learnings\n\n"+("\n".join(notes) or "No experimental observations yet.")+"\n")
617
- complete=sum(r["completed_final"] for r in data["runs"] if r["name"]!="base")
618
- trained=sum(r["updates"] is not None for r in data["runs"] if not r["diagnostic"])
 
619
  activity = []
 
 
 
 
620
  if data["budget"]:
621
  b = data["budget"]
622
  activity.append(f"The timing pilot selected {b['updates']} updates per block at {b['seconds_per_update']:.1f} seconds per pilot update. A block at that rate would take {b['updates']*b['seconds_per_update']/3600:.2f} hours.")
 
8
 
9
  from .analysis import evidence_fields, paired_comparison, paired_primary, replay_metrics
10
  from .depth_review import collect_depth_review, readme_depth, review_text as depth_review_text
11
+ from .design import GITHUB, MATCHED_NAMES, PAGES, PILOTS, Run, matched_runs, matrix
12
  from .final_review import review_completed, review_text as final_review_text
13
  from .learnability_report import collect_learnability, learnability_text, learning_figure
14
  from .learning_review import check_release, review_text
 
41
  source = calibrated if profile else ORIGINAL_RESULTS
42
  manifest = {r.name: r for r in matrix(profile)}
43
  registered=len(manifest)
44
+ manifest.update((r.name,r) for r in matched_runs(profile))
45
  learning=collect_learnability(ORIGINAL_RESULTS)
46
  chosen=(learning["screen"] or {}).get("selected")
47
  if chosen:
 
94
  matched = e["correct"] if depth == 0 else e["full_report_correct"][depth-1]
95
  common_example = dict(key=e["key"], expression=e["expression"], actual=actual,
96
  expected=render(reference), correct=matched)
97
+ runs.append(dict(name=name, role=role, reward=spec.reward if spec else "untrained", supplemental=name in MATCHED_NAMES,
98
  diagnostic=name in PILOTS, family=spec.family if spec else profile.get("family"),
99
  seed=spec.seed if spec else 17, updates=trained.get("updates"), observations=len(training),
100
  initial=spec.initial if spec else None, judges=spec.judges if spec else (None,)*3,
 
615
  methods_table=markdown(["Run","Role","Reward","Seed","Problem source","Dev. parsed","Dev. exact","Held-out exact"],methods)
616
  atomic(experiments/"experiments.md","# Experiment index\n\nAll learned models use grouped reinforcement learning with one active LoRA adapter on the shared, quantized Qwen2.5-1.5B-Instruct backbone. The solver predicts values in signed-integer expression trees. Judges predict exact evidence records about earlier outputs. A parsed output supplies the required number of integers. An exact output also gets every field right.\n\n"+methods_table+"\n\n[Update counts and sample sizes](../summary.md) · [Objectives and curricula](../planned-runs.md) · [Analysis protocol](../preregistration.md)\n\n"+references+"\n")
617
  atomic(experiments/"learnings.md","# Experimental learnings\n\n"+("\n".join(notes) or "No experimental observations yet.")+"\n")
618
+ core=[r for r in data["runs"] if r["name"]!="base" and not r["diagnostic"] and not r["supplemental"]]
619
+ complete=sum(r["completed_final"] for r in core)
620
+ trained=sum(r["updates"] is not None for r in core)
621
  activity = []
622
+ if profile:
623
+ extra=[r for r in data["runs"] if r["supplemental"]]
624
+ activity.append(f"The matched-depth extension has trained {sum(r['updates'] is not None for r in extra)} "
625
+ f"of {len(MATCHED_NAMES)} additional shallow solvers. [Extension](matched-depth-protocol.md).")
626
  if data["budget"]:
627
  b = data["budget"]
628
  activity.append(f"The timing pilot selected {b['updates']} updates per block at {b['seconds_per_update']:.1f} seconds per pilot update. A block at that rate would take {b['updates']*b['seconds_per_update']/3600:.2f} hours.")
tests/test_depth_extension.py ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Verify the additional four treatments use the registered solver path at their actual depths."""
2
+
3
+ import pytest
4
+
5
+
6
+ def test_extra_solvers_reuse_the_deep_conditions_except_for_terminal_depth():
7
+ from dataclasses import replace
8
+ from study.design import matched_runs, matrix
9
+
10
+ profile={"family":"two-add","style":"demonstrated"}
11
+ original={r.name:r for r in matrix(profile)}
12
+ extra=matched_runs(profile)
13
+ assert len(extra)==4 and len(original)==32 and not matched_runs({})
14
+ for spec in extra:
15
+ route,depth=spec.name.split("-depth")
16
+ deep=original[route+"-prefix3"]
17
+ assert spec==replace(deep,name=spec.name,reward="d"+depth)
18
+
19
+
20
+ def test_fixed_stack_requires_persisted_identical_solver_answers(tmp_path,monkeypatch):
21
+ evaluate=pytest.importorskip("study.evaluate")
22
+ from study.domain import Problem
23
+ from study.storage import append,write_json
24
+
25
+ monkeypatch.setattr(evaluate,"RESULTS",tmp_path)
26
+ monkeypatch.setattr(evaluate,"active_profile",lambda: {"family":"two-add","style":"demonstrated"})
27
+ write_json(tmp_path/"base/development.json",{"phase":"development"})
28
+ problems=[Problem.from_expression(f"({i}+3)-2") for i in range(32)]
29
+ monkeypatch.setattr(evaluate,"population",lambda *args:problems)
30
+ for p in problems[:-1]:
31
+ append(tmp_path/"base/replay.jsonl",dict(key=p.key,expression=p.expression,trace="wrong"))
32
+ with pytest.raises(ValueError,match="complete saved"):
33
+ evaluate.stack_replay("exact")
34
+
35
+
36
+ def test_fitted_stack_scores_all_prefixes_without_resampling_solver_or_adding_ballots(tmp_path,monkeypatch):
37
+ evaluate=pytest.importorskip("study.evaluate")
38
+ from study.design import ROUTES
39
+ from study.domain import Problem
40
+ from study.records import expected,render
41
+ from study.storage import append,read_json,rows,write_json
42
+
43
+ pset=[Problem.from_expression(f"({i}+3)-2") for i in range(32)]
44
+ calls=[]
45
+ class Frozen:
46
+ def __init__(self,journal,frozen):
47
+ assert tuple(frozen)==ROUTES["exact"]
48
+ self.totals={}
49
+ def prompt(self,role,p,trace,history):
50
+ return (p,trace,history)
51
+ def generate(self,prompts,snapshot,role,seed,sample):
52
+ calls.append(role)
53
+ assert sample and snapshot=="exact-"+role
54
+ return [render(expected(p,trace,history)) for p,trace,history in prompts]
55
+ monkeypatch.setattr(evaluate,"RESULTS",tmp_path)
56
+ monkeypatch.setattr(evaluate,"active_profile",lambda:{"family":"two-add","style":"demonstrated"})
57
+ monkeypatch.setattr(evaluate,"population",lambda *args:pset)
58
+ monkeypatch.setattr(evaluate,"Backend",Frozen)
59
+ monkeypatch.setattr(evaluate,"weights_digest",lambda key:"hash-"+key)
60
+ monkeypatch.setattr(evaluate,"generation_cost",lambda name,totals:{"usage":totals})
61
+ write_json(tmp_path/"base/development.json",{"phase":"development"})
62
+ for i,p in enumerate(pset):
63
+ trace=render(p.values) if i%2 else "an invalid answer"
64
+ append(tmp_path/"base/replay.jsonl",dict(key=p.key,expression=p.expression,trace=trace,correct=i%2))
65
+ evaluate.stack_replay("exact")
66
+ result=list(rows(tmp_path/"matched-depth/exact-development.jsonl"))
67
+ assert calls==["j1","j2","j3"]*4 and len(result)==32
68
+ assert all(r["verdicts"]==[r["correct"]]*3 and not r["votes"] for r in result)
69
+ assert read_json(tmp_path/"matched-depth/exact-development.json")["n"]==32
70
+ evaluate.stack_replay("exact")
71
+ assert len(calls)==12