Add long-rl-20261014-v4_untied-ei_s1
Browse files- .gitattributes +1 -0
- runs/long-rl-20261014-v4_untied-ei_s1/eval_dev.jsonl +0 -0
- runs/long-rl-20261014-v4_untied-ei_s1/eval_old_dev.jsonl +0 -0
- runs/long-rl-20261014-v4_untied-ei_s1/final.pt +3 -0
- runs/long-rl-20261014-v4_untied-ei_s1/found_targets.jsonl +3 -0
- runs/long-rl-20261014-v4_untied-ei_s1/lean_gate.jsonl +138 -0
- runs/long-rl-20261014-v4_untied-ei_s1/pretrain.pt +3 -0
- runs/long-rl-20261014-v4_untied-ei_s1/rl_round_005.pt +3 -0
- runs/long-rl-20261014-v4_untied-ei_s1/rl_round_010.pt +3 -0
- runs/long-rl-20261014-v4_untied-ei_s1/rl_round_015.pt +3 -0
- runs/long-rl-20261014-v4_untied-ei_s1/rl_round_020.pt +3 -0
- runs/long-rl-20261014-v4_untied-ei_s1/rl_round_025.pt +3 -0
- runs/long-rl-20261014-v4_untied-ei_s1/rl_round_030.pt +3 -0
- runs/long-rl-20261014-v4_untied-ei_s1/source/harness.py +437 -0
- runs/long-rl-20261014-v4_untied-ei_s1/source/lean_gate.py +82 -0
- runs/long-rl-20261014-v4_untied-ei_s1/source/lean_tok.py +319 -0
- runs/long-rl-20261014-v4_untied-ei_s1/source/pretrain.py +948 -0
- runs/long-rl-20261014-v4_untied-ei_s1/source/remote.sh +27 -0
- runs/long-rl-20261014-v4_untied-ei_s1/summary.json +0 -0
.gitattributes
CHANGED
|
@@ -43,3 +43,4 @@ runs/long-rl-20261014-v2_untied-ei_s0/found_targets.jsonl filter=lfs diff=lfs me
|
|
| 43 |
runs/long-rl-20261014-v2_untied-ei_s1/found_targets.jsonl filter=lfs diff=lfs merge=lfs -text
|
| 44 |
runs/long-rl-20261014-v2_looped-ei_s1/found_targets.jsonl filter=lfs diff=lfs merge=lfs -text
|
| 45 |
runs/long-rl-20261014-v2_looped-ei_s0/found_targets.jsonl filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 43 |
runs/long-rl-20261014-v2_untied-ei_s1/found_targets.jsonl filter=lfs diff=lfs merge=lfs -text
|
| 44 |
runs/long-rl-20261014-v2_looped-ei_s1/found_targets.jsonl filter=lfs diff=lfs merge=lfs -text
|
| 45 |
runs/long-rl-20261014-v2_looped-ei_s0/found_targets.jsonl filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
runs/long-rl-20261014-v4_untied-ei_s1/found_targets.jsonl filter=lfs diff=lfs merge=lfs -text
|
runs/long-rl-20261014-v4_untied-ei_s1/eval_dev.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
runs/long-rl-20261014-v4_untied-ei_s1/eval_old_dev.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
runs/long-rl-20261014-v4_untied-ei_s1/final.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:468d5887aa314dd52fd305d358a1479b36bd1167830a811c9519f9189573298c
|
| 3 |
+
size 38588127
|
runs/long-rl-20261014-v4_untied-ei_s1/found_targets.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f528ef4f94e0ddbb1bef20e1d1b53db187116a6717753a9d4e25578bb2bd24f2
|
| 3 |
+
size 20930775
|
runs/long-rl-20261014-v4_untied-ei_s1/lean_gate.jsonl
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"utc": "2026-10-14T21:25:13Z", "samples": 12000, "parse_fail": 4360, "distinct_checked": 7582, "lean_ok": 1288, "lean_rej": 6294, "parse_reasons": {"unbound": 2661, "formula": 636, "name": 348, "no-eos": 239, "expected (": 118, "expected )": 99, "exact not last": 78, "expected =>": 53, "expected :=": 42, "expected ;": 36, "PR position": 31, "expected False": 10, "expected None": 6, "eof": 1, "expected :": 1, "expected exact": 1}, "lean_wall_s": 22.815133571624756, "lean_proc_s": 401.0655839443207, "workers": 96, "chunk": 400}
|
| 2 |
+
{"utc": "2026-10-14T21:27:24Z", "samples": 10056, "parse_fail": 4069, "distinct_checked": 5853, "lean_ok": 53, "lean_rej": 5800, "parse_reasons": {"unbound": 2408, "formula": 634, "name": 319, "no-eos": 257, "expected )": 117, "expected (": 91, "exact not last": 80, "expected =>": 51, "PR position": 36, "expected ;": 31, "expected :=": 29, "expected False": 9, "expected None": 5, "eof": 1, "expected by": 1}, "lean_wall_s": 15.236508846282959, "lean_proc_s": 221.52274227142334, "workers": 96, "chunk": 400}
|
| 3 |
+
{"utc": "2026-10-14T21:29:09Z", "samples": 10056, "parse_fail": 4271, "distinct_checked": 5668, "lean_ok": 35, "lean_rej": 5633, "parse_reasons": {"unbound": 2616, "formula": 619, "name": 327, "no-eos": 314, "expected (": 115, "expected )": 70, "exact not last": 65, "expected :=": 47, "expected =>": 38, "PR position": 22, "expected ;": 13, "expected False": 13, "expected None": 9, "eof": 2, "expected exact": 1}, "lean_wall_s": 16.58733081817627, "lean_proc_s": 233.06081438064575, "workers": 96, "chunk": 400}
|
| 4 |
+
{"utc": "2026-10-14T21:31:10Z", "samples": 10032, "parse_fail": 4167, "distinct_checked": 5762, "lean_ok": 25, "lean_rej": 5737, "parse_reasons": {"unbound": 2670, "formula": 606, "name": 342, "no-eos": 108, "expected )": 107, "expected (": 102, "exact not last": 77, "expected :=": 44, "expected =>": 42, "PR position": 38, "expected ;": 14, "expected False": 10, "expected None": 4, "eof": 2, "expected exact": 1}, "lean_wall_s": 16.722676038742065, "lean_proc_s": 239.38826441764832, "workers": 96, "chunk": 400}
|
| 5 |
+
{"utc": "2026-10-14T21:33:53Z", "samples": 11984, "parse_fail": 4090, "distinct_checked": 7829, "lean_ok": 2014, "lean_rej": 5815, "parse_reasons": {"unbound": 2882, "expected )": 283, "name": 229, "no-eos": 195, "formula": 158, "expected (": 138, "expected ;": 100, "exact not last": 51, "expected :=": 21, "PR position": 17, "expected False": 13, "ORE box": 2, "eof": 1}, "lean_wall_s": 22.586114645004272, "lean_proc_s": 439.47441935539246, "workers": 96, "chunk": 400}
|
| 6 |
+
{"utc": "2026-10-14T21:35:34Z", "samples": 9264, "parse_fail": 3957, "distinct_checked": 5151, "lean_ok": 16, "lean_rej": 5135, "parse_reasons": {"unbound": 2795, "expected )": 240, "name": 195, "formula": 189, "no-eos": 174, "expected ;": 124, "expected (": 114, "exact not last": 60, "expected :=": 35, "PR position": 19, "expected False": 7, "eof": 3, "expected =>": 1, "expected None": 1}, "lean_wall_s": 12.86068606376648, "lean_proc_s": 164.9170320034027, "workers": 96, "chunk": 400}
|
| 7 |
+
{"utc": "2026-10-14T21:36:51Z", "samples": 9240, "parse_fail": 3999, "distinct_checked": 5124, "lean_ok": 14, "lean_rej": 5110, "parse_reasons": {"unbound": 2829, "expected )": 269, "name": 215, "expected (": 201, "no-eos": 146, "formula": 116, "expected ;": 115, "exact not last": 70, "expected False": 12, "expected :=": 10, "PR position": 8, "eof": 5, "expected None": 1, "ORE box": 1, "expected =>": 1}, "lean_wall_s": 11.357100009918213, "lean_proc_s": 144.5717327594757, "workers": 96, "chunk": 400}
|
| 8 |
+
{"utc": "2026-10-14T21:38:26Z", "samples": 9240, "parse_fail": 3709, "distinct_checked": 5382, "lean_ok": 27, "lean_rej": 5355, "parse_reasons": {"unbound": 2516, "expected )": 330, "no-eos": 269, "name": 169, "formula": 140, "expected ;": 95, "expected (": 91, "exact not last": 50, "expected :=": 21, "PR position": 10, "expected False": 9, "eof": 6, "expected =>": 2, "expected :": 1}, "lean_wall_s": 13.800769805908203, "lean_proc_s": 183.9729917049408, "workers": 96, "chunk": 400}
|
| 9 |
+
{"utc": "2026-10-14T21:40:37Z", "samples": 12000, "parse_fail": 3856, "distinct_checked": 8056, "lean_ok": 2563, "lean_rej": 5493, "parse_reasons": {"unbound": 2946, "no-eos": 210, "name": 182, "formula": 130, "expected (": 112, "expected )": 85, "expected ;": 68, "exact not last": 65, "PR position": 22, "expected :=": 20, "ORE box": 12, "expected =>": 3, "expected None": 1}, "lean_wall_s": 20.496790647506714, "lean_proc_s": 401.9833219051361, "workers": 96, "chunk": 400}
|
| 10 |
+
{"utc": "2026-10-14T21:41:42Z", "samples": 8280, "parse_fail": 3525, "distinct_checked": 4649, "lean_ok": 59, "lean_rej": 4590, "parse_reasons": {"unbound": 2806, "name": 176, "formula": 116, "no-eos": 116, "expected (": 89, "expected :=": 48, "expected )": 47, "expected ;": 46, "exact not last": 42, "ORE box": 20, "PR position": 15, "eof": 2, "expected exact": 1, "expected =>": 1}, "lean_wall_s": 15.756996154785156, "lean_proc_s": 184.4135296344757, "workers": 96, "chunk": 400}
|
| 11 |
+
{"utc": "2026-10-14T21:42:42Z", "samples": 8280, "parse_fail": 3351, "distinct_checked": 4810, "lean_ok": 52, "lean_rej": 4758, "parse_reasons": {"unbound": 2591, "no-eos": 188, "name": 169, "formula": 118, "expected (": 73, "expected ;": 69, "expected )": 58, "exact not last": 49, "PR position": 26, "expected :=": 6, "expected =>": 2, "eof": 1, "expected exact": 1}, "lean_wall_s": 15.503366470336914, "lean_proc_s": 183.81541562080383, "workers": 96, "chunk": 400}
|
| 12 |
+
{"utc": "2026-10-14T21:43:50Z", "samples": 8280, "parse_fail": 3443, "distinct_checked": 4735, "lean_ok": 33, "lean_rej": 4702, "parse_reasons": {"unbound": 2572, "expected (": 173, "no-eos": 166, "formula": 166, "name": 156, "expected )": 67, "expected ;": 60, "exact not last": 45, "PR position": 20, "ORE box": 11, "expected :=": 6, "expected None": 1}, "lean_wall_s": 14.234656810760498, "lean_proc_s": 169.24299120903015, "workers": 96, "chunk": 400}
|
| 13 |
+
{"utc": "2026-10-14T21:45:57Z", "samples": 11992, "parse_fail": 2732, "distinct_checked": 9140, "lean_ok": 4612, "lean_rej": 4528, "parse_reasons": {"unbound": 1997, "expected (": 161, "name": 153, "no-eos": 151, "formula": 122, "expected ;": 65, "exact not last": 36, "PR position": 17, "expected )": 15, "ORE box": 5, "expected :=": 5, "expected =>": 3, "trailing tokens": 1, "expected None": 1}, "lean_wall_s": 22.86591100692749, "lean_proc_s": 510.7438933849335, "workers": 96, "chunk": 400}
|
| 14 |
+
{"utc": "2026-10-14T21:46:56Z", "samples": 6360, "parse_fail": 2507, "distinct_checked": 3755, "lean_ok": 20, "lean_rej": 3735, "parse_reasons": {"unbound": 1817, "expected (": 181, "name": 129, "formula": 110, "no-eos": 94, "expected ;": 76, "exact not last": 60, "expected )": 17, "expected :=": 8, "expected =>": 6, "PR position": 5, "ORE box": 2, "trailing tokens": 1, "expected exact": 1}, "lean_wall_s": 13.561011791229248, "lean_proc_s": 127.51034784317017, "workers": 96, "chunk": 400}
|
| 15 |
+
{"utc": "2026-10-14T21:47:48Z", "samples": 6360, "parse_fail": 2228, "distinct_checked": 4049, "lean_ok": 39, "lean_rej": 4010, "parse_reasons": {"unbound": 1581, "expected (": 160, "no-eos": 144, "name": 130, "formula": 100, "expected ;": 40, "exact not last": 29, "expected )": 20, "PR position": 16, "expected =>": 3, "ORE box": 1, "trailing tokens": 1, "expected :=": 1, "expected exact": 1, "expected None": 1}, "lean_wall_s": 10.887470722198486, "lean_proc_s": 108.86359405517578, "workers": 96, "chunk": 400}
|
| 16 |
+
{"utc": "2026-10-14T21:48:39Z", "samples": 6336, "parse_fail": 2546, "distinct_checked": 3709, "lean_ok": 30, "lean_rej": 3679, "parse_reasons": {"unbound": 1870, "expected (": 144, "name": 140, "no-eos": 129, "formula": 97, "expected ;": 63, "exact not last": 38, "PR position": 25, "ORE box": 15, "expected )": 10, "trailing tokens": 7, "expected :=": 6, "expected None": 1, "expected =>": 1}, "lean_wall_s": 8.111653804779053, "lean_proc_s": 74.42530488967896, "workers": 96, "chunk": 400}
|
| 17 |
+
{"utc": "2026-10-14T21:50:53Z", "samples": 11984, "parse_fail": 2305, "distinct_checked": 9535, "lean_ok": 6039, "lean_rej": 3496, "parse_reasons": {"unbound": 1557, "expected (": 177, "name": 161, "formula": 118, "no-eos": 111, "expected ;": 69, "expected )": 50, "exact not last": 20, "PR position": 19, "expected :=": 17, "ORE box": 4, "trailing tokens": 1, "expected None": 1}, "lean_wall_s": 19.80801749229431, "lean_proc_s": 468.34979009628296, "workers": 96, "chunk": 400}
|
| 18 |
+
{"utc": "2026-10-14T21:52:02Z", "samples": 5064, "parse_fail": 2102, "distinct_checked": 2885, "lean_ok": 52, "lean_rej": 2833, "parse_reasons": {"unbound": 1375, "expected (": 180, "formula": 131, "no-eos": 113, "name": 79, "expected ;": 62, "expected )": 56, "expected :=": 40, "PR position": 31, "exact not last": 29, "trailing tokens": 2, "eof": 1, "expected =>": 1, "expected by": 1, "ORE box": 1}, "lean_wall_s": 6.641042232513428, "lean_proc_s": 47.346832513809204, "workers": 96, "chunk": 400}
|
| 19 |
+
{"utc": "2026-10-14T21:52:38Z", "samples": 5040, "parse_fail": 2171, "distinct_checked": 2798, "lean_ok": 23, "lean_rej": 2775, "parse_reasons": {"unbound": 1567, "name": 156, "expected (": 128, "formula": 124, "no-eos": 84, "expected ;": 72, "expected )": 25, "exact not last": 12, "PR position": 3}, "lean_wall_s": 5.877394437789917, "lean_proc_s": 39.7381694316864, "workers": 96, "chunk": 400}
|
| 20 |
+
{"utc": "2026-10-14T21:53:25Z", "samples": 5040, "parse_fail": 2079, "distinct_checked": 2889, "lean_ok": 23, "lean_rej": 2866, "parse_reasons": {"unbound": 1404, "expected (": 195, "name": 113, "formula": 97, "no-eos": 93, "expected ;": 70, "expected )": 51, "exact not last": 21, "PR position": 20, "expected :=": 8, "ORE box": 5, "expected =>": 1, "trailing tokens": 1}, "lean_wall_s": 6.884016990661621, "lean_proc_s": 49.4939866065979, "workers": 96, "chunk": 400}
|
| 21 |
+
{"utc": "2026-10-14T21:55:50Z", "samples": 12000, "parse_fail": 2447, "distinct_checked": 9411, "lean_ok": 6248, "lean_rej": 3163, "parse_reasons": {"unbound": 1733, "no-eos": 247, "name": 120, "formula": 118, "expected (": 92, "exact not last": 82, "expected )": 21, "expected ;": 13, "expected :=": 8, "expected False": 4, "expected None": 2, "expected =>": 2, "ORE box": 2, "expected hh": 1, "trailing tokens": 1, "PR position": 1}, "lean_wall_s": 21.95094609260559, "lean_proc_s": 513.3545506000519, "workers": 96, "chunk": 400}
|
| 22 |
+
{"utc": "2026-10-14T21:56:53Z", "samples": 4752, "parse_fail": 2186, "distinct_checked": 2498, "lean_ok": 28, "lean_rej": 2470, "parse_reasons": {"unbound": 1487, "no-eos": 284, "formula": 107, "exact not last": 102, "name": 83, "expected (": 58, "expected )": 19, "expected ;": 15, "expected False": 12, "expected :=": 8, "ORE box": 6, "PR position": 5}, "lean_wall_s": 9.039250373840332, "lean_proc_s": 56.16356563568115, "workers": 96, "chunk": 400}
|
| 23 |
+
{"utc": "2026-10-14T21:57:57Z", "samples": 4752, "parse_fail": 2301, "distinct_checked": 2407, "lean_ok": 29, "lean_rej": 2378, "parse_reasons": {"unbound": 1682, "no-eos": 215, "expected (": 129, "formula": 88, "name": 84, "exact not last": 53, "expected ;": 19, "expected )": 17, "expected False": 7, "PR position": 6, "expected None": 1}, "lean_wall_s": 6.870012044906616, "lean_proc_s": 40.99269676208496, "workers": 96, "chunk": 400}
|
| 24 |
+
{"utc": "2026-10-14T21:59:10Z", "samples": 4752, "parse_fail": 2238, "distinct_checked": 2464, "lean_ok": 20, "lean_rej": 2444, "parse_reasons": {"unbound": 1605, "no-eos": 234, "formula": 129, "name": 87, "expected (": 79, "exact not last": 61, "expected )": 9, "expected False": 9, "expected ;": 8, "ORE box": 5, "PR position": 4, "expected :=": 4, "expected =>": 3, "trailing tokens": 1}, "lean_wall_s": 4.979950189590454, "lean_proc_s": 30.68893027305603, "workers": 96, "chunk": 400}
|
| 25 |
+
{"utc": "2026-10-14T22:01:38Z", "samples": 12000, "parse_fail": 2857, "distinct_checked": 9027, "lean_ok": 6699, "lean_rej": 2328, "parse_reasons": {"unbound": 2037, "no-eos": 259, "name": 155, "expected (": 137, "expected ;": 112, "formula": 61, "exact not last": 44, "expected )": 34, "expected :=": 6, "ORE box": 5, "PR position": 5, "trailing tokens": 1, "expected None": 1}, "lean_wall_s": 19.531020641326904, "lean_proc_s": 438.89914441108704, "workers": 96, "chunk": 400}
|
| 26 |
+
{"utc": "2026-10-14T22:02:41Z", "samples": 4344, "parse_fail": 2666, "distinct_checked": 1642, "lean_ok": 21, "lean_rej": 1621, "parse_reasons": {"unbound": 1947, "no-eos": 200, "expected (": 116, "formula": 103, "expected ;": 93, "name": 89, "exact not last": 45, "expected )": 36, "PR position": 33, "expected =>": 2, "expected :=": 1, "ORE box": 1}, "lean_wall_s": 6.133831024169922, "lean_proc_s": 25.1847083568573, "workers": 96, "chunk": 400}
|
| 27 |
+
{"utc": "2026-10-14T22:03:32Z", "samples": 4320, "parse_fail": 2599, "distinct_checked": 1688, "lean_ok": 13, "lean_rej": 1675, "parse_reasons": {"unbound": 1865, "no-eos": 205, "name": 173, "expected (": 140, "expected ;": 111, "exact not last": 49, "formula": 17, "expected )": 16, "PR position": 10, "expected :=": 6, "expected =>": 3, "ORE box": 2, "expected None": 2}, "lean_wall_s": 6.056627511978149, "lean_proc_s": 25.9652841091156, "workers": 96, "chunk": 400}
|
| 28 |
+
{"utc": "2026-10-14T22:04:42Z", "samples": 4320, "parse_fail": 2506, "distinct_checked": 1780, "lean_ok": 22, "lean_rej": 1758, "parse_reasons": {"unbound": 1674, "no-eos": 286, "expected (": 154, "expected ;": 128, "name": 90, "formula": 65, "exact not last": 46, "expected )": 27, "expected :=": 17, "PR position": 9, "ORE box": 8, "expected =>": 2}, "lean_wall_s": 6.494420528411865, "lean_proc_s": 28.942582368850708, "workers": 96, "chunk": 400}
|
| 29 |
+
{"utc": "2026-10-14T22:06:54Z", "samples": 12008, "parse_fail": 2333, "distinct_checked": 9547, "lean_ok": 7068, "lean_rej": 2479, "parse_reasons": {"unbound": 1599, "name": 149, "no-eos": 122, "expected (": 108, "formula": 106, "expected ;": 84, "exact not last": 81, "expected )": 47, "PR position": 20, "ORE box": 10, "expected :=": 4, "expected =>": 2, "expected None": 1}, "lean_wall_s": 24.579160690307617, "lean_proc_s": 579.7883214950562, "workers": 96, "chunk": 400}
|
| 30 |
+
{"utc": "2026-10-14T22:07:48Z", "samples": 4008, "parse_fail": 1901, "distinct_checked": 2067, "lean_ok": 16, "lean_rej": 2051, "parse_reasons": {"unbound": 1278, "formula": 148, "expected (": 95, "name": 84, "expected ;": 73, "no-eos": 72, "exact not last": 70, "expected )": 52, "ORE box": 9, "expected :=": 9, "PR position": 8, "expected None": 2, "expected =>": 1}, "lean_wall_s": 9.914214611053467, "lean_proc_s": 51.09683060646057, "workers": 96, "chunk": 400}
|
| 31 |
+
{"utc": "2026-10-14T22:08:44Z", "samples": 4008, "parse_fail": 2348, "distinct_checked": 1636, "lean_ok": 40, "lean_rej": 1596, "parse_reasons": {"unbound": 1615, "expected (": 124, "no-eos": 123, "name": 122, "formula": 106, "expected ;": 94, "exact not last": 76, "expected )": 61, "PR position": 21, "expected =>": 2, "eof": 1, "ORE box": 1, "expected None": 1, "expected by": 1}, "lean_wall_s": 7.790634870529175, "lean_proc_s": 31.62272548675537, "workers": 96, "chunk": 400}
|
| 32 |
+
{"utc": "2026-10-14T22:09:29Z", "samples": 3984, "parse_fail": 2066, "distinct_checked": 1881, "lean_ok": 23, "lean_rej": 1858, "parse_reasons": {"unbound": 1441, "name": 126, "no-eos": 122, "exact not last": 112, "expected (": 86, "expected ;": 63, "formula": 61, "expected )": 33, "ORE box": 13, "PR position": 5, "expected =>": 2, "expected None": 1, "expected by": 1}, "lean_wall_s": 6.984690427780151, "lean_proc_s": 33.85776901245117, "workers": 96, "chunk": 400}
|
| 33 |
+
{"utc": "2026-10-14T22:12:02Z", "samples": 11984, "parse_fail": 2694, "distinct_checked": 9169, "lean_ok": 7079, "lean_rej": 2090, "parse_reasons": {"unbound": 1622, "no-eos": 502, "expected (": 173, "name": 149, "formula": 86, "exact not last": 57, "expected ;": 41, "expected )": 25, "ORE box": 15, "PR position": 9, "expected :=": 9, "expected None": 2, "trailing tokens": 1, "expected fun": 1, "expected :": 1, "eof": 1}, "lean_wall_s": 27.784743309020996, "lean_proc_s": 630.6349673271179, "workers": 96, "chunk": 400}
|
| 34 |
+
{"utc": "2026-10-14T22:12:56Z", "samples": 3840, "parse_fail": 2346, "distinct_checked": 1461, "lean_ok": 23, "lean_rej": 1438, "parse_reasons": {"unbound": 1498, "no-eos": 393, "expected (": 197, "formula": 60, "name": 53, "exact not last": 52, "expected ;": 39, "expected )": 31, "ORE box": 15, "expected :=": 4, "PR position": 4}, "lean_wall_s": 6.672514200210571, "lean_proc_s": 25.63902449607849, "workers": 96, "chunk": 400}
|
| 35 |
+
{"utc": "2026-10-14T22:14:09Z", "samples": 3840, "parse_fail": 2349, "distinct_checked": 1470, "lean_ok": 11, "lean_rej": 1459, "parse_reasons": {"unbound": 1427, "no-eos": 435, "expected (": 150, "name": 81, "formula": 74, "expected ;": 55, "exact not last": 52, "expected :=": 31, "expected )": 24, "PR position": 14, "ORE box": 5, "expected =>": 1}, "lean_wall_s": 6.444755554199219, "lean_proc_s": 24.684633016586304, "workers": 96, "chunk": 400}
|
| 36 |
+
{"utc": "2026-10-14T22:15:11Z", "samples": 3816, "parse_fail": 2294, "distinct_checked": 1490, "lean_ok": 22, "lean_rej": 1468, "parse_reasons": {"unbound": 1305, "no-eos": 492, "expected (": 195, "name": 88, "formula": 88, "exact not last": 63, "expected ;": 27, "ORE box": 17, "expected )": 8, "PR position": 5, "expected :=": 5, "eof": 1}, "lean_wall_s": 6.676572561264038, "lean_proc_s": 26.089574575424194, "workers": 96, "chunk": 400}
|
| 37 |
+
{"utc": "2026-10-14T22:17:49Z", "samples": 11992, "parse_fail": 2692, "distinct_checked": 9184, "lean_ok": 7276, "lean_rej": 1908, "parse_reasons": {"unbound": 1726, "no-eos": 302, "expected (": 167, "name": 136, "expected ;": 100, "formula": 95, "exact not last": 78, "expected )": 43, "expected :=": 21, "expected =>": 14, "ORE box": 5, "PR position": 3, "expected None": 2}, "lean_wall_s": 25.956695795059204, "lean_proc_s": 585.7370185852051, "workers": 96, "chunk": 400}
|
| 38 |
+
{"utc": "2026-10-14T22:19:01Z", "samples": 3696, "parse_fail": 2229, "distinct_checked": 1439, "lean_ok": 17, "lean_rej": 1422, "parse_reasons": {"unbound": 1396, "no-eos": 317, "expected (": 187, "formula": 98, "expected ;": 73, "exact not last": 72, "name": 61, "expected )": 11, "expected :=": 6, "PR position": 4, "ORE box": 2, "trailing tokens": 2}, "lean_wall_s": 6.922471523284912, "lean_proc_s": 26.50080394744873, "workers": 96, "chunk": 400}
|
| 39 |
+
{"utc": "2026-10-14T22:20:00Z", "samples": 3696, "parse_fail": 2481, "distinct_checked": 1195, "lean_ok": 6, "lean_rej": 1189, "parse_reasons": {"unbound": 1691, "no-eos": 241, "expected (": 148, "expected ;": 96, "name": 70, "formula": 67, "exact not last": 66, "expected )": 34, "expected :=": 33, "expected =>": 25, "PR position": 5, "ORE box": 2, "expected False": 1, "trailing tokens": 1, "expected None": 1}, "lean_wall_s": 5.140257835388184, "lean_proc_s": 15.219174146652222, "workers": 96, "chunk": 400}
|
| 40 |
+
{"utc": "2026-10-14T22:20:55Z", "samples": 3672, "parse_fail": 2307, "distinct_checked": 1335, "lean_ok": 10, "lean_rej": 1325, "parse_reasons": {"unbound": 1549, "no-eos": 236, "expected (": 146, "formula": 100, "name": 81, "expected ;": 71, "expected )": 54, "exact not last": 42, "expected :=": 15, "PR position": 4, "expected =>": 4, "ORE box": 3, "expected False": 1, "trailing tokens": 1}, "lean_wall_s": 6.333273410797119, "lean_proc_s": 21.808959007263184, "workers": 96, "chunk": 400}
|
| 41 |
+
{"utc": "2026-10-14T22:23:21Z", "samples": 12008, "parse_fail": 2548, "distinct_checked": 9339, "lean_ok": 7313, "lean_rej": 2026, "parse_reasons": {"unbound": 1461, "no-eos": 447, "expected (": 203, "name": 145, "exact not last": 111, "formula": 63, "expected ;": 62, "expected )": 31, "ORE box": 11, "expected :=": 7, "PR position": 3, "trailing tokens": 2, "expected :": 1, "expected None": 1}, "lean_wall_s": 19.11683416366577, "lean_proc_s": 442.6049931049347, "workers": 96, "chunk": 400}
|
| 42 |
+
{"utc": "2026-10-14T22:24:29Z", "samples": 3648, "parse_fail": 2248, "distinct_checked": 1378, "lean_ok": 24, "lean_rej": 1354, "parse_reasons": {"unbound": 1350, "no-eos": 382, "expected (": 172, "exact not last": 114, "name": 91, "expected ;": 53, "expected )": 33, "formula": 30, "expected :=": 9, "PR position": 9, "expected None": 2, "eof": 1, "ORE box": 1, "expected by": 1}, "lean_wall_s": 4.988383769989014, "lean_proc_s": 17.316808223724365, "workers": 96, "chunk": 400}
|
| 43 |
+
{"utc": "2026-10-14T22:25:36Z", "samples": 3648, "parse_fail": 2181, "distinct_checked": 1431, "lean_ok": 21, "lean_rej": 1410, "parse_reasons": {"unbound": 1301, "no-eos": 331, "expected (": 190, "expected ;": 104, "name": 101, "exact not last": 72, "formula": 48, "expected )": 17, "PR position": 6, "expected :=": 5, "ORE box": 4, "expected =>": 1, "expected None": 1}, "lean_wall_s": 6.844141721725464, "lean_proc_s": 25.710004091262817, "workers": 96, "chunk": 400}
|
| 44 |
+
{"utc": "2026-10-14T22:26:33Z", "samples": 3648, "parse_fail": 2139, "distinct_checked": 1472, "lean_ok": 26, "lean_rej": 1446, "parse_reasons": {"unbound": 1137, "no-eos": 451, "expected (": 180, "name": 95, "formula": 93, "exact not last": 88, "expected ;": 41, "expected )": 38, "PR position": 9, "expected :=": 5, "expected False": 1, "ORE box": 1}, "lean_wall_s": 7.431859731674194, "lean_proc_s": 28.551203966140747, "workers": 96, "chunk": 400}
|
| 45 |
+
{"utc": "2026-10-14T22:29:17Z", "samples": 11992, "parse_fail": 2858, "distinct_checked": 9033, "lean_ok": 7034, "lean_rej": 1999, "parse_reasons": {"unbound": 1725, "no-eos": 301, "expected (": 275, "name": 231, "expected ;": 118, "exact not last": 72, "formula": 67, "expected )": 39, "expected :=": 12, "ORE box": 6, "expected =>": 6, "PR position": 5, "expected .elim": 1}, "lean_wall_s": 26.016480207443237, "lean_proc_s": 585.7060525417328, "workers": 96, "chunk": 400}
|
| 46 |
+
{"utc": "2026-10-14T22:30:28Z", "samples": 3984, "parse_fail": 2398, "distinct_checked": 1562, "lean_ok": 28, "lean_rej": 1534, "parse_reasons": {"unbound": 1518, "expected (": 269, "no-eos": 170, "name": 130, "expected ;": 105, "formula": 76, "exact not last": 66, "expected )": 42, "expected :=": 14, "PR position": 6, "expected fun": 1, "ORE box": 1}, "lean_wall_s": 7.922526836395264, "lean_proc_s": 31.01486611366272, "workers": 96, "chunk": 400}
|
| 47 |
+
{"utc": "2026-10-14T22:31:32Z", "samples": 3984, "parse_fail": 2577, "distinct_checked": 1382, "lean_ok": 22, "lean_rej": 1360, "parse_reasons": {"unbound": 1581, "no-eos": 280, "expected (": 228, "name": 171, "expected ;": 86, "exact not last": 83, "formula": 68, "expected )": 37, "expected :=": 34, "ORE box": 7, "PR position": 2}, "lean_wall_s": 6.119631767272949, "lean_proc_s": 22.03226947784424, "workers": 96, "chunk": 400}
|
| 48 |
+
{"utc": "2026-10-14T22:32:39Z", "samples": 3960, "parse_fail": 2523, "distinct_checked": 1419, "lean_ok": 14, "lean_rej": 1405, "parse_reasons": {"unbound": 1442, "no-eos": 305, "expected (": 271, "name": 148, "expected ;": 132, "exact not last": 87, "expected )": 54, "formula": 52, "expected :=": 13, "PR position": 12, "expected =>": 7}, "lean_wall_s": 7.142524719238281, "lean_proc_s": 27.68851661682129, "workers": 96, "chunk": 400}
|
| 49 |
+
{"utc": "2026-10-14T22:35:16Z", "samples": 12000, "parse_fail": 2962, "distinct_checked": 8940, "lean_ok": 6981, "lean_rej": 1959, "parse_reasons": {"unbound": 1896, "no-eos": 395, "expected (": 260, "name": 123, "formula": 83, "expected ;": 66, "exact not last": 59, "expected )": 33, "expected :=": 27, "PR position": 9, "ORE box": 7, "expected None": 2, "expected =>": 1, "trailing tokens": 1}, "lean_wall_s": 27.955443620681763, "lean_proc_s": 615.2472987174988, "workers": 96, "chunk": 400}
|
| 50 |
+
{"utc": "2026-10-14T22:36:23Z", "samples": 4032, "parse_fail": 2707, "distinct_checked": 1304, "lean_ok": 14, "lean_rej": 1290, "parse_reasons": {"unbound": 1814, "no-eos": 343, "expected (": 238, "formula": 86, "name": 74, "exact not last": 62, "expected ;": 53, "expected )": 19, "expected :=": 7, "PR position": 6, "ORE box": 4, "expected None": 1}, "lean_wall_s": 7.2827534675598145, "lean_proc_s": 24.832661867141724, "workers": 96, "chunk": 400}
|
| 51 |
+
{"utc": "2026-10-14T22:37:39Z", "samples": 4008, "parse_fail": 2623, "distinct_checked": 1372, "lean_ok": 7, "lean_rej": 1365, "parse_reasons": {"unbound": 1668, "no-eos": 341, "expected (": 214, "expected ;": 119, "name": 68, "exact not last": 63, "formula": 54, "expected :=": 42, "expected )": 41, "PR position": 9, "ORE box": 4}, "lean_wall_s": 5.820044994354248, "lean_proc_s": 21.06404399871826, "workers": 96, "chunk": 400}
|
| 52 |
+
{"utc": "2026-10-14T22:38:34Z", "samples": 4008, "parse_fail": 2628, "distinct_checked": 1360, "lean_ok": 26, "lean_rej": 1334, "parse_reasons": {"unbound": 1751, "no-eos": 277, "expected (": 260, "formula": 104, "expected ;": 64, "name": 55, "exact not last": 47, "expected )": 43, "expected :=": 16, "PR position": 5, "trailing tokens": 2, "expected =>": 2, "ORE box": 2}, "lean_wall_s": 6.030851602554321, "lean_proc_s": 21.643226385116577, "workers": 96, "chunk": 400}
|
| 53 |
+
{"utc": "2026-10-14T22:41:08Z", "samples": 12016, "parse_fail": 3064, "distinct_checked": 8870, "lean_ok": 7004, "lean_rej": 1866, "parse_reasons": {"unbound": 1963, "no-eos": 306, "expected (": 257, "expected ;": 177, "name": 148, "formula": 73, "expected )": 58, "exact not last": 44, "ORE box": 23, "PR position": 4, "expected :=": 4, "expected =>": 3, "expected None": 2, "expected False": 2}, "lean_wall_s": 23.14531397819519, "lean_proc_s": 505.08463048934937, "workers": 96, "chunk": 400}
|
| 54 |
+
{"utc": "2026-10-14T22:42:13Z", "samples": 3936, "parse_fail": 2755, "distinct_checked": 1167, "lean_ok": 27, "lean_rej": 1140, "parse_reasons": {"unbound": 1848, "expected (": 277, "no-eos": 162, "expected ;": 148, "name": 112, "expected )": 55, "exact not last": 52, "formula": 52, "ORE box": 34, "expected :=": 9, "PR position": 4, "expected None": 1, "expected =>": 1}, "lean_wall_s": 5.488591194152832, "lean_proc_s": 16.022915840148926, "workers": 96, "chunk": 400}
|
| 55 |
+
{"utc": "2026-10-14T22:43:21Z", "samples": 3936, "parse_fail": 2614, "distinct_checked": 1306, "lean_ok": 8, "lean_rej": 1298, "parse_reasons": {"unbound": 1509, "expected (": 289, "expected ;": 270, "no-eos": 225, "formula": 81, "expected )": 80, "name": 77, "exact not last": 39, "ORE box": 23, "expected :=": 9, "expected =>": 9, "PR position": 3}, "lean_wall_s": 5.512563467025757, "lean_proc_s": 18.069947481155396, "workers": 96, "chunk": 400}
|
| 56 |
+
{"utc": "2026-10-14T22:44:25Z", "samples": 3936, "parse_fail": 2605, "distinct_checked": 1323, "lean_ok": 15, "lean_rej": 1308, "parse_reasons": {"unbound": 1799, "no-eos": 232, "expected (": 191, "expected ;": 129, "name": 87, "expected )": 61, "formula": 58, "exact not last": 33, "expected :=": 6, "expected =>": 3, "ORE box": 2, "expected None": 2, "PR position": 1, "expected :": 1}, "lean_wall_s": 5.268297910690308, "lean_proc_s": 18.18173623085022, "workers": 96, "chunk": 400}
|
| 57 |
+
{"utc": "2026-10-14T22:46:54Z", "samples": 11992, "parse_fail": 3256, "distinct_checked": 8668, "lean_ok": 6932, "lean_rej": 1736, "parse_reasons": {"unbound": 1961, "no-eos": 525, "expected (": 287, "name": 129, "expected ;": 128, "formula": 75, "exact not last": 55, "expected )": 43, "expected :=": 20, "ORE box": 16, "PR position": 9, "expected =>": 6, "trailing tokens": 2}, "lean_wall_s": 19.9227774143219, "lean_proc_s": 427.3422038555145, "workers": 96, "chunk": 400}
|
| 58 |
+
{"utc": "2026-10-14T22:48:11Z", "samples": 4008, "parse_fail": 2779, "distinct_checked": 1215, "lean_ok": 4, "lean_rej": 1211, "parse_reasons": {"unbound": 1638, "no-eos": 413, "expected (": 323, "expected ;": 140, "name": 76, "formula": 52, "expected )": 50, "exact not last": 45, "expected :=": 21, "PR position": 8, "expected =>": 7, "ORE box": 3, "expected None": 1, "trailing tokens": 1, "eof": 1}, "lean_wall_s": 5.1969687938690186, "lean_proc_s": 15.773969650268555, "workers": 96, "chunk": 400}
|
| 59 |
+
{"utc": "2026-10-14T22:49:13Z", "samples": 4008, "parse_fail": 2875, "distinct_checked": 1121, "lean_ok": 31, "lean_rej": 1090, "parse_reasons": {"unbound": 1871, "no-eos": 486, "expected (": 209, "formula": 81, "expected ;": 73, "name": 58, "exact not last": 46, "expected )": 21, "expected :=": 15, "ORE box": 9, "PR position": 5, "expected None": 1}, "lean_wall_s": 5.228126287460327, "lean_proc_s": 15.013465166091919, "workers": 96, "chunk": 400}
|
| 60 |
+
{"utc": "2026-10-14T22:50:18Z", "samples": 4008, "parse_fail": 2898, "distinct_checked": 1098, "lean_ok": 27, "lean_rej": 1071, "parse_reasons": {"unbound": 1774, "no-eos": 479, "expected (": 203, "expected ;": 126, "name": 100, "formula": 93, "exact not last": 39, "expected :=": 27, "expected )": 26, "ORE box": 16, "PR position": 13, "expected =>": 1, "expected :": 1}, "lean_wall_s": 4.110546827316284, "lean_proc_s": 11.526376962661743, "workers": 96, "chunk": 400}
|
| 61 |
+
{"utc": "2026-10-14T22:52:51Z", "samples": 12016, "parse_fail": 3305, "distinct_checked": 8619, "lean_ok": 6735, "lean_rej": 1884, "parse_reasons": {"unbound": 1887, "no-eos": 527, "expected (": 396, "name": 152, "expected ;": 109, "formula": 83, "exact not last": 63, "expected )": 34, "expected :=": 30, "ORE box": 17, "expected None": 3, "PR position": 3, "eof": 1}, "lean_wall_s": 20.0424382686615, "lean_proc_s": 430.17161083221436, "workers": 96, "chunk": 400}
|
| 62 |
+
{"utc": "2026-10-14T22:54:00Z", "samples": 4224, "parse_fail": 3021, "distinct_checked": 1196, "lean_ok": 28, "lean_rej": 1168, "parse_reasons": {"unbound": 1725, "no-eos": 569, "expected (": 348, "name": 109, "expected ;": 75, "formula": 71, "expected :=": 52, "exact not last": 39, "expected )": 26, "ORE box": 4, "eof": 2, "PR position": 1}, "lean_wall_s": 4.5060930252075195, "lean_proc_s": 13.353266477584839, "workers": 96, "chunk": 400}
|
| 63 |
+
{"utc": "2026-10-14T22:55:08Z", "samples": 4224, "parse_fail": 2862, "distinct_checked": 1347, "lean_ok": 14, "lean_rej": 1333, "parse_reasons": {"unbound": 1725, "no-eos": 404, "expected (": 373, "expected ;": 111, "formula": 86, "name": 74, "exact not last": 46, "expected :=": 23, "expected )": 12, "PR position": 5, "ORE box": 3}, "lean_wall_s": 5.0980613231658936, "lean_proc_s": 17.774101972579956, "workers": 96, "chunk": 400}
|
| 64 |
+
{"utc": "2026-10-14T22:56:18Z", "samples": 4200, "parse_fail": 3058, "distinct_checked": 1125, "lean_ok": 10, "lean_rej": 1115, "parse_reasons": {"unbound": 1828, "no-eos": 450, "expected (": 380, "expected ;": 100, "formula": 87, "name": 87, "exact not last": 57, "expected )": 34, "expected :=": 21, "ORE box": 9, "PR position": 4, "eof": 1}, "lean_wall_s": 5.08304238319397, "lean_proc_s": 14.706327199935913, "workers": 96, "chunk": 400}
|
| 65 |
+
{"utc": "2026-10-14T22:58:55Z", "samples": 11992, "parse_fail": 3205, "distinct_checked": 8718, "lean_ok": 6446, "lean_rej": 2272, "parse_reasons": {"unbound": 1890, "no-eos": 530, "expected (": 317, "name": 155, "expected ;": 104, "formula": 59, "exact not last": 49, "expected )": 37, "expected :=": 27, "ORE box": 12, "expected =>": 12, "PR position": 7, "expected None": 4, "expected exact": 1, "trailing tokens": 1}, "lean_wall_s": 18.26117181777954, "lean_proc_s": 387.6176371574402, "workers": 96, "chunk": 400}
|
| 66 |
+
{"utc": "2026-10-14T23:00:07Z", "samples": 4440, "parse_fail": 2768, "distinct_checked": 1646, "lean_ok": 2, "lean_rej": 1644, "parse_reasons": {"unbound": 1633, "no-eos": 409, "expected (": 332, "expected ;": 125, "name": 110, "exact not last": 39, "expected )": 39, "formula": 36, "expected :=": 31, "PR position": 5, "expected =>": 4, "ORE box": 4, "expected None": 1}, "lean_wall_s": 3.9543416500091553, "lean_proc_s": 16.43289875984192, "workers": 96, "chunk": 400}
|
| 67 |
+
{"utc": "2026-10-14T23:01:25Z", "samples": 4440, "parse_fail": 2852, "distinct_checked": 1576, "lean_ok": 17, "lean_rej": 1559, "parse_reasons": {"unbound": 1574, "no-eos": 558, "expected (": 329, "name": 93, "expected ;": 87, "formula": 68, "exact not last": 45, "ORE box": 39, "expected )": 22, "expected :=": 22, "expected =>": 15}, "lean_wall_s": 4.99388313293457, "lean_proc_s": 19.45129108428955, "workers": 96, "chunk": 400}
|
| 68 |
+
{"utc": "2026-10-14T23:02:17Z", "samples": 4440, "parse_fail": 2864, "distinct_checked": 1562, "lean_ok": 5, "lean_rej": 1557, "parse_reasons": {"unbound": 1717, "no-eos": 397, "expected (": 352, "name": 130, "expected ;": 93, "formula": 51, "expected )": 41, "exact not last": 35, "expected :=": 30, "expected =>": 12, "ORE box": 5, "PR position": 1}, "lean_wall_s": 4.514822006225586, "lean_proc_s": 17.653352737426758, "workers": 96, "chunk": 400}
|
| 69 |
+
{"utc": "2026-10-14T23:04:51Z", "samples": 12000, "parse_fail": 3278, "distinct_checked": 8658, "lean_ok": 6591, "lean_rej": 2067, "parse_reasons": {"unbound": 1818, "no-eos": 573, "expected (": 372, "name": 168, "expected ;": 142, "formula": 81, "exact not last": 52, "trailing tokens": 22, "ORE box": 17, "expected :=": 14, "expected )": 11, "PR position": 8}, "lean_wall_s": 22.227638244628906, "lean_proc_s": 475.70153880119324, "workers": 96, "chunk": 400}
|
| 70 |
+
{"utc": "2026-10-14T23:06:10Z", "samples": 4512, "parse_fail": 2969, "distinct_checked": 1518, "lean_ok": 14, "lean_rej": 1504, "parse_reasons": {"unbound": 1655, "no-eos": 562, "expected (": 301, "expected ;": 146, "name": 143, "formula": 86, "exact not last": 43, "trailing tokens": 8, "ORE box": 8, "expected )": 7, "PR position": 6, "expected :=": 2, "expected False": 1, "expected None": 1}, "lean_wall_s": 6.157602310180664, "lean_proc_s": 23.875365257263184, "workers": 96, "chunk": 400}
|
| 71 |
+
{"utc": "2026-10-14T23:07:14Z", "samples": 4512, "parse_fail": 3009, "distinct_checked": 1490, "lean_ok": 18, "lean_rej": 1472, "parse_reasons": {"unbound": 1750, "no-eos": 378, "expected (": 360, "name": 128, "expected ;": 127, "formula": 106, "exact not last": 80, "expected :=": 34, "ORE box": 22, "trailing tokens": 10, "PR position": 7, "expected )": 5, "expected None": 1, "expected :": 1}, "lean_wall_s": 6.111329078674316, "lean_proc_s": 23.842651844024658, "workers": 96, "chunk": 400}
|
| 72 |
+
{"utc": "2026-10-14T23:08:09Z", "samples": 4512, "parse_fail": 2932, "distinct_checked": 1556, "lean_ok": 15, "lean_rej": 1541, "parse_reasons": {"unbound": 1589, "no-eos": 569, "expected (": 390, "name": 136, "expected ;": 133, "exact not last": 38, "formula": 31, "expected :=": 20, "ORE box": 15, "expected )": 6, "PR position": 3, "expected None": 1, "expected by": 1}, "lean_wall_s": 5.911387920379639, "lean_proc_s": 23.26575469970703, "workers": 96, "chunk": 400}
|
| 73 |
+
{"utc": "2026-10-14T23:10:46Z", "samples": 12008, "parse_fail": 3604, "distinct_checked": 8354, "lean_ok": 6158, "lean_rej": 2196, "parse_reasons": {"unbound": 2026, "no-eos": 690, "expected (": 363, "expected ;": 130, "name": 117, "formula": 113, "exact not last": 66, "expected )": 35, "expected :=": 34, "ORE box": 20, "PR position": 3, "expected =>": 3, "trailing tokens": 1, "expected None": 1, "expected exact": 1, "expected False": 1}, "lean_wall_s": 18.371251821517944, "lean_proc_s": 368.74377727508545, "workers": 96, "chunk": 400}
|
| 74 |
+
{"utc": "2026-10-14T23:11:54Z", "samples": 4920, "parse_fail": 3342, "distinct_checked": 1565, "lean_ok": 9, "lean_rej": 1556, "parse_reasons": {"unbound": 1818, "no-eos": 736, "expected (": 368, "expected ;": 110, "formula": 101, "name": 78, "exact not last": 68, "expected )": 44, "expected :=": 11, "ORE box": 6, "expected None": 1, "trailing tokens": 1}, "lean_wall_s": 4.754354476928711, "lean_proc_s": 18.634763717651367, "workers": 96, "chunk": 400}
|
| 75 |
+
{"utc": "2026-10-14T23:13:01Z", "samples": 4920, "parse_fail": 3150, "distinct_checked": 1756, "lean_ok": 9, "lean_rej": 1747, "parse_reasons": {"unbound": 1812, "no-eos": 598, "expected (": 276, "expected ;": 139, "name": 106, "exact not last": 68, "formula": 56, "ORE box": 35, "expected :=": 28, "expected )": 21, "expected =>": 8, "PR position": 3}, "lean_wall_s": 5.395793199539185, "lean_proc_s": 23.977174043655396, "workers": 96, "chunk": 400}
|
| 76 |
+
{"utc": "2026-10-14T23:14:09Z", "samples": 4920, "parse_fail": 3314, "distinct_checked": 1584, "lean_ok": 23, "lean_rej": 1561, "parse_reasons": {"unbound": 1909, "no-eos": 470, "expected (": 369, "expected ;": 183, "formula": 127, "name": 77, "exact not last": 74, "expected :=": 52, "expected )": 32, "ORE box": 17, "eof": 2, "PR position": 1, "expected False": 1}, "lean_wall_s": 3.839796304702759, "lean_proc_s": 14.864064455032349, "workers": 96, "chunk": 400}
|
| 77 |
+
{"utc": "2026-10-14T23:16:36Z", "samples": 12000, "parse_fail": 3661, "distinct_checked": 8278, "lean_ok": 6252, "lean_rej": 2026, "parse_reasons": {"unbound": 2088, "no-eos": 644, "expected (": 429, "name": 187, "expected ;": 93, "formula": 79, "exact not last": 76, "expected )": 28, "expected :=": 16, "PR position": 10, "ORE box": 7, "expected =>": 3, "expected None": 1}, "lean_wall_s": 18.553884267807007, "lean_proc_s": 377.68592858314514, "workers": 96, "chunk": 400}
|
| 78 |
+
{"utc": "2026-10-14T23:17:43Z", "samples": 4896, "parse_fail": 3518, "distinct_checked": 1362, "lean_ok": 8, "lean_rej": 1354, "parse_reasons": {"unbound": 1993, "no-eos": 671, "expected (": 461, "name": 108, "expected ;": 103, "formula": 75, "exact not last": 74, "expected )": 16, "ORE box": 7, "expected :=": 3, "PR position": 3, "expected False": 2, "trailing tokens": 1, "expected =>": 1}, "lean_wall_s": 5.979891777038574, "lean_proc_s": 21.124221324920654, "workers": 96, "chunk": 400}
|
| 79 |
+
{"utc": "2026-10-14T23:18:51Z", "samples": 4872, "parse_fail": 3340, "distinct_checked": 1518, "lean_ok": 0, "lean_rej": 1518, "parse_reasons": {"unbound": 1994, "no-eos": 436, "expected (": 414, "name": 168, "expected ;": 86, "exact not last": 80, "formula": 65, "expected )": 48, "expected :=": 23, "ORE box": 11, "PR position": 8, "expected False": 5, "expected None": 1, "expected =>": 1}, "lean_wall_s": 5.306715965270996, "lean_proc_s": 20.577362298965454, "workers": 96, "chunk": 400}
|
| 80 |
+
{"utc": "2026-10-14T23:19:46Z", "samples": 4872, "parse_fail": 3258, "distinct_checked": 1598, "lean_ok": 20, "lean_rej": 1578, "parse_reasons": {"unbound": 1898, "no-eos": 523, "expected (": 411, "name": 108, "expected ;": 105, "exact not last": 98, "formula": 66, "expected :=": 20, "expected )": 15, "PR position": 8, "expected False": 3, "ORE box": 3}, "lean_wall_s": 6.575355529785156, "lean_proc_s": 25.93372106552124, "workers": 96, "chunk": 400}
|
| 81 |
+
{"utc": "2026-10-14T23:22:26Z", "samples": 12008, "parse_fail": 3800, "distinct_checked": 8151, "lean_ok": 6114, "lean_rej": 2037, "parse_reasons": {"unbound": 2340, "no-eos": 593, "expected (": 404, "name": 161, "expected ;": 102, "formula": 84, "exact not last": 54, "ORE box": 31, "expected )": 22, "PR position": 8, "trailing tokens": 1}, "lean_wall_s": 22.610066890716553, "lean_proc_s": 458.7128641605377, "workers": 96, "chunk": 400}
|
| 82 |
+
{"utc": "2026-10-14T23:23:27Z", "samples": 4944, "parse_fail": 3489, "distinct_checked": 1443, "lean_ok": 27, "lean_rej": 1416, "parse_reasons": {"unbound": 2196, "no-eos": 548, "expected (": 321, "name": 109, "expected ;": 102, "ORE box": 63, "exact not last": 59, "formula": 51, "expected )": 24, "PR position": 14, "trailing tokens": 2}, "lean_wall_s": 6.379005193710327, "lean_proc_s": 23.85744881629944, "workers": 96, "chunk": 400}
|
| 83 |
+
{"utc": "2026-10-14T23:24:40Z", "samples": 4944, "parse_fail": 3371, "distinct_checked": 1556, "lean_ok": 11, "lean_rej": 1545, "parse_reasons": {"unbound": 2046, "no-eos": 554, "expected (": 364, "formula": 127, "name": 109, "expected ;": 77, "exact not last": 50, "expected )": 23, "ORE box": 18, "PR position": 2, "eof": 1}, "lean_wall_s": 7.1176111698150635, "lean_proc_s": 27.776087522506714, "workers": 96, "chunk": 400}
|
| 84 |
+
{"utc": "2026-10-14T23:25:45Z", "samples": 4920, "parse_fail": 3469, "distinct_checked": 1441, "lean_ok": 4, "lean_rej": 1437, "parse_reasons": {"unbound": 2211, "no-eos": 460, "expected (": 439, "name": 102, "expected ;": 90, "formula": 54, "exact not last": 46, "ORE box": 25, "PR position": 20, "expected )": 19, "expected :=": 2, "eof": 1}, "lean_wall_s": 8.733428716659546, "lean_proc_s": 33.4263973236084, "workers": 96, "chunk": 400}
|
| 85 |
+
{"utc": "2026-10-14T23:28:26Z", "samples": 12008, "parse_fail": 4287, "distinct_checked": 7668, "lean_ok": 5946, "lean_rej": 1722, "parse_reasons": {"unbound": 2565, "expected (": 632, "no-eos": 607, "name": 178, "expected ;": 100, "formula": 83, "exact not last": 47, "expected )": 36, "ORE box": 18, "PR position": 14, "expected :=": 4, "expected None": 1, "expected =>": 1, "expected False": 1}, "lean_wall_s": 26.04431128501892, "lean_proc_s": 490.4676125049591, "workers": 96, "chunk": 400}
|
| 86 |
+
{"utc": "2026-10-14T23:29:26Z", "samples": 5280, "parse_fail": 3880, "distinct_checked": 1391, "lean_ok": 23, "lean_rej": 1368, "parse_reasons": {"unbound": 2429, "expected (": 679, "no-eos": 440, "name": 117, "expected ;": 96, "formula": 37, "exact not last": 29, "ORE box": 24, "expected )": 23, "PR position": 4, "expected False": 1, "expected :=": 1}, "lean_wall_s": 8.150237083435059, "lean_proc_s": 29.589731693267822, "workers": 96, "chunk": 400}
|
| 87 |
+
{"utc": "2026-10-14T23:30:35Z", "samples": 5256, "parse_fail": 3955, "distinct_checked": 1279, "lean_ok": 16, "lean_rej": 1263, "parse_reasons": {"unbound": 2256, "expected (": 654, "no-eos": 584, "name": 127, "formula": 113, "expected ;": 88, "exact not last": 55, "expected )": 29, "PR position": 20, "ORE box": 20, "eof": 2, "expected =>": 2, "expected exact": 2, "expected by": 1, "expected :=": 1, "expected None": 1}, "lean_wall_s": 5.370194911956787, "lean_proc_s": 17.7698917388916, "workers": 96, "chunk": 400}
|
| 88 |
+
{"utc": "2026-10-14T23:31:49Z", "samples": 5256, "parse_fail": 3876, "distinct_checked": 1367, "lean_ok": 19, "lean_rej": 1348, "parse_reasons": {"unbound": 2293, "expected (": 653, "no-eos": 498, "name": 142, "formula": 93, "expected ;": 88, "exact not last": 42, "expected )": 27, "ORE box": 18, "PR position": 8, "expected =>": 6, "expected :=": 5, "eof": 1, "expected .elim": 1, "expected None": 1}, "lean_wall_s": 7.971016883850098, "lean_proc_s": 28.035390615463257, "workers": 96, "chunk": 400}
|
| 89 |
+
{"utc": "2026-10-14T23:34:29Z", "samples": 11992, "parse_fail": 3790, "distinct_checked": 8148, "lean_ok": 5855, "lean_rej": 2293, "parse_reasons": {"unbound": 2331, "no-eos": 539, "expected (": 472, "name": 133, "expected ;": 109, "formula": 90, "exact not last": 38, "expected )": 27, "ORE box": 22, "PR position": 19, "expected :=": 7, "trailing tokens": 2, "expected None": 1}, "lean_wall_s": 27.438395738601685, "lean_proc_s": 552.4047873020172, "workers": 96, "chunk": 400}
|
| 90 |
+
{"utc": "2026-10-14T23:35:41Z", "samples": 5304, "parse_fail": 3423, "distinct_checked": 1870, "lean_ok": 10, "lean_rej": 1860, "parse_reasons": {"unbound": 2001, "no-eos": 512, "expected (": 454, "formula": 144, "name": 98, "exact not last": 68, "expected ;": 59, "PR position": 42, "expected )": 18, "ORE box": 15, "expected :=": 11, "expected None": 1}, "lean_wall_s": 11.444918632507324, "lean_proc_s": 55.42932605743408, "workers": 96, "chunk": 400}
|
| 91 |
+
{"utc": "2026-10-14T23:36:57Z", "samples": 5280, "parse_fail": 3558, "distinct_checked": 1708, "lean_ok": 5, "lean_rej": 1703, "parse_reasons": {"unbound": 2333, "expected (": 556, "no-eos": 322, "name": 115, "expected ;": 76, "formula": 68, "exact not last": 43, "expected :=": 14, "expected )": 11, "PR position": 10, "ORE box": 8, "trailing tokens": 2}, "lean_wall_s": 10.005393505096436, "lean_proc_s": 43.95264029502869, "workers": 96, "chunk": 400}
|
| 92 |
+
{"utc": "2026-10-14T23:38:00Z", "samples": 5280, "parse_fail": 3442, "distinct_checked": 1823, "lean_ok": 16, "lean_rej": 1807, "parse_reasons": {"unbound": 2270, "expected (": 443, "no-eos": 390, "name": 94, "expected ;": 94, "formula": 56, "exact not last": 41, "expected )": 25, "ORE box": 19, "PR position": 9, "expected :=": 1}, "lean_wall_s": 10.198242902755737, "lean_proc_s": 47.84011650085449, "workers": 96, "chunk": 400}
|
| 93 |
+
{"utc": "2026-10-14T23:40:45Z", "samples": 12000, "parse_fail": 4303, "distinct_checked": 7652, "lean_ok": 5637, "lean_rej": 2015, "parse_reasons": {"unbound": 2269, "no-eos": 792, "expected (": 767, "name": 156, "expected ;": 83, "formula": 82, "exact not last": 52, "ORE box": 44, "expected )": 40, "PR position": 7, "expected None": 6, "expected =>": 3, "expected :=": 2}, "lean_wall_s": 28.22787356376648, "lean_proc_s": 531.2997324466705, "workers": 96, "chunk": 400}
|
| 94 |
+
{"utc": "2026-10-14T23:42:10Z", "samples": 5568, "parse_fail": 3840, "distinct_checked": 1713, "lean_ok": 25, "lean_rej": 1688, "parse_reasons": {"unbound": 2030, "expected (": 684, "no-eos": 674, "name": 133, "formula": 120, "expected ;": 69, "expected )": 47, "exact not last": 36, "ORE box": 24, "PR position": 22, "expected None": 1}, "lean_wall_s": 9.178719997406006, "lean_proc_s": 40.04733967781067, "workers": 96, "chunk": 400}
|
| 95 |
+
{"utc": "2026-10-14T23:43:22Z", "samples": 5544, "parse_fail": 4010, "distinct_checked": 1523, "lean_ok": 17, "lean_rej": 1506, "parse_reasons": {"unbound": 2213, "no-eos": 759, "expected (": 645, "name": 154, "expected ;": 74, "formula": 66, "exact not last": 44, "expected )": 21, "ORE box": 18, "PR position": 7, "expected =>": 4, "expected :=": 3, "expected None": 1, "eof": 1}, "lean_wall_s": 9.202220678329468, "lean_proc_s": 35.99454379081726, "workers": 96, "chunk": 400}
|
| 96 |
+
{"utc": "2026-10-14T23:44:22Z", "samples": 5544, "parse_fail": 3927, "distinct_checked": 1605, "lean_ok": 22, "lean_rej": 1583, "parse_reasons": {"unbound": 2082, "expected (": 961, "no-eos": 540, "expected ;": 85, "name": 78, "formula": 52, "exact not last": 43, "ORE box": 41, "expected )": 30, "PR position": 13, "expected None": 1, "trailing tokens": 1}, "lean_wall_s": 6.972968339920044, "lean_proc_s": 27.746209383010864, "workers": 96, "chunk": 400}
|
| 97 |
+
{"utc": "2026-10-14T23:46:54Z", "samples": 12000, "parse_fail": 4342, "distinct_checked": 7612, "lean_ok": 5633, "lean_rej": 1979, "parse_reasons": {"unbound": 2408, "no-eos": 1165, "expected (": 340, "name": 146, "expected ;": 97, "formula": 91, "exact not last": 42, "expected )": 21, "ORE box": 21, "expected :=": 6, "PR position": 3, "trailing tokens": 1, "expected False": 1}, "lean_wall_s": 21.68758726119995, "lean_proc_s": 397.25827145576477, "workers": 96, "chunk": 400}
|
| 98 |
+
{"utc": "2026-10-14T23:47:53Z", "samples": 5400, "parse_fail": 3793, "distinct_checked": 1590, "lean_ok": 13, "lean_rej": 1577, "parse_reasons": {"unbound": 2161, "no-eos": 1043, "expected (": 306, "name": 127, "expected ;": 66, "exact not last": 32, "expected )": 21, "formula": 17, "expected :=": 12, "PR position": 3, "eof": 2, "ORE box": 1, "expected None": 1, "expected False": 1}, "lean_wall_s": 5.481066465377808, "lean_proc_s": 21.76059126853943, "workers": 96, "chunk": 400}
|
| 99 |
+
{"utc": "2026-10-14T23:49:05Z", "samples": 5376, "parse_fail": 3748, "distinct_checked": 1608, "lean_ok": 12, "lean_rej": 1596, "parse_reasons": {"unbound": 2165, "no-eos": 863, "expected (": 337, "formula": 112, "name": 107, "expected ;": 82, "expected )": 32, "exact not last": 31, "ORE box": 9, "PR position": 3, "expected :=": 2, "expected False": 2, "expected =>": 1, "trailing tokens": 1, "eof": 1}, "lean_wall_s": 9.260689973831177, "lean_proc_s": 37.359599590301514, "workers": 96, "chunk": 400}
|
| 100 |
+
{"utc": "2026-10-14T23:50:04Z", "samples": 5376, "parse_fail": 4044, "distinct_checked": 1321, "lean_ok": 7, "lean_rej": 1314, "parse_reasons": {"unbound": 2077, "no-eos": 1186, "expected (": 397, "formula": 117, "name": 92, "expected ;": 63, "ORE box": 48, "expected )": 28, "exact not last": 24, "PR position": 5, "expected :=": 4, "trailing tokens": 1, "expected False": 1, "expected None": 1}, "lean_wall_s": 7.012469291687012, "lean_proc_s": 24.04599165916443, "workers": 96, "chunk": 400}
|
| 101 |
+
{"utc": "2026-10-14T23:52:53Z", "samples": 12000, "parse_fail": 3730, "distinct_checked": 8216, "lean_ok": 6109, "lean_rej": 2107, "parse_reasons": {"unbound": 2025, "no-eos": 730, "expected (": 363, "expected ;": 222, "name": 188, "ORE box": 56, "exact not last": 56, "formula": 43, "expected )": 28, "expected :=": 9, "PR position": 6, "trailing tokens": 2, "expected None": 1, "expected fun": 1}, "lean_wall_s": 20.92734432220459, "lean_proc_s": 429.8534691333771, "workers": 96, "chunk": 400}
|
| 102 |
+
{"utc": "2026-10-14T23:54:09Z", "samples": 4656, "parse_fail": 3107, "distinct_checked": 1531, "lean_ok": 14, "lean_rej": 1517, "parse_reasons": {"unbound": 1514, "no-eos": 661, "expected (": 330, "expected ;": 271, "name": 153, "formula": 63, "exact not last": 51, "ORE box": 35, "expected )": 16, "PR position": 12, "trailing tokens": 1}, "lean_wall_s": 8.948055267333984, "lean_proc_s": 35.03217673301697, "workers": 96, "chunk": 400}
|
| 103 |
+
{"utc": "2026-10-14T23:55:22Z", "samples": 4656, "parse_fail": 3332, "distinct_checked": 1310, "lean_ok": 18, "lean_rej": 1292, "parse_reasons": {"unbound": 1739, "no-eos": 683, "expected (": 374, "expected ;": 176, "name": 123, "exact not last": 72, "ORE box": 67, "expected )": 38, "formula": 29, "expected :=": 21, "PR position": 6, "expected =>": 2, "expected by": 1, "trailing tokens": 1}, "lean_wall_s": 7.472456932067871, "lean_proc_s": 25.310397386550903, "workers": 96, "chunk": 400}
|
| 104 |
+
{"utc": "2026-10-14T23:56:11Z", "samples": 4632, "parse_fail": 3135, "distinct_checked": 1481, "lean_ok": 16, "lean_rej": 1465, "parse_reasons": {"unbound": 1714, "no-eos": 574, "expected (": 409, "expected ;": 146, "name": 124, "exact not last": 61, "ORE box": 54, "formula": 28, "expected )": 15, "PR position": 6, "expected :=": 2, "trailing tokens": 2}, "lean_wall_s": 6.408967971801758, "lean_proc_s": 24.126976490020752, "workers": 96, "chunk": 400}
|
| 105 |
+
{"utc": "2026-10-14T23:59:00Z", "samples": 12008, "parse_fail": 3221, "distinct_checked": 8723, "lean_ok": 6270, "lean_rej": 2453, "parse_reasons": {"unbound": 1428, "no-eos": 656, "expected (": 578, "name": 198, "expected ;": 118, "formula": 74, "expected )": 46, "ORE box": 46, "exact not last": 40, "expected :=": 13, "expected False": 8, "PR position": 8, "expected by": 4, "expected :": 2, "expected None": 2}, "lean_wall_s": 18.2634916305542, "lean_proc_s": 387.5143084526062, "workers": 96, "chunk": 400}
|
| 106 |
+
{"utc": "2026-10-14T23:59:59Z", "samples": 4584, "parse_fail": 2634, "distinct_checked": 1927, "lean_ok": 17, "lean_rej": 1910, "parse_reasons": {"unbound": 1257, "expected (": 567, "no-eos": 413, "expected ;": 132, "name": 127, "expected )": 39, "exact not last": 27, "formula": 24, "ORE box": 17, "expected :=": 15, "expected False": 8, "PR position": 6, "expected None": 1, "expected :": 1}, "lean_wall_s": 5.903587579727173, "lean_proc_s": 28.298214435577393, "workers": 96, "chunk": 400}
|
| 107 |
+
{"utc": "2026-10-15T00:01:03Z", "samples": 4584, "parse_fail": 2947, "distinct_checked": 1620, "lean_ok": 23, "lean_rej": 1597, "parse_reasons": {"unbound": 1092, "expected (": 668, "no-eos": 609, "name": 176, "expected ;": 142, "formula": 137, "expected )": 51, "exact not last": 27, "ORE box": 27, "expected False": 6, "PR position": 5, "expected :=": 2, "trailing tokens": 1, "expected by": 1, "expected None": 1, "expected :": 1, "eof": 1}, "lean_wall_s": 5.163217306137085, "lean_proc_s": 20.934664487838745, "workers": 96, "chunk": 400}
|
| 108 |
+
{"utc": "2026-10-15T00:02:01Z", "samples": 4560, "parse_fail": 2983, "distinct_checked": 1562, "lean_ok": 44, "lean_rej": 1518, "parse_reasons": {"unbound": 1312, "no-eos": 595, "expected (": 545, "name": 146, "expected ;": 104, "formula": 83, "expected )": 66, "ORE box": 46, "exact not last": 38, "PR position": 17, "expected :=": 17, "expected False": 9, "expected :": 2, "expected by": 2, "trailing tokens": 1}, "lean_wall_s": 4.731487512588501, "lean_proc_s": 18.224904775619507, "workers": 96, "chunk": 400}
|
| 109 |
+
{"utc": "2026-10-15T00:04:38Z", "samples": 11992, "parse_fail": 3474, "distinct_checked": 8476, "lean_ok": 6069, "lean_rej": 2407, "parse_reasons": {"unbound": 1690, "no-eos": 622, "expected (": 410, "name": 229, "expected ;": 206, "formula": 128, "exact not last": 65, "expected )": 58, "ORE box": 47, "PR position": 12, "expected :=": 4, "trailing tokens": 1, "expected =>": 1, "expected False": 1}, "lean_wall_s": 19.47245693206787, "lean_proc_s": 391.4880657196045, "workers": 96, "chunk": 400}
|
| 110 |
+
{"utc": "2026-10-15T00:05:46Z", "samples": 4968, "parse_fail": 3262, "distinct_checked": 1686, "lean_ok": 27, "lean_rej": 1659, "parse_reasons": {"unbound": 1656, "no-eos": 510, "expected (": 428, "expected ;": 210, "name": 165, "formula": 90, "exact not last": 85, "expected )": 71, "PR position": 23, "ORE box": 17, "expected :=": 5, "expected None": 1, "expected fun": 1}, "lean_wall_s": 5.080669641494751, "lean_proc_s": 20.755688190460205, "workers": 96, "chunk": 400}
|
| 111 |
+
{"utc": "2026-10-15T00:06:46Z", "samples": 4944, "parse_fail": 2957, "distinct_checked": 1966, "lean_ok": 23, "lean_rej": 1943, "parse_reasons": {"unbound": 1477, "no-eos": 401, "expected (": 386, "name": 196, "expected ;": 190, "formula": 115, "exact not last": 80, "ORE box": 56, "expected )": 45, "PR position": 6, "expected :=": 3, "trailing tokens": 1, "expected None": 1}, "lean_wall_s": 5.902050256729126, "lean_proc_s": 28.84299373626709, "workers": 96, "chunk": 400}
|
| 112 |
+
{"utc": "2026-10-15T00:07:44Z", "samples": 4944, "parse_fail": 3109, "distinct_checked": 1824, "lean_ok": 19, "lean_rej": 1805, "parse_reasons": {"unbound": 1505, "no-eos": 564, "expected (": 346, "name": 198, "expected ;": 159, "formula": 125, "exact not last": 94, "ORE box": 61, "expected )": 44, "PR position": 6, "expected :=": 3, "expected None": 2, "expected False": 1, "trailing tokens": 1}, "lean_wall_s": 5.635758399963379, "lean_proc_s": 26.780075550079346, "workers": 96, "chunk": 400}
|
| 113 |
+
{"utc": "2026-10-15T00:10:23Z", "samples": 11992, "parse_fail": 3892, "distinct_checked": 8056, "lean_ok": 6086, "lean_rej": 1970, "parse_reasons": {"unbound": 1607, "no-eos": 938, "expected (": 530, "name": 328, "expected ;": 229, "ORE box": 80, "formula": 68, "exact not last": 63, "expected )": 24, "expected =>": 11, "PR position": 9, "expected :=": 3, "expected fun": 1, "expected None": 1}, "lean_wall_s": 18.16406750679016, "lean_proc_s": 349.1501553058624, "workers": 96, "chunk": 400}
|
| 114 |
+
{"utc": "2026-10-15T00:11:31Z", "samples": 4848, "parse_fail": 3541, "distinct_checked": 1294, "lean_ok": 14, "lean_rej": 1280, "parse_reasons": {"unbound": 1411, "no-eos": 836, "expected (": 518, "name": 278, "expected ;": 249, "exact not last": 93, "ORE box": 80, "formula": 46, "PR position": 16, "expected )": 12, "eof": 1, "expected None": 1}, "lean_wall_s": 3.8788468837738037, "lean_proc_s": 13.191384315490723, "workers": 96, "chunk": 400}
|
| 115 |
+
{"utc": "2026-10-15T00:12:33Z", "samples": 4824, "parse_fail": 3374, "distinct_checked": 1435, "lean_ok": 15, "lean_rej": 1420, "parse_reasons": {"unbound": 1251, "no-eos": 859, "expected (": 601, "name": 257, "expected ;": 179, "exact not last": 77, "formula": 75, "ORE box": 38, "expected )": 17, "PR position": 9, "expected =>": 8, "eof": 1, "expected :=": 1, "expected None": 1}, "lean_wall_s": 4.488415956497192, "lean_proc_s": 16.302340269088745, "workers": 96, "chunk": 400}
|
| 116 |
+
{"utc": "2026-10-15T00:13:39Z", "samples": 4824, "parse_fail": 3419, "distinct_checked": 1391, "lean_ok": 18, "lean_rej": 1373, "parse_reasons": {"unbound": 1502, "no-eos": 667, "expected (": 464, "name": 278, "expected ;": 259, "ORE box": 75, "exact not last": 68, "formula": 56, "expected =>": 20, "expected )": 15, "expected :=": 7, "PR position": 4, "expected None": 2, "eof": 1, "expected False": 1}, "lean_wall_s": 4.249968528747559, "lean_proc_s": 14.994242906570435, "workers": 96, "chunk": 400}
|
| 117 |
+
{"utc": "2026-10-15T00:16:10Z", "samples": 12000, "parse_fail": 3930, "distinct_checked": 8032, "lean_ok": 6091, "lean_rej": 1941, "parse_reasons": {"unbound": 1778, "expected (": 846, "no-eos": 717, "name": 196, "expected ;": 157, "formula": 61, "ORE box": 45, "expected )": 43, "exact not last": 43, "expected :=": 27, "PR position": 15, "expected None": 1, "expected =>": 1}, "lean_wall_s": 17.432859659194946, "lean_proc_s": 337.56514286994934, "workers": 96, "chunk": 400}
|
| 118 |
+
{"utc": "2026-10-15T00:17:17Z", "samples": 4944, "parse_fail": 3503, "distinct_checked": 1427, "lean_ok": 40, "lean_rej": 1387, "parse_reasons": {"unbound": 1587, "expected (": 737, "no-eos": 689, "name": 169, "expected ;": 103, "exact not last": 48, "expected )": 43, "formula": 42, "expected :=": 38, "ORE box": 27, "PR position": 14, "expected =>": 5, "trailing tokens": 1}, "lean_wall_s": 3.9304897785186768, "lean_proc_s": 14.467235565185547, "workers": 96, "chunk": 400}
|
| 119 |
+
{"utc": "2026-10-15T00:18:23Z", "samples": 4944, "parse_fail": 3613, "distinct_checked": 1321, "lean_ok": 7, "lean_rej": 1314, "parse_reasons": {"unbound": 1657, "expected (": 876, "no-eos": 546, "expected ;": 186, "name": 120, "ORE box": 69, "expected )": 59, "formula": 39, "exact not last": 34, "PR position": 16, "expected :=": 10, "eof": 1}, "lean_wall_s": 7.763242244720459, "lean_proc_s": 25.861864805221558, "workers": 96, "chunk": 400}
|
| 120 |
+
{"utc": "2026-10-15T00:19:24Z", "samples": 4920, "parse_fail": 3524, "distinct_checked": 1380, "lean_ok": 5, "lean_rej": 1375, "parse_reasons": {"unbound": 1579, "expected (": 889, "no-eos": 572, "expected ;": 140, "name": 135, "formula": 55, "expected )": 46, "ORE box": 42, "exact not last": 40, "expected :=": 17, "PR position": 6, "expected None": 2, "expected :": 1}, "lean_wall_s": 7.401512861251831, "lean_proc_s": 26.3288893699646, "workers": 96, "chunk": 400}
|
| 121 |
+
{"utc": "2026-10-15T00:22:05Z", "samples": 12008, "parse_fail": 3967, "distinct_checked": 7998, "lean_ok": 5876, "lean_rej": 2122, "parse_reasons": {"unbound": 1884, "no-eos": 682, "expected (": 554, "name": 279, "expected ;": 231, "expected )": 91, "ORE box": 75, "formula": 65, "exact not last": 64, "expected :=": 25, "PR position": 6, "expected =>": 5, "expected None": 3, "trailing tokens": 2, "expected :": 1}, "lean_wall_s": 25.442312002182007, "lean_proc_s": 486.097288608551, "workers": 96, "chunk": 400}
|
| 122 |
+
{"utc": "2026-10-15T00:23:04Z", "samples": 5232, "parse_fail": 3690, "distinct_checked": 1530, "lean_ok": 9, "lean_rej": 1521, "parse_reasons": {"unbound": 1737, "no-eos": 537, "expected (": 500, "expected ;": 277, "name": 275, "expected )": 121, "formula": 96, "ORE box": 64, "exact not last": 60, "expected =>": 11, "expected :=": 8, "PR position": 3, "trailing tokens": 1}, "lean_wall_s": 8.78439211845398, "lean_proc_s": 34.42922878265381, "workers": 96, "chunk": 400}
|
| 123 |
+
{"utc": "2026-10-15T00:24:12Z", "samples": 5208, "parse_fail": 3580, "distinct_checked": 1613, "lean_ok": 17, "lean_rej": 1596, "parse_reasons": {"unbound": 1603, "no-eos": 667, "expected (": 550, "expected ;": 244, "name": 191, "ORE box": 84, "expected )": 79, "exact not last": 66, "expected :=": 42, "formula": 41, "PR position": 12, "trailing tokens": 1}, "lean_wall_s": 9.19103455543518, "lean_proc_s": 37.01349925994873, "workers": 96, "chunk": 400}
|
| 124 |
+
{"utc": "2026-10-15T00:25:09Z", "samples": 5208, "parse_fail": 3500, "distinct_checked": 1697, "lean_ok": 20, "lean_rej": 1677, "parse_reasons": {"unbound": 1561, "expected (": 640, "no-eos": 585, "expected ;": 214, "name": 194, "ORE box": 94, "formula": 82, "expected )": 63, "exact not last": 52, "expected :=": 9, "PR position": 4, "expected None": 2}, "lean_wall_s": 9.335307359695435, "lean_proc_s": 39.97073674201965, "workers": 96, "chunk": 400}
|
| 125 |
+
{"utc": "2026-10-15T00:27:58Z", "samples": 12000, "parse_fail": 4399, "distinct_checked": 7565, "lean_ok": 5258, "lean_rej": 2307, "parse_reasons": {"unbound": 2038, "no-eos": 906, "expected (": 544, "name": 332, "expected ;": 303, "ORE box": 75, "expected )": 67, "formula": 59, "exact not last": 55, "expected :=": 13, "PR position": 3, "trailing tokens": 2, "expected None": 1, "expected False": 1}, "lean_wall_s": 27.31391477584839, "lean_proc_s": 500.00671887397766, "workers": 96, "chunk": 400}
|
| 126 |
+
{"utc": "2026-10-15T00:29:16Z", "samples": 5832, "parse_fail": 3987, "distinct_checked": 1835, "lean_ok": 0, "lean_rej": 1835, "parse_reasons": {"unbound": 1893, "no-eos": 688, "expected (": 602, "expected ;": 275, "name": 231, "formula": 88, "ORE box": 83, "exact not last": 62, "expected )": 56, "PR position": 3, "expected False": 2, "expected None": 1, "trailing tokens": 1, "eof": 1, "expected fun": 1}, "lean_wall_s": 8.199320077896118, "lean_proc_s": 38.36645746231079, "workers": 96, "chunk": 400}
|
| 127 |
+
{"utc": "2026-10-15T00:30:17Z", "samples": 5808, "parse_fail": 4133, "distinct_checked": 1665, "lean_ok": 9, "lean_rej": 1656, "parse_reasons": {"unbound": 1878, "no-eos": 863, "expected (": 462, "name": 331, "expected ;": 310, "expected )": 80, "ORE box": 67, "formula": 55, "expected :=": 40, "exact not last": 37, "PR position": 9, "expected :": 1}, "lean_wall_s": 6.540951490402222, "lean_proc_s": 27.54715871810913, "workers": 96, "chunk": 400}
|
| 128 |
+
{"utc": "2026-10-15T00:31:11Z", "samples": 5808, "parse_fail": 3910, "distinct_checked": 1887, "lean_ok": 7, "lean_rej": 1880, "parse_reasons": {"unbound": 1868, "no-eos": 734, "expected (": 559, "name": 264, "expected ;": 262, "ORE box": 65, "expected )": 59, "exact not last": 52, "formula": 36, "PR position": 5, "trailing tokens": 3, "expected :=": 2, "expected None": 1}, "lean_wall_s": 5.5625152587890625, "lean_proc_s": 26.696044445037842, "workers": 96, "chunk": 400}
|
| 129 |
+
{"utc": "2026-10-15T00:33:48Z", "samples": 12008, "parse_fail": 4393, "distinct_checked": 7583, "lean_ok": 4824, "lean_rej": 2759, "parse_reasons": {"unbound": 2162, "no-eos": 925, "expected (": 513, "expected ;": 252, "name": 243, "ORE box": 124, "expected )": 65, "formula": 55, "exact not last": 39, "expected :=": 6, "PR position": 4, "expected None": 2, "trailing tokens": 2, "eof": 1}, "lean_wall_s": 22.022976636886597, "lean_proc_s": 393.74331045150757, "workers": 96, "chunk": 400}
|
| 130 |
+
{"utc": "2026-10-15T00:35:08Z", "samples": 6480, "parse_fail": 4129, "distinct_checked": 2318, "lean_ok": 8, "lean_rej": 2310, "parse_reasons": {"unbound": 2065, "no-eos": 770, "expected (": 546, "name": 229, "expected ;": 224, "ORE box": 91, "formula": 83, "expected )": 74, "exact not last": 40, "PR position": 4, "expected None": 3}, "lean_wall_s": 13.483702182769775, "lean_proc_s": 78.29380822181702, "workers": 96, "chunk": 400}
|
| 131 |
+
{"utc": "2026-10-15T00:36:27Z", "samples": 6456, "parse_fail": 4172, "distinct_checked": 2249, "lean_ok": 15, "lean_rej": 2234, "parse_reasons": {"unbound": 1962, "no-eos": 933, "expected (": 590, "name": 195, "expected ;": 171, "ORE box": 147, "expected )": 80, "formula": 55, "exact not last": 33, "trailing tokens": 2, "expected None": 2, "expected :=": 1, "PR position": 1}, "lean_wall_s": 13.736902952194214, "lean_proc_s": 79.39624166488647, "workers": 96, "chunk": 400}
|
| 132 |
+
{"utc": "2026-10-15T00:37:35Z", "samples": 6456, "parse_fail": 4195, "distinct_checked": 2246, "lean_ok": 30, "lean_rej": 2216, "parse_reasons": {"unbound": 2035, "no-eos": 840, "expected (": 555, "expected ;": 330, "name": 195, "ORE box": 87, "expected )": 61, "formula": 39, "exact not last": 26, "expected :=": 16, "PR position": 5, "trailing tokens": 3, "expected None": 2, "eof": 1}, "lean_wall_s": 12.598713159561157, "lean_proc_s": 73.6151647567749, "workers": 96, "chunk": 400}
|
| 133 |
+
{"utc": "2026-10-15T00:40:11Z", "samples": 12000, "parse_fail": 4630, "distinct_checked": 7334, "lean_ok": 4852, "lean_rej": 2482, "parse_reasons": {"unbound": 2099, "no-eos": 1033, "expected (": 687, "name": 268, "expected ;": 232, "formula": 81, "ORE box": 81, "expected )": 79, "exact not last": 48, "expected :=": 10, "PR position": 8, "expected None": 2, "trailing tokens": 1, "expected =>": 1}, "lean_wall_s": 25.686517238616943, "lean_proc_s": 466.3051345348358, "workers": 96, "chunk": 400}
|
| 134 |
+
{"utc": "2026-10-15T00:41:20Z", "samples": 6456, "parse_fail": 4329, "distinct_checked": 2097, "lean_ok": 14, "lean_rej": 2083, "parse_reasons": {"unbound": 1983, "no-eos": 981, "expected (": 628, "name": 269, "expected ;": 209, "expected )": 73, "formula": 70, "exact not last": 45, "ORE box": 40, "expected :=": 14, "expected =>": 8, "PR position": 5, "trailing tokens": 3, "expected None": 1}, "lean_wall_s": 11.179348707199097, "lean_proc_s": 59.45811080932617, "workers": 96, "chunk": 400}
|
| 135 |
+
{"utc": "2026-10-15T00:42:22Z", "samples": 6432, "parse_fail": 4294, "distinct_checked": 2118, "lean_ok": 5, "lean_rej": 2113, "parse_reasons": {"unbound": 1975, "no-eos": 926, "expected (": 689, "expected ;": 246, "name": 176, "ORE box": 76, "expected )": 71, "formula": 59, "exact not last": 51, "PR position": 10, "expected :=": 9, "expected =>": 3, "eof": 1, "expected None": 1, "trailing tokens": 1}, "lean_wall_s": 11.213017225265503, "lean_proc_s": 60.79178333282471, "workers": 96, "chunk": 400}
|
| 136 |
+
{"utc": "2026-10-15T00:43:22Z", "samples": 6432, "parse_fail": 4313, "distinct_checked": 2101, "lean_ok": 13, "lean_rej": 2088, "parse_reasons": {"unbound": 1892, "no-eos": 954, "expected (": 689, "name": 229, "expected ;": 214, "ORE box": 157, "expected )": 69, "formula": 53, "exact not last": 39, "PR position": 6, "expected =>": 3, "trailing tokens": 3, "expected None": 2, "expected :=": 2, "eof": 1}, "lean_wall_s": 12.182616472244263, "lean_proc_s": 64.64125847816467, "workers": 96, "chunk": 400}
|
| 137 |
+
{"utc": "2026-10-15T00:58:29Z", "samples": 53952, "parse_fail": 35409, "distinct_checked": 17748, "lean_ok": 9408, "lean_rej": 8340, "parse_reasons": {"unbound": 11737, "no-eos": 9457, "formula": 3140, "expected ;": 3120, "expected (": 3069, "exact not last": 1393, "expected :=": 1190, "name": 1086, "expected )": 932, "ORE box": 129, "PR position": 107, "expected =>": 31, "eof": 8, "expected None": 5, "expected .elim": 3, "expected exact": 1, "trailing tokens": 1}, "lean_wall_s": 61.2165093421936, "lean_proc_s": 2604.172245502472, "workers": 96, "chunk": 400}
|
| 138 |
+
{"utc": "2026-10-15T00:59:52Z", "samples": 17728, "parse_fail": 4194, "distinct_checked": 13370, "lean_ok": 10327, "lean_rej": 3043, "parse_reasons": {"unbound": 2288, "no-eos": 767, "name": 425, "expected (": 310, "expected )": 125, "ORE box": 112, "expected ;": 89, "formula": 62, "exact not last": 11, "expected =>": 3, "expected None": 2}, "lean_wall_s": 36.99132418632507, "lean_proc_s": 1226.18110704422, "workers": 96, "chunk": 400}
|
runs/long-rl-20261014-v4_untied-ei_s1/pretrain.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2a984ddd291a2babd7daffd1b21067fcef1b7d4d645e81561e941ec568a993bf
|
| 3 |
+
size 38588451
|
runs/long-rl-20261014-v4_untied-ei_s1/rl_round_005.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a25f885377972885d63bd1d8b348da18f9acd9a6f0648ead239bbcf3900712f7
|
| 3 |
+
size 38584655
|
runs/long-rl-20261014-v4_untied-ei_s1/rl_round_010.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fdcdf8959d65be043e74813ed93060bf214497cd50d2b68f3a775f07688fac88
|
| 3 |
+
size 38584655
|
runs/long-rl-20261014-v4_untied-ei_s1/rl_round_015.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:64072dbaa03dfd7697fd920c841bc6c67dacf7c59c11e1354d295c212b98f1ec
|
| 3 |
+
size 38584655
|
runs/long-rl-20261014-v4_untied-ei_s1/rl_round_020.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fd7a1d77f7487da783f0c0b6d6701c38260e2a73b1cbc4261d7832fb0c4d423f
|
| 3 |
+
size 38584655
|
runs/long-rl-20261014-v4_untied-ei_s1/rl_round_025.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8782b0c3280bafc598b42bf7c53274cc697c225ca6effc0a92ddc899d39cda65
|
| 3 |
+
size 38584655
|
runs/long-rl-20261014-v4_untied-ei_s1/rl_round_030.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1d3a791eef116c53e897a51b78c2111c2542e3ca8d0f722627c459f6c6476b21
|
| 3 |
+
size 38584655
|
runs/long-rl-20261014-v4_untied-ei_s1/source/harness.py
ADDED
|
@@ -0,0 +1,437 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
# imports the fork (model, tokenizer, train, ...), which is not resolvable here
|
| 3 |
+
# pyright: reportMissingImports=false
|
| 4 |
+
"""Harness for long_rl_20261014: pretrain on <= 6 body lines, then RL on the long-proofs set (body 7 to ~45).
|
| 5 |
+
|
| 6 |
+
Forked from the test-time-loops harness (autoresearch_loops/harness.py, sha 2eec1b61666a, the one run 590 and 512 were
|
| 7 |
+
scored with). What changed (Robbie, 2026-10-14):
|
| 8 |
+
|
| 9 |
+
- Lean is the only checker: overlay/lean_gate.py, and a sample counts iff Lean accepts its literal text. nd_verify is
|
| 10 |
+
never called; the decoded ND proof is used only to count lines.
|
| 11 |
+
- Length is body lines (proof lines after the premise block) everywhere: bands, L*, the pretraining cap.
|
| 12 |
+
- Tokenizer: overlay/lean_tok.py (ten atoms, ten premises, 160 names). The overlay directory is first on sys.path.
|
| 13 |
+
- Data (make_data.py): pretraining = Dan's cap-6 file with distractor premises; RL targets / dev / holdout = the
|
| 14 |
+
long-proofs set, band-capped. The old transfer dev pool is evaluated too (EVAL_K_OLD samples), to catch forgetting.
|
| 15 |
+
- The oracle also returns every rollout (token ids and the Lean verdict) for the GRPO arm: sample_rollouts().
|
| 16 |
+
- Sampling batch size follows the model's KV-cache depth (model.kv_layers()), so 8-loop sampling fits an A40.
|
| 17 |
+
|
| 18 |
+
1. pretrain.pretrain(train_recs, PRETRAIN_SECS, ...) -> (model, tok, stats), charged for everything
|
| 19 |
+
2. checks: params <= PARAM_CAP, tok.mode == TOK_MODE, model has an integer KNOB
|
| 20 |
+
3. pretrain.rl(model, tok, targets, train_recs, oracle, RL_SECS, ...): the arm's RL. RL_SECS is wall-clock inside rl()
|
| 21 |
+
minus Lean-gate time.
|
| 22 |
+
4. eval: dev (long-proofs set) with EVAL_K samples at EVAL_LEVEL, by band; old transfer dev with EVAL_K_OLD samples
|
| 23 |
+
5. SIGALRM at TOTAL_SECS
|
| 24 |
+
|
| 25 |
+
python3 harness.py --out artifacts/x [--seed 0] # on the pod (remote.sh)
|
| 26 |
+
ND_FORK=... python3 harness.py --out /tmp/smoke --smoke # CPU plumbing check with real Lean
|
| 27 |
+
"""
|
| 28 |
+
|
| 29 |
+
import argparse
|
| 30 |
+
import collections
|
| 31 |
+
import gzip
|
| 32 |
+
import hashlib
|
| 33 |
+
import importlib
|
| 34 |
+
import json
|
| 35 |
+
import os
|
| 36 |
+
import random
|
| 37 |
+
import shutil
|
| 38 |
+
import signal
|
| 39 |
+
import sys
|
| 40 |
+
import time
|
| 41 |
+
import traceback
|
| 42 |
+
from pathlib import Path
|
| 43 |
+
|
| 44 |
+
HERE = os.path.dirname(os.path.abspath(__file__))
|
| 45 |
+
FORK = os.environ.get("ND_FORK", "/workspace/nd-takehome")
|
| 46 |
+
DATA = os.environ.get("ND_DATA", os.path.join(HERE, "data"))
|
| 47 |
+
# overlay first (tokenizer, Lean-only gate), then the fork (model, sample, train), then this directory (pretrain.py)
|
| 48 |
+
sys.path[:0] = [os.path.join(HERE, "overlay"), FORK, HERE]
|
| 49 |
+
import importlib.util # noqa: E402
|
| 50 |
+
|
| 51 |
+
import torch # noqa: E402
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
def _overlay(name):
|
| 55 |
+
"""Load overlay/<name>.py under the module name the fork imports. Fork modules put the fork directory at
|
| 56 |
+
sys.path[0] whenever they are imported (nd2lean does, inside lean_tok), so path order alone is not enough:
|
| 57 |
+
registering the module in sys.modules first is what makes every later `import lean_tok` get the overlay."""
|
| 58 |
+
spec = importlib.util.spec_from_file_location(name, os.path.join(HERE, "overlay", f"{name}.py"))
|
| 59 |
+
mod = importlib.util.module_from_spec(spec)
|
| 60 |
+
sys.modules[name] = mod
|
| 61 |
+
spec.loader.exec_module(mod)
|
| 62 |
+
return mod
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
_overlay("lean_tok")
|
| 66 |
+
gate = _overlay("lean_gate").gate
|
| 67 |
+
from eval_set import wilson # noqa: E402 (fork; wilson interval only)
|
| 68 |
+
from nd_verify.verify import parse_proof_tokens # noqa: E402 (a parser: line counts only, never a verdict)
|
| 69 |
+
from sample import generate_ids # noqa: E402 (fork)
|
| 70 |
+
|
| 71 |
+
# ---------------------------------------------------------------- the rules
|
| 72 |
+
TOTAL_SECS = int(os.environ.get("ND_TOTAL_SECS", 6.5 * 3600)) # RL_SECS excludes Lean-gate time (~80 s a round)
|
| 73 |
+
PRETRAIN_SECS = 600 # Dan's file with distractors is ~1.6x the tokens of the plain cap-6 file
|
| 74 |
+
PRETRAIN_GRACE = 30
|
| 75 |
+
RL_SECS = int(os.environ.get("ND_RL_SECS", 3 * 3600))
|
| 76 |
+
RL_GRACE = 120
|
| 77 |
+
PARAM_CAP = 10_000_000
|
| 78 |
+
TEMP = 0.8
|
| 79 |
+
MAX_NEW = 2304 # proof tokens: approach E's 80-line references run to ~1,900; checked against the pools at load
|
| 80 |
+
KV_TOKENS = 1024 * 6 * 1700 # sampling batch * KV layers * tokens: 6 layers x 1,024 x 1,700 is ~16 GB of bf16 KV
|
| 81 |
+
EVAL_K, EVAL_K_OLD = 64, 16
|
| 82 |
+
KNOB = "n_loops"
|
| 83 |
+
EVAL_LEVEL, DIAG_LEVEL = int(os.environ.get("ND_EVAL_LEVEL", 8)), 2
|
| 84 |
+
TOK_MODE = "lean_seq"
|
| 85 |
+
BANDS = ((0, 6), (7, 9), (10, 14), (15, 19), (20, 24), (25, 34), (35, 49), (50, 200))
|
| 86 |
+
DEV = "cuda" if torch.cuda.is_available() else "cpu"
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
def read(fn):
|
| 90 |
+
op = gzip.open if fn.endswith(".gz") else open
|
| 91 |
+
return [json.loads(line) for line in op(fn, "rt") if line.strip()]
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
def log(msg):
|
| 95 |
+
print(f"[{time.strftime('%H:%M:%S')}] {msg}", flush=True)
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
def sha(fn):
|
| 99 |
+
return hashlib.sha256(open(fn, "rb").read()).hexdigest()[:12]
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
def band(body):
|
| 103 |
+
return next(f"{lo}-{hi}" if hi < 200 else f"{lo}+" for lo, hi in BANDS if lo <= body <= hi)
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
class Timeout(Exception):
|
| 107 |
+
pass
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
class BudgetSpent(Timeout):
|
| 111 |
+
pass
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
# ---------------------------------------------------------------- sampling and judging
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
def body_lines(nd):
|
| 118 |
+
"""(written body lines, pruned body lines) of a decoded ND proof: lines after the premise block, and those the
|
| 119 |
+
last line depends on through citations (a box rule cites the box's first and last lines, so the closure keeps a
|
| 120 |
+
needed box's hypothesis and every line its conclusion depends on)."""
|
| 121 |
+
lines = parse_proof_tokens(nd.split())
|
| 122 |
+
by = {ln["idx"]: ln for ln in lines}
|
| 123 |
+
need, todo = set(), [lines[-1]["idx"]]
|
| 124 |
+
while todo:
|
| 125 |
+
i = todo.pop()
|
| 126 |
+
if i not in need:
|
| 127 |
+
need.add(i)
|
| 128 |
+
todo += by[i]["refs"]
|
| 129 |
+
body = [ln for ln in lines if ln["rule"] != "PR"]
|
| 130 |
+
return len(body), sum(1 for ln in body if ln["idx"] in need)
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
def kv_batch(model, n_tokens):
|
| 134 |
+
layers = model.kv_layers() if hasattr(model, "kv_layers") else len(model.blocks)
|
| 135 |
+
return max(32, min(1024, KV_TOKENS // (layers * n_tokens)))
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
def new_tokens(body, max_new):
|
| 139 |
+
"""Sampling cap for a target of `body` lines: reference proofs run up to ~23 tokens per body line (16 for most), so
|
| 140 |
+
64 + 30 per line leaves >= 1.3x room, and a sample rambling without <eos> no longer holds a whole batch to max_new.
|
| 141 |
+
Rounded up to a multiple of 128 so that a few caps group the samples into full batches."""
|
| 142 |
+
return min(max_new, -(-(64 + 30 * body) // 128) * 128)
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
def sample(model, tok, recs, k, seed, max_new):
|
| 146 |
+
"""k samples per record at temperature TEMP. Returns per record a list of (ids, decoded ND proof, accepted)."""
|
| 147 |
+
prompts = [r["prompt"] for r in recs for _ in range(k)]
|
| 148 |
+
caps = [new_tokens(r["body"], max_new) for r in recs for _ in range(k)]
|
| 149 |
+
ids = [tok.encode_prompt(p) for p in prompts]
|
| 150 |
+
gen = torch.Generator(device=DEV)
|
| 151 |
+
gen.manual_seed(seed)
|
| 152 |
+
outs, nds, texts = [None] * len(prompts), [None] * len(prompts), [None] * len(prompts)
|
| 153 |
+
for cap in sorted(set(caps)):
|
| 154 |
+
order = sorted((i for i in range(len(prompts)) if caps[i] == cap), key=lambda i: len(ids[i]))
|
| 155 |
+
batch = kv_batch(model, len(ids[order[-1]]) + cap)
|
| 156 |
+
for s in range(0, len(order), batch):
|
| 157 |
+
chunk = order[s : s + batch]
|
| 158 |
+
with torch.autocast("cuda", dtype=torch.bfloat16, enabled=(DEV == "cuda")):
|
| 159 |
+
res = generate_ids(model, tok, [ids[i] for i in chunk], False, TEMP, cap, gen)
|
| 160 |
+
for i, o in zip(chunk, res, strict=True):
|
| 161 |
+
o = o[: o.index(tok.eos) + 1] if tok.eos in o else o
|
| 162 |
+
outs[i], nds[i], texts[i] = o, tok.decode(o), tok.last_text
|
| 163 |
+
if DEV == "cuda":
|
| 164 |
+
torch.cuda.empty_cache()
|
| 165 |
+
gated = gate(tok, prompts, nds, texts)
|
| 166 |
+
flat = [(o, nd, not nd.startswith("LEAN")) for o, nd in zip(outs, gated, strict=True)]
|
| 167 |
+
return [flat[i * k : (i + 1) * k] for i in range(len(recs))]
|
| 168 |
+
|
| 169 |
+
|
| 170 |
+
def judge(recs, per):
|
| 171 |
+
rows = []
|
| 172 |
+
for r, samples in zip(recs, per, strict=True):
|
| 173 |
+
good = {}
|
| 174 |
+
for _, nd, ok in samples:
|
| 175 |
+
if ok and nd not in good:
|
| 176 |
+
good[nd] = body_lines(nd)
|
| 177 |
+
rows.append({"name": r["name"], "body": r["body"], "solved": bool(good), "n_ok": sum(ok for *_, ok in samples),
|
| 178 |
+
"n_tried": len(samples), "proofs": list(good), "written": [w for w, _ in good.values()],
|
| 179 |
+
"pruned": [p for _, p in good.values()]})
|
| 180 |
+
return rows
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
def lstar(solved, recs, need=5):
|
| 184 |
+
ls = [r["body"] for r in recs if r["name"] in solved]
|
| 185 |
+
ge = {L: sum(1 for x in ls if x >= L) for L in range(7, 81)}
|
| 186 |
+
return max([L for L, c in ge.items() if c >= need], default=0), ge
|
| 187 |
+
|
| 188 |
+
|
| 189 |
+
def by_band(solved, recs):
|
| 190 |
+
by = collections.defaultdict(lambda: [0, 0])
|
| 191 |
+
for r in recs:
|
| 192 |
+
by[band(r["body"])][0] += r["name"] in solved
|
| 193 |
+
by[band(r["body"])][1] += 1
|
| 194 |
+
return {b: {"solved": k, "n": n, "rate": k / n, "ci": list(wilson(k, n))} for b, (k, n) in sorted(by.items())}
|
| 195 |
+
|
| 196 |
+
|
| 197 |
+
def gate_seconds():
|
| 198 |
+
fn = os.environ.get("LEAN_GATE_LOG")
|
| 199 |
+
return sum(r["lean_wall_s"] for r in read(fn)) if fn and os.path.exists(fn) else 0.0
|
| 200 |
+
|
| 201 |
+
|
| 202 |
+
# ---------------------------------------------------------------- the RL oracle
|
| 203 |
+
|
| 204 |
+
|
| 205 |
+
class Oracle:
|
| 206 |
+
"""What rl() gets instead of data: the model's own attempts at the RL targets, judged by Lean."""
|
| 207 |
+
|
| 208 |
+
def __init__(self, a, tok, targets):
|
| 209 |
+
self.a, self.tok = a, tok
|
| 210 |
+
self.targets = {t["name"]: t for t in targets}
|
| 211 |
+
self.found = collections.defaultdict(dict) # name -> {proof text: {written, pruned, round}}
|
| 212 |
+
self.calls = []
|
| 213 |
+
self.t0 = self.last = time.time()
|
| 214 |
+
self.uncharged = 0.0
|
| 215 |
+
|
| 216 |
+
def used(self):
|
| 217 |
+
return time.time() - self.t0 - self.uncharged
|
| 218 |
+
|
| 219 |
+
def left(self):
|
| 220 |
+
return self.a.rl_secs - self.used()
|
| 221 |
+
|
| 222 |
+
def _sample(self, model, targets, k):
|
| 223 |
+
if self.left() <= 0:
|
| 224 |
+
raise BudgetSpent(f"oracle called with {self.used():.0f}s of {self.a.rl_secs}s used")
|
| 225 |
+
recs = [self.targets[t["name"]] for t in targets]
|
| 226 |
+
call = len(self.calls) + 1
|
| 227 |
+
model.eval()
|
| 228 |
+
t0, g0 = time.time(), gate_seconds()
|
| 229 |
+
per = sample(model, self.tok, recs, k, self.a.seed * 100_000 + call, self.a.max_new)
|
| 230 |
+
secs, gate_s = time.time() - t0, gate_seconds() - g0
|
| 231 |
+
self.uncharged += gate_s
|
| 232 |
+
rows = judge(recs, per)
|
| 233 |
+
new = 0
|
| 234 |
+
for t, row in zip(recs, rows, strict=True):
|
| 235 |
+
for p, w, pl in zip(row["proofs"], row["written"], row["pruned"], strict=True):
|
| 236 |
+
if p not in self.found[t["name"]]:
|
| 237 |
+
self.found[t["name"]][p] = {"written": w, "pruned": pl, "round": call}
|
| 238 |
+
new += 1
|
| 239 |
+
solved = {n for n, d in self.found.items() if d}
|
| 240 |
+
ls, _ = lstar(solved, list(self.targets.values()))
|
| 241 |
+
n = len(recs) * k
|
| 242 |
+
self.calls.append({"round": call, "level": getattr(model, KNOB, None), "k": k, "n_targets": len(recs),
|
| 243 |
+
"sample_acc": sum(x["n_ok"] for x in rows) / max(n, 1), "new_proofs": new,
|
| 244 |
+
"targets_solved": len(solved), "lstar": ls,
|
| 245 |
+
"solved_by_band": {b: v["solved"] for b, v in by_band(solved, list(self.targets.values())).items()},
|
| 246 |
+
"sampling": {"samples": n, "secs": secs, "gate_secs": gate_s},
|
| 247 |
+
"secs": time.time() - self.last, "rl_secs_used": self.used()})
|
| 248 |
+
self.last = time.time()
|
| 249 |
+
c = self.calls[-1]
|
| 250 |
+
log(f"oracle {call}: acc {c['sample_acc']:.4f}, +{new} proofs, solved {len(solved)}/{len(self.targets)}, "
|
| 251 |
+
f"L*={ls}, {KNOB} {c['level']}, {len(recs)} targets x {k}, {n / secs:.0f} samples/s, "
|
| 252 |
+
f"RL clock {c['rl_secs_used']:.0f}/{self.a.rl_secs}s")
|
| 253 |
+
return recs, per, rows
|
| 254 |
+
|
| 255 |
+
def sample(self, model, targets, k):
|
| 256 |
+
"""k attempts per target. Returns per target {name, prompt, body, proofs (distinct Lean-accepted ND proofs),
|
| 257 |
+
n_ok, n_tried}. Raises BudgetSpent once the budget is used up."""
|
| 258 |
+
recs, _, rows = self._sample(model, targets, k)
|
| 259 |
+
return [{"name": t["name"], "prompt": t["prompt"], "body": t["body"], "proofs": row["proofs"],
|
| 260 |
+
"n_ok": row["n_ok"], "n_tried": row["n_tried"]} for t, row in zip(recs, rows, strict=True)]
|
| 261 |
+
|
| 262 |
+
def sample_rollouts(self, model, targets, k):
|
| 263 |
+
"""As sample(), plus `rollouts`: every attempt's proof token ids (eos included when the model ended it) and
|
| 264 |
+
its Lean verdict, for policy-gradient RL."""
|
| 265 |
+
recs, per, rows = self._sample(model, targets, k)
|
| 266 |
+
return [{"name": t["name"], "prompt": t["prompt"], "body": t["body"], "proofs": row["proofs"],
|
| 267 |
+
"n_ok": row["n_ok"], "n_tried": row["n_tried"], "rollouts": [(o, ok) for o, _, ok in samples]}
|
| 268 |
+
for t, row, samples in zip(recs, rows, per, strict=True)]
|
| 269 |
+
|
| 270 |
+
|
| 271 |
+
# ---------------------------------------------------------------- stages
|
| 272 |
+
|
| 273 |
+
|
| 274 |
+
def stage_rl(a, agent, tok, model, targets, train_recs, dev):
|
| 275 |
+
oracle = Oracle(a, tok, targets)
|
| 276 |
+
oracle.gold = dev # gold dev proofs, for the RL probes' likelihood only; never trained on
|
| 277 |
+
visible = [{"name": t["name"], "prompt": t["prompt"], "body": t["body"], "band": t["band"]} for t in targets]
|
| 278 |
+
stats = agent.rl(model, tok, visible, train_recs, oracle, a.rl_secs, DEV, a.seed, log)
|
| 279 |
+
if DEV == "cuda":
|
| 280 |
+
torch.cuda.synchronize()
|
| 281 |
+
model.eval()
|
| 282 |
+
with open(f"{a.out}/found_targets.jsonl", "w") as f:
|
| 283 |
+
for t in targets:
|
| 284 |
+
for p, x in oracle.found[t["name"]].items():
|
| 285 |
+
f.write(json.dumps({"name": t["name"], "prompt": t["prompt"], "body": t["body"], "proof": p, **x}) + "\n")
|
| 286 |
+
used = oracle.used()
|
| 287 |
+
log(f"rl returned: {used:.0f}s of {a.rl_secs}s charged, {oracle.uncharged:.0f}s Lean gate")
|
| 288 |
+
return {"rounds": oracle.calls, "secs": time.time() - oracle.t0, "rl_secs_used": used,
|
| 289 |
+
"gate_secs": oracle.uncharged, "targets": len(targets), "stats": dict(stats or {})}
|
| 290 |
+
|
| 291 |
+
|
| 292 |
+
def eval_pool(a, tok, model, pool, k, level, tag):
|
| 293 |
+
setattr(model, KNOB, level)
|
| 294 |
+
model.eval()
|
| 295 |
+
t0 = time.time()
|
| 296 |
+
rows = judge(pool, sample(model, tok, pool, k, a.seed * 100_000 + 7777, a.max_new))
|
| 297 |
+
solved = {r["name"] for r in rows if r["solved"]}
|
| 298 |
+
ls, _ = lstar(solved, pool)
|
| 299 |
+
out = {"level": level, "k": k, "solved": len(solved), "n": len(pool), "lstar": ls, "by_band": by_band(solved, pool),
|
| 300 |
+
"sample_acc": sum(r["n_ok"] for r in rows) / max(k * len(pool), 1),
|
| 301 |
+
"max_pruned": max((max(r["pruned"]) for r in rows if r["solved"]), default=0), "secs": time.time() - t0}
|
| 302 |
+
with open(f"{a.out}/eval_{tag}.jsonl", "w") as f:
|
| 303 |
+
for r in rows:
|
| 304 |
+
f.write(json.dumps(r) + "\n")
|
| 305 |
+
log(f"eval {tag} at {KNOB} {level}: solved {len(solved)}/{len(pool)}, L*={ls}, "
|
| 306 |
+
f"by band { {b: v['solved'] for b, v in out['by_band'].items()} }, {out['secs']:.0f}s")
|
| 307 |
+
return out
|
| 308 |
+
|
| 309 |
+
|
| 310 |
+
def stage_eval(a, tok, model, dev_pool, old_dev):
|
| 311 |
+
out = {"dev": eval_pool(a, tok, model, dev_pool, a.eval_k, a.eval_level, "dev")}
|
| 312 |
+
out["old_dev"] = eval_pool(a, tok, model, old_dev, a.eval_k_old, a.eval_level, "old_dev")
|
| 313 |
+
if not getattr(model, "untied", False):
|
| 314 |
+
out["dev_diag"] = eval_pool(a, tok, model, dev_pool, a.eval_k, a.diag_level, "dev_diag")
|
| 315 |
+
setattr(model, KNOB, a.eval_level)
|
| 316 |
+
return out
|
| 317 |
+
|
| 318 |
+
|
| 319 |
+
def write_summary(a, status, **kw):
|
| 320 |
+
s = {"status": status, "metric": kw.get("eval", {}).get("dev", {}).get("solved"),
|
| 321 |
+
"metric_old_dev": kw.get("eval", {}).get("old_dev", {}).get("solved"),
|
| 322 |
+
"metric_rl": (kw.get("rl", {}).get("rounds") or [{}])[-1].get("targets_solved"),
|
| 323 |
+
"arm": {k: os.environ.get(k) for k in ("ND_ARCH", "ND_RL")}, "harness_sha": sha(f"{HERE}/harness.py"),
|
| 324 |
+
"pretrain_sha": sha(f"{HERE}/pretrain.py"), "device": DEV,
|
| 325 |
+
"gpu": torch.cuda.get_device_name(0) if DEV == "cuda" else "cpu", "torch": torch.__version__,
|
| 326 |
+
"total_secs": time.time() - a.T0,
|
| 327 |
+
"rules": {k: globals()[k] for k in ("TOTAL_SECS", "PRETRAIN_SECS", "RL_SECS", "PARAM_CAP", "MAX_NEW",
|
| 328 |
+
"EVAL_K", "EVAL_K_OLD", "EVAL_LEVEL", "DIAG_LEVEL", "TOK_MODE")},
|
| 329 |
+
**kw}
|
| 330 |
+
with open(f"{a.out}/summary.json", "w") as f:
|
| 331 |
+
json.dump(s, f, indent=1)
|
| 332 |
+
log(f"SUMMARY status={status} metric={s['metric']} old_dev={s['metric_old_dev']} metric_rl={s['metric_rl']} "
|
| 333 |
+
f"total {s['total_secs']:.0f}s")
|
| 334 |
+
return s
|
| 335 |
+
|
| 336 |
+
|
| 337 |
+
def save_checkpoint(a, model, tok, stage):
|
| 338 |
+
path = Path(a.out) / f"{stage}.pt"
|
| 339 |
+
pending = path.with_suffix(".pt.tmp")
|
| 340 |
+
try:
|
| 341 |
+
torch.save({"state": model.state_dict(), "tok_mode": tok.mode, "stage": stage, "seed": a.seed,
|
| 342 |
+
"arm": {k: os.environ.get(k) for k in ("ND_ARCH", "ND_RL")},
|
| 343 |
+
"harness_sha": sha(f"{HERE}/harness.py"), "pretrain_sha": sha(f"{HERE}/pretrain.py")}, pending)
|
| 344 |
+
os.replace(pending, path)
|
| 345 |
+
finally:
|
| 346 |
+
pending.unlink(missing_ok=True)
|
| 347 |
+
|
| 348 |
+
|
| 349 |
+
def load_pools(a):
|
| 350 |
+
train = read(f"{DATA}/pretrain.jsonl.gz")
|
| 351 |
+
assert all(r["body"] <= 6 for r in train), "pretraining file violates the 6-body-line cap"
|
| 352 |
+
targets, dev = read(f"{DATA}/rl.jsonl"), read(f"{DATA}/dev.jsonl")
|
| 353 |
+
old = [r for r in read(f"{FORK}/data/ladder/transfer.jsonl")
|
| 354 |
+
if int(hashlib.sha1(r["key"].encode()).hexdigest(), 16) % 2 == 0] # the loops harness's dev half
|
| 355 |
+
old = [{**r, "body": r["n_lines"] - r["n_prem"]} for r in old]
|
| 356 |
+
tk, dk, pk = ({r["key"] for r in xs} for xs in (targets, dev, train))
|
| 357 |
+
assert not (tk & dk) and not (tk & pk) and not (dk & pk), "theorem leak between pools"
|
| 358 |
+
if a.smoke:
|
| 359 |
+
rng = random.Random(0)
|
| 360 |
+
train = train[:3000]
|
| 361 |
+
targets, dev, old = rng.sample(targets, 12), rng.sample(dev, 6), old[:6]
|
| 362 |
+
return train, targets, dev, old
|
| 363 |
+
|
| 364 |
+
|
| 365 |
+
def main():
|
| 366 |
+
ap = argparse.ArgumentParser()
|
| 367 |
+
ap.add_argument("--out", required=True)
|
| 368 |
+
ap.add_argument("--seed", type=int, default=0)
|
| 369 |
+
ap.add_argument("--pretrain-only", action="store_true")
|
| 370 |
+
ap.add_argument("--smoke", action="store_true", help="tiny everything, for a CPU plumbing check")
|
| 371 |
+
a = ap.parse_args()
|
| 372 |
+
a.pretrain_secs, a.rl_secs, a.eval_k, a.eval_k_old, a.max_new = PRETRAIN_SECS, RL_SECS, EVAL_K, EVAL_K_OLD, MAX_NEW
|
| 373 |
+
a.eval_level, a.diag_level = EVAL_LEVEL, DIAG_LEVEL
|
| 374 |
+
if a.smoke:
|
| 375 |
+
a.pretrain_secs, a.rl_secs, a.eval_k, a.eval_k_old, a.max_new = 20, 60, 2, 2, 160
|
| 376 |
+
os.makedirs(a.out, exist_ok=True)
|
| 377 |
+
src = Path(a.out) / "source"
|
| 378 |
+
src.mkdir(exist_ok=True)
|
| 379 |
+
for fn in ("pretrain.py", "harness.py", "remote.sh", "overlay/lean_tok.py", "overlay/lean_gate.py"):
|
| 380 |
+
shutil.copy2(Path(HERE) / fn, src / os.path.basename(fn))
|
| 381 |
+
a.T0 = time.time()
|
| 382 |
+
torch.manual_seed(a.seed)
|
| 383 |
+
|
| 384 |
+
def on_alarm(signum, frame):
|
| 385 |
+
raise Timeout()
|
| 386 |
+
|
| 387 |
+
signal.signal(signal.SIGALRM, on_alarm)
|
| 388 |
+
signal.alarm(TOTAL_SECS if not a.smoke else 1800)
|
| 389 |
+
train, targets, dev, old = load_pools(a)
|
| 390 |
+
agent = importlib.import_module("pretrain")
|
| 391 |
+
assert getattr(agent, "GRPO_TEMP", TEMP) == TEMP, "GRPO must score the distribution it samples from"
|
| 392 |
+
for name in ("lean_tok", "lean_gate"): # the Lean-only gate and the widened tokenizer, nothing from the fork
|
| 393 |
+
assert os.path.dirname(sys.modules[name].__file__) == os.path.join(HERE, "overlay"), sys.modules[name].__file__
|
| 394 |
+
log(f"pools: pretrain {len(train):,}, RL targets {len(targets):,}, dev {len(dev)}, old dev {len(old)}; "
|
| 395 |
+
f"arm {os.environ.get('ND_ARCH')}/{os.environ.get('ND_RL')}; device {DEV}; "
|
| 396 |
+
f"harness {sha(f'{HERE}/harness.py')} pretrain {sha(f'{HERE}/pretrain.py')}")
|
| 397 |
+
pre = {}
|
| 398 |
+
try:
|
| 399 |
+
t0 = time.time()
|
| 400 |
+
model, tok, pre = agent.pretrain(train, a.pretrain_secs, DEV, a.seed, log)
|
| 401 |
+
if DEV == "cuda":
|
| 402 |
+
torch.cuda.synchronize()
|
| 403 |
+
pre = dict(pre or {})
|
| 404 |
+
pre["secs"] = time.time() - t0
|
| 405 |
+
model.eval()
|
| 406 |
+
pre["n_params"] = n_params = sum(p.numel() for p in model.parameters())
|
| 407 |
+
longest = max(len(tok.encode_proof(r["proof"])) for r in targets + dev if r.get("proof")) # ladder: none
|
| 408 |
+
pre["longest_reference_tokens"] = longest
|
| 409 |
+
log(f"pretrain returned after {pre['secs']:.0f}s (budget {a.pretrain_secs}s), {n_params:,} params; "
|
| 410 |
+
f"longest reference proof {longest} tokens, MAX_NEW {a.max_new}")
|
| 411 |
+
assert longest <= a.max_new or a.smoke, f"a reference proof ({longest} tokens) exceeds MAX_NEW"
|
| 412 |
+
if pre["secs"] > a.pretrain_secs + PRETRAIN_GRACE and not a.smoke:
|
| 413 |
+
return write_summary(a, "timeout", pretrain=pre, reason="pretrain overran its budget")
|
| 414 |
+
if tok.mode != TOK_MODE or n_params > PARAM_CAP or not isinstance(getattr(model, KNOB, None), int):
|
| 415 |
+
return write_summary(a, "crash", pretrain=pre, reason="tok mode, param cap or knob check failed")
|
| 416 |
+
save_checkpoint(a, model, tok, "pretrain")
|
| 417 |
+
if a.pretrain_only:
|
| 418 |
+
return write_summary(a, "ok", stage="pretrain_only", pretrain=pre)
|
| 419 |
+
rl = stage_rl(a, agent, tok, model, targets, train, dev)
|
| 420 |
+
if rl["rl_secs_used"] > a.rl_secs + RL_GRACE and not a.smoke:
|
| 421 |
+
return write_summary(a, "timeout", pretrain=pre, rl=rl, reason="rl overran its budget")
|
| 422 |
+
save_checkpoint(a, model, tok, "final")
|
| 423 |
+
ev = stage_eval(a, tok, model, dev, old)
|
| 424 |
+
write_summary(a, "ok", pretrain=pre, rl=rl, eval=ev)
|
| 425 |
+
except BudgetSpent as e:
|
| 426 |
+
write_summary(a, "timeout", pretrain=pre, reason=f"rl: {e}")
|
| 427 |
+
except Timeout:
|
| 428 |
+
write_summary(a, "timeout", pretrain=pre, reason=f"exceeded TOTAL_SECS={TOTAL_SECS}")
|
| 429 |
+
except Exception:
|
| 430 |
+
traceback.print_exc()
|
| 431 |
+
write_summary(a, "crash", pretrain=pre, reason=traceback.format_exc()[-2000:])
|
| 432 |
+
finally:
|
| 433 |
+
signal.alarm(0)
|
| 434 |
+
|
| 435 |
+
|
| 436 |
+
if __name__ == "__main__":
|
| 437 |
+
main()
|
runs/long-rl-20261014-v4_untied-ei_s1/source/lean_gate.py
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Lean as the ONLY checker (long_rl_20261014 overlay on the fork's lean_gate.py at 51604b3).
|
| 2 |
+
|
| 3 |
+
gate(tok, prompts, nd_proofs, texts) is called by sample.generate() for a LeanTokenizer. For every distinct
|
| 4 |
+
(prompt, literal Lean text) whose text parsed in the strict grammar it asks Lean (core) whether the literal text proves the
|
| 5 |
+
theorem, and returns the ND proofs with 'LEANREJ ' prefixed where Lean rejects. Unlike the fork's gate there is no
|
| 6 |
+
nd_verify: a sample counts iff Lean accepts it (Robbie, 2026-10-14). The ND proof returned is only the decoder's rendering,
|
| 7 |
+
used for line counts. lean_check() below is the fork's, unchanged.
|
| 8 |
+
|
| 9 |
+
Log: $LEAN_GATE_LOG (default artifacts/lean_gate.jsonl), one json line per generate() call.
|
| 10 |
+
"""
|
| 11 |
+
import os, re, sys, json, time, subprocess, tempfile, shutil, collections
|
| 12 |
+
from concurrent.futures import ThreadPoolExecutor
|
| 13 |
+
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
| 14 |
+
|
| 15 |
+
LEAN = os.path.expanduser('~/.elan/bin/lean')
|
| 16 |
+
CHUNK = int(os.environ.get('LEAN_GATE_CHUNK', '400'))
|
| 17 |
+
WORKERS = int(os.environ.get('LEAN_GATE_WORKERS', str(max(1, (os.cpu_count() or 2) // 2))))
|
| 18 |
+
ERR = re.compile(r'^[^\n]*?:(\d+):\d+: error', re.M)
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def _run(lines, workdir, tag, depth=0):
|
| 22 |
+
"""lines: list of one-line theorem sources -> (list of bool, cpu seconds)"""
|
| 23 |
+
fn = os.path.join(workdir, f'c_{tag}.lean')
|
| 24 |
+
with open(fn, 'w') as f:
|
| 25 |
+
f.write('set_option linter.unusedVariables false\n' + '\n'.join(lines) + '\n')
|
| 26 |
+
t0 = time.time()
|
| 27 |
+
try:
|
| 28 |
+
p = subprocess.run([LEAN, '-DmaxErrors=100000000', fn], capture_output=True, text=True, timeout=60 + 2 * len(lines))
|
| 29 |
+
o = p.stdout + p.stderr; rc = p.returncode
|
| 30 |
+
except subprocess.TimeoutExpired:
|
| 31 |
+
o = ''; rc = -9
|
| 32 |
+
cpu = time.time() - t0
|
| 33 |
+
os.remove(fn)
|
| 34 |
+
bad = {int(m.group(1)) - 2 for m in ERR.finditer(o)}
|
| 35 |
+
crashed = rc not in (0, 1) or (rc == 1 and not bad) or any(b < 0 or b >= len(lines) for b in bad)
|
| 36 |
+
if crashed:
|
| 37 |
+
if len(lines) == 1:
|
| 38 |
+
return [False], cpu
|
| 39 |
+
h = len(lines) // 2
|
| 40 |
+
a, ca = _run(lines[:h], workdir, tag + 'a', depth + 1); b, cb = _run(lines[h:], workdir, tag + 'b', depth + 1)
|
| 41 |
+
return a + b, cpu + ca + cb
|
| 42 |
+
return [k not in bad for k in range(len(lines))], cpu
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
def lean_check(items):
|
| 46 |
+
"""items: list of (statement text, tactic text) -> (list of bool, wall seconds, summed process seconds)"""
|
| 47 |
+
if not items:
|
| 48 |
+
return [], 0.0, 0.0
|
| 49 |
+
lines = [f'{s.replace("theorem t ", f"theorem t{k} ", 1)} {b}' for k, (s, b) in enumerate(items)]
|
| 50 |
+
wd = tempfile.mkdtemp(prefix='leangate_')
|
| 51 |
+
t0 = time.time()
|
| 52 |
+
chunks = [(lines[i:i + CHUNK], i) for i in range(0, len(lines), CHUNK)]
|
| 53 |
+
with ThreadPoolExecutor(WORKERS) as ex:
|
| 54 |
+
res = list(ex.map(lambda c: _run(c[0], wd, str(c[1])), chunks))
|
| 55 |
+
shutil.rmtree(wd, ignore_errors=True)
|
| 56 |
+
ok = [x for r, _ in res for x in r]
|
| 57 |
+
return ok, time.time() - t0, sum(c for _, c in res)
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
def gate(tok, prompts, nd_proofs, texts):
|
| 61 |
+
logfn = os.environ.get('LEAN_GATE_LOG', 'artifacts/lean_gate.jsonl')
|
| 62 |
+
keys = {}
|
| 63 |
+
for p, nd, tx in zip(prompts, nd_proofs, texts):
|
| 64 |
+
if tx is not None and not nd.startswith('LEANPARSE'):
|
| 65 |
+
keys.setdefault((p, tx), nd)
|
| 66 |
+
items = list(keys)
|
| 67 |
+
lean_ok, wall, cpu = lean_check([(tok.statement(p), tx) for p, tx in items])
|
| 68 |
+
verdict = dict(zip(items, lean_ok))
|
| 69 |
+
n_parse = sum(1 for nd in nd_proofs if nd.startswith('LEANPARSE'))
|
| 70 |
+
parse_reasons = collections.Counter(nd[10:] for nd in nd_proofs if nd.startswith('LEANPARSE'))
|
| 71 |
+
n_ok = sum(map(bool, lean_ok))
|
| 72 |
+
rec = {'utc': time.strftime('%FT%TZ', time.gmtime()), 'samples': len(prompts), 'parse_fail': n_parse,
|
| 73 |
+
'distinct_checked': len(items), 'lean_ok': n_ok, 'lean_rej': len(items) - n_ok,
|
| 74 |
+
'parse_reasons': dict(parse_reasons.most_common()), 'lean_wall_s': wall, 'lean_proc_s': cpu,
|
| 75 |
+
'workers': WORKERS, 'chunk': CHUNK}
|
| 76 |
+
os.makedirs(os.path.dirname(logfn) or '.', exist_ok=True)
|
| 77 |
+
with open(logfn, 'a') as f:
|
| 78 |
+
f.write(json.dumps(rec) + '\n')
|
| 79 |
+
print(f'[lean_gate] {len(prompts)} samples, parse-fail {n_parse}, distinct checked {len(items)}: lean ok {n_ok}; '
|
| 80 |
+
f'lean {wall:.1f}s wall ({cpu:.1f}s proc, {WORKERS} workers)', flush=True)
|
| 81 |
+
return [nd if tx is None or nd.startswith('LEANPARSE') or verdict[(p, tx)] else 'LEANREJ ' + nd
|
| 82 |
+
for p, nd, tx in zip(prompts, nd_proofs, texts)]
|
runs/long-rl-20261014-v4_untied-ei_s1/source/lean_tok.py
ADDED
|
@@ -0,0 +1,319 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Lean 4 as the training surface form for the from-scratch model (run lean-format, proposal 8). One symbol per token.
|
| 2 |
+
|
| 3 |
+
The text the model reads and writes is the nd2lean.py rendering of an ND proof, linearised on one line with `;` between
|
| 4 |
+
tactics (no indentation tokens):
|
| 5 |
+
|
| 6 |
+
prompt : theorem t ( P Q R S : Prop ) ( h1 : F1 ) ... : C := by
|
| 7 |
+
proof : have n1 : F1 := h1 ; have n7 : ( P → R ) := ( fun ( n3 : P ) => by have n4 : Q := n1 n3 ; exact n4 ) ; exact n7 <eos>
|
| 8 |
+
|
| 9 |
+
Terms (exactly nd2lean's): PR `hK`; R `nA`; ANDI `⟨ nA , nB ⟩`; ANDE `nA .1|.2`; IMPE / NEGE `nF nA`; ORI `Or.inl|Or.inr nA`;
|
| 10 |
+
BOTE `False.elim nA` (tokens `False` `.elim` `nA`; was `nA .elim` before the 2026-09-22 fix, see nd2lean.py); DN `Classical.byContradiction ( fun hh => nA hh )`; IMPI `( fun ( nS : A ) => by ... ; exact nE )`;
|
| 11 |
+
NEGI the same ending `exact ( nE : False )`; ORE `Or.elim nJ <box> <box>`. `.1 .2 .elim` are glued to the name in the text.
|
| 12 |
+
|
| 13 |
+
Hypothesis names are LABELS, not line indices. 64 name tokens n1..n64; two naming schemes (stored in the ckpt as the mode):
|
| 14 |
+
lean_rand : every training presentation draws a random injective map names -> n1..n64 (names carry no order)
|
| 15 |
+
lean_seq : names are numbered in order of first appearance in the Lean text, plus a random start offset
|
| 16 |
+
(the analogue of the token format's `abs` start-index shift)
|
| 17 |
+
decode() parses the sampled tokens with the strict grammar above and returns the ND proof (spec.md format, N1..) it
|
| 18 |
+
denotes — the "nd2lean inverse" — so nd_verify, prune, normalize and every analysis script work unchanged; a sample
|
| 19 |
+
outside the grammar decodes to 'LEANPARSE <reason>' (rejected by nd_verify). The literal Lean text of the last decoded
|
| 20 |
+
sample is kept in `last_text` and is what lean_gate.py sends to Lean.
|
| 21 |
+
"""
|
| 22 |
+
import random, sys, os
|
| 23 |
+
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
| 24 |
+
from nd_verify.verify import parse_proof_tokens, parse_formula
|
| 25 |
+
from nd2lean import parse_prompt, translate
|
| 26 |
+
|
| 27 |
+
# long_rl_20261014 overlay (on the fork's lean_tok.py at 51604b3): ten atoms (no V, which reads as
|
| 28 |
+
# `v`), up to ten premises (h1..h10), 160 names, and a statement header that declares all ten atoms,
|
| 29 |
+
# so random atom relabelling (tok.atom_ids, HEADER_LEN; pretrain.py's gpu_batch) never touches it.
|
| 30 |
+
ATOMS = ['P', 'Q', 'R', 'S', 'T', 'U', 'W', 'X', 'Y', 'Z']
|
| 31 |
+
sys.modules['nd_verify.verify'].ATOM_NAMES.update(ATOMS) # the ND parsers (formula syntax only; proofs are judged by Lean)
|
| 32 |
+
MAXN = 160
|
| 33 |
+
MAXH = 10
|
| 34 |
+
FSYMS = ['(', ')', '¬', '∧', '∨', '→'] + ATOMS + ['False']
|
| 35 |
+
HEADER_LEN = len(['theorem', 't', '(']) + len(ATOMS) + len([':', 'Prop', ')'])
|
| 36 |
+
PSYMS = ['theorem', 't', ':', 'Prop', ':=', 'by']
|
| 37 |
+
TSYMS = ['have', 'exact', ';', 'fun', '=>', '⟨', '⟩', ',', '.1', '.2', '.elim', 'Or.inl', 'Or.inr', 'Or.elim', 'Classical.byContradiction', 'hh']
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
class ParseFail(Exception):
|
| 41 |
+
pass
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
def ftoks(f):
|
| 45 |
+
"""formula tuple -> Lean tokens (fully parenthesised, as nd2lean.lf)"""
|
| 46 |
+
t = f[0]
|
| 47 |
+
if t == 'atom': return [f[1]]
|
| 48 |
+
if t == 'bot': return ['False']
|
| 49 |
+
if t == 'not': return ['(', '¬'] + ftoks(f[1]) + [')']
|
| 50 |
+
op = {'and': '∧', 'or': '∨', 'imp': '→'}[t]
|
| 51 |
+
return ['('] + ftoks(f[1]) + [op] + ftoks(f[2]) + [')']
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
def fnd(f):
|
| 55 |
+
"""formula tuple -> ND tokens (spec.md)"""
|
| 56 |
+
t = f[0]
|
| 57 |
+
if t == 'atom': return f[1]
|
| 58 |
+
if t == 'bot': return 'F'
|
| 59 |
+
if t == 'not': return f'( ~ {fnd(f[1])} )'
|
| 60 |
+
op = {'and': '&', 'or': 'v', 'imp': '>'}[t]
|
| 61 |
+
return f'( {fnd(f[1])} {op} {fnd(f[2])} )'
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
def prompt_tokens(prompt):
|
| 65 |
+
prem, concl = parse_prompt(prompt)
|
| 66 |
+
if len(prem) > MAXH:
|
| 67 |
+
raise ValueError('too many premises')
|
| 68 |
+
out = ['theorem', 't', '('] + ATOMS + [':', 'Prop', ')']
|
| 69 |
+
for j, p in enumerate(prem):
|
| 70 |
+
out += ['(', f'h{j+1}', ':'] + ftoks(p) + [')']
|
| 71 |
+
return out + [':'] + ftoks(concl) + [':=', 'by']
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
def proof_tokens(proof):
|
| 75 |
+
"""ND proof body -> Lean tokens with names as ('n', ND index). Mirrors nd2lean.translate (which must have accepted
|
| 76 |
+
the proof); a closed box that no rule cites is dropped, as in nd2lean."""
|
| 77 |
+
lines = parse_proof_tokens(proof.split())
|
| 78 |
+
stack = [[]] # token lists of the open boxes' statements; stack[0] = top level
|
| 79 |
+
hyp = [None] # (idx, formula) of each open box
|
| 80 |
+
last = [None]
|
| 81 |
+
closed = {} # start idx -> (hyp formula, stmts tokens, last idx)
|
| 82 |
+
n_pr = 0
|
| 83 |
+
|
| 84 |
+
def close():
|
| 85 |
+
s = stack.pop(); h = hyp.pop(); l = last.pop()
|
| 86 |
+
closed[h[0]] = (h[1], s, l)
|
| 87 |
+
|
| 88 |
+
def box(s, e, neg=False):
|
| 89 |
+
hf, st, l = closed[s]
|
| 90 |
+
assert l == e, 'box cite'
|
| 91 |
+
ex = ['exact', '(', ('n', e), ':', 'False', ')'] if neg else ['exact', ('n', e)]
|
| 92 |
+
return ['(', 'fun', '(', ('n', s), ':'] + ftoks(hf) + [')', '=>', 'by'] + st + ex + [')']
|
| 93 |
+
|
| 94 |
+
for ln in lines:
|
| 95 |
+
i, d, f, rule, refs = ln['idx'], ln['depth'], ln['formula'], ln['rule'], ln['refs']
|
| 96 |
+
if rule == 'AS':
|
| 97 |
+
while len(stack) - 1 >= d: close()
|
| 98 |
+
stack.append([]); hyp.append((i, f)); last.append(i)
|
| 99 |
+
continue
|
| 100 |
+
while len(stack) - 1 > d: close()
|
| 101 |
+
n = lambda j: ('n', j)
|
| 102 |
+
if rule == 'PR': n_pr += 1; term = [f'h{n_pr}']
|
| 103 |
+
elif rule == 'R': term = [n(refs[0])]
|
| 104 |
+
elif rule == 'ANDI': term = ['⟨', n(refs[0]), ',', n(refs[1]), '⟩']
|
| 105 |
+
elif rule == 'ANDE1': term = [n(refs[0]), '.1']
|
| 106 |
+
elif rule == 'ANDE2': term = [n(refs[0]), '.2']
|
| 107 |
+
elif rule == 'IMPE': term = [n(refs[0]), n(refs[1])]
|
| 108 |
+
elif rule == 'NEGE': term = [n(refs[1]), n(refs[0])]
|
| 109 |
+
elif rule == 'ORI1': term = ['Or.inl', n(refs[0])]
|
| 110 |
+
elif rule == 'ORI2': term = ['Or.inr', n(refs[0])]
|
| 111 |
+
elif rule == 'BOTE': term = ['False', '.elim', n(refs[0])]
|
| 112 |
+
elif rule == 'DN': term = ['Classical.byContradiction', '(', 'fun', 'hh', '=>', n(refs[0]), 'hh', ')']
|
| 113 |
+
elif rule == 'IMPI': term = box(refs[0], refs[1])
|
| 114 |
+
elif rule == 'NEGI': term = box(refs[0], refs[1], neg=True)
|
| 115 |
+
elif rule == 'ORE': term = ['Or.elim', n(refs[0])] + box(refs[1], refs[2]) + box(refs[3], refs[4])
|
| 116 |
+
else: raise ValueError(rule)
|
| 117 |
+
stack[-1] += ['have', n(i), ':'] + ftoks(f) + [':='] + term + [';']
|
| 118 |
+
last[-1] = i
|
| 119 |
+
assert len(stack) == 1
|
| 120 |
+
return stack[0] + ['exact', ('n', lines[-1]['idx'])]
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
class LeanTokenizer:
|
| 124 |
+
def __init__(self, mode='lean_rand'):
|
| 125 |
+
assert mode in ('lean_rand', 'lean_seq')
|
| 126 |
+
self.mode = mode
|
| 127 |
+
self.itos = ['<pad>', '<eos>'] + FSYMS + PSYMS + TSYMS + [f'h{k}' for k in range(1, MAXH + 1)]
|
| 128 |
+
self.ref0 = len(self.itos)
|
| 129 |
+
self.itos += [f'n{k}' for k in range(1, MAXN + 1)]
|
| 130 |
+
self.stoi = {s: i for i, s in enumerate(self.itos)}
|
| 131 |
+
self.atom_ids = [self.stoi[x] for x in ATOMS]
|
| 132 |
+
self.pad, self.eos = 0, 1
|
| 133 |
+
self.shift = True
|
| 134 |
+
self.last_text = None
|
| 135 |
+
|
| 136 |
+
@property
|
| 137 |
+
def vocab_size(self):
|
| 138 |
+
return len(self.itos)
|
| 139 |
+
|
| 140 |
+
def encode_prompt(self, prompt):
|
| 141 |
+
return [self.stoi[t] for t in prompt_tokens(prompt)]
|
| 142 |
+
|
| 143 |
+
def encode_proof(self, body):
|
| 144 |
+
"""ND body -> ids with names numbered by first appearance (n1, n2, ...); <eos> included."""
|
| 145 |
+
order = {}
|
| 146 |
+
out = []
|
| 147 |
+
for t in proof_tokens(body):
|
| 148 |
+
if isinstance(t, tuple):
|
| 149 |
+
k = order.setdefault(t[1], len(order) + 1)
|
| 150 |
+
if k > MAXN: raise ValueError('too many names')
|
| 151 |
+
out.append(self.ref0 + k - 1)
|
| 152 |
+
else:
|
| 153 |
+
out.append(self.stoi[t])
|
| 154 |
+
return out + [self.eos]
|
| 155 |
+
|
| 156 |
+
def shift_abs(self, ids, rng):
|
| 157 |
+
"""name augmentation (the interface name is train.py's)."""
|
| 158 |
+
if not self.shift:
|
| 159 |
+
return ids
|
| 160 |
+
mx = max((x - self.ref0 + 1 for x in ids if x >= self.ref0), default=0)
|
| 161 |
+
if mx == 0:
|
| 162 |
+
return ids
|
| 163 |
+
if self.mode == 'lean_seq':
|
| 164 |
+
s = rng.randint(0, MAXN - mx)
|
| 165 |
+
return [x + s if x >= self.ref0 else x for x in ids]
|
| 166 |
+
perm = rng.sample(range(MAXN), mx)
|
| 167 |
+
return [self.ref0 + perm[x - self.ref0] if x >= self.ref0 else x for x in ids]
|
| 168 |
+
|
| 169 |
+
# ---- text ----
|
| 170 |
+
def text(self, toks):
|
| 171 |
+
"""tokens (strings) -> Lean source text of the tactic block (one line)."""
|
| 172 |
+
out = []
|
| 173 |
+
for t in toks:
|
| 174 |
+
if t in ('.1', '.2', '.elim') and out:
|
| 175 |
+
out[-1] += t
|
| 176 |
+
else:
|
| 177 |
+
out.append(t)
|
| 178 |
+
return ' '.join(out)
|
| 179 |
+
|
| 180 |
+
def statement(self, prompt):
|
| 181 |
+
return ' '.join(prompt_tokens(prompt))
|
| 182 |
+
|
| 183 |
+
def lean_source(self, prompt, proof):
|
| 184 |
+
"""(statement, tactic text) Lean checks for an ND proof: exactly what the model would write."""
|
| 185 |
+
return self.statement(prompt), self.text([self.itos[x] for x in self.encode_proof(proof)[:-1]])
|
| 186 |
+
|
| 187 |
+
# ---- inverse ----
|
| 188 |
+
def decode(self, ids):
|
| 189 |
+
toks = []
|
| 190 |
+
ended = False
|
| 191 |
+
for x in ids:
|
| 192 |
+
if x == self.pad: continue
|
| 193 |
+
if x == self.eos: ended = True; break
|
| 194 |
+
toks.append(self.itos[x])
|
| 195 |
+
self.last_text = self.text(toks) if ended else None
|
| 196 |
+
if not ended:
|
| 197 |
+
return 'LEANPARSE no-eos'
|
| 198 |
+
try:
|
| 199 |
+
return inverse(toks)
|
| 200 |
+
except ParseFail as e:
|
| 201 |
+
return f'LEANPARSE {e}'
|
| 202 |
+
|
| 203 |
+
|
| 204 |
+
def inverse(toks):
|
| 205 |
+
"""Lean tokens (strict nd2lean grammar) -> ND proof body 'N1 ... ; ... QED'. Names resolve lexically (latest binding wins,
|
| 206 |
+
as in Lean). Raises ParseFail outside the grammar: PR lines first and in order, a box's `exact` cites the box's last line,
|
| 207 |
+
the final `exact` cites the last top-level line."""
|
| 208 |
+
pos = [0]
|
| 209 |
+
out = [] # ND lines (strings)
|
| 210 |
+
forms = {} # ND idx -> formula tuple
|
| 211 |
+
n_pr = [0]; seen_non_pr = [False]
|
| 212 |
+
|
| 213 |
+
def peek():
|
| 214 |
+
return toks[pos[0]] if pos[0] < len(toks) else None
|
| 215 |
+
|
| 216 |
+
def eat(x=None):
|
| 217 |
+
t = peek()
|
| 218 |
+
if t is None or (x is not None and t != x):
|
| 219 |
+
raise ParseFail(f'expected {x}')
|
| 220 |
+
pos[0] += 1
|
| 221 |
+
return t
|
| 222 |
+
|
| 223 |
+
def name_tok():
|
| 224 |
+
t = eat()
|
| 225 |
+
if not (t[0] == 'n' and t[1:].isdigit()):
|
| 226 |
+
raise ParseFail('name')
|
| 227 |
+
return t
|
| 228 |
+
|
| 229 |
+
def formula():
|
| 230 |
+
# re-use the ND formula parser on a token-mapped slice
|
| 231 |
+
m = {'(': '(', ')': ')', '¬': '~', '∧': '&', '∨': 'v', '→': '>', 'False': 'F', **{a: a for a in ATOMS}}
|
| 232 |
+
j = pos[0]; nd = []
|
| 233 |
+
while j < len(toks) and toks[j] in m:
|
| 234 |
+
nd.append(m[toks[j]]); j += 1
|
| 235 |
+
try:
|
| 236 |
+
f, used = parse_formula(nd + ['$'], 0)
|
| 237 |
+
except Exception:
|
| 238 |
+
raise ParseFail('formula')
|
| 239 |
+
pos[0] += used
|
| 240 |
+
return f
|
| 241 |
+
|
| 242 |
+
def ref(scope):
|
| 243 |
+
t = name_tok()
|
| 244 |
+
if t not in scope:
|
| 245 |
+
raise ParseFail('unbound')
|
| 246 |
+
return scope[t]
|
| 247 |
+
|
| 248 |
+
def emit(depth, f, rule, refs):
|
| 249 |
+
i = len(out) + 1
|
| 250 |
+
out.append(f'N{i} ' + '| ' * depth + f'{fnd(f)} : {rule}' + ''.join(f' N{r}' for r in refs) + ' ;')
|
| 251 |
+
forms[i] = f
|
| 252 |
+
return i
|
| 253 |
+
|
| 254 |
+
def box(scope, depth):
|
| 255 |
+
"""'( fun ( n : A ) => by stmts exact .. )' -> (start idx, end idx, neg)"""
|
| 256 |
+
eat('('); eat('fun'); eat('('); nm = name_tok(); eat(':'); hf = formula(); eat(')'); eat('=>'); eat('by')
|
| 257 |
+
s = emit(depth + 1, hf, 'AS', [])
|
| 258 |
+
sc = dict(scope); sc[nm] = s
|
| 259 |
+
lastl = stmts(sc, depth + 1, s)
|
| 260 |
+
eat('exact')
|
| 261 |
+
if peek() == '(':
|
| 262 |
+
eat('('); e = ref(sc); eat(':'); eat('False'); eat(')'); neg = True
|
| 263 |
+
else:
|
| 264 |
+
e = ref(sc); neg = False
|
| 265 |
+
if e != lastl:
|
| 266 |
+
raise ParseFail('exact not last')
|
| 267 |
+
eat(')')
|
| 268 |
+
return s, e, neg
|
| 269 |
+
|
| 270 |
+
def stmts(scope, depth, lastl):
|
| 271 |
+
while peek() == 'have':
|
| 272 |
+
eat('have'); nm = name_tok(); eat(':'); f = formula(); eat(':=')
|
| 273 |
+
t = peek()
|
| 274 |
+
if t is None: raise ParseFail('eof')
|
| 275 |
+
if t[0] == 'h' and t[1:].isdigit():
|
| 276 |
+
eat(); k = int(t[1:])
|
| 277 |
+
if depth != 0 or seen_non_pr[0] or k != n_pr[0] + 1: raise ParseFail('PR position')
|
| 278 |
+
n_pr[0] += 1
|
| 279 |
+
i = emit(0, f, 'PR', [])
|
| 280 |
+
else:
|
| 281 |
+
seen_non_pr[0] = True
|
| 282 |
+
if t == '⟨':
|
| 283 |
+
eat(); a = ref(scope); eat(','); b = ref(scope); eat('⟩'); rule, refs, pre = 'ANDI', [a, b], None
|
| 284 |
+
elif t in ('Or.inl', 'Or.inr'):
|
| 285 |
+
eat(); a = ref(scope); rule, refs = ('ORI1' if t == 'Or.inl' else 'ORI2'), [a]
|
| 286 |
+
elif t == 'Classical.byContradiction':
|
| 287 |
+
eat(); eat('('); eat('fun'); eat('hh'); eat('=>'); a = ref(scope); eat('hh'); eat(')'); rule, refs = 'DN', [a]
|
| 288 |
+
elif t == '(':
|
| 289 |
+
s, e, neg = box(scope, depth); rule, refs = ('NEGI' if neg else 'IMPI'), [s, e]
|
| 290 |
+
elif t == 'Or.elim':
|
| 291 |
+
eat(); j = ref(scope); s1, e1, g1 = box(scope, depth); s2, e2, g2 = box(scope, depth)
|
| 292 |
+
if g1 or g2: raise ParseFail('ORE box')
|
| 293 |
+
rule, refs = 'ORE', [j, s1, e1, s2, e2]
|
| 294 |
+
elif t == 'False':
|
| 295 |
+
eat(); eat('.elim'); a = ref(scope); rule, refs = 'BOTE', [a]
|
| 296 |
+
else:
|
| 297 |
+
a = ref(scope); t2 = peek()
|
| 298 |
+
if t2 == '.1': eat(); rule, refs = 'ANDE1', [a]
|
| 299 |
+
elif t2 == '.2': eat(); rule, refs = 'ANDE2', [a]
|
| 300 |
+
elif t2 == ';': rule, refs = 'R', [a]
|
| 301 |
+
else:
|
| 302 |
+
b = ref(scope)
|
| 303 |
+
if forms[a][0] == 'not': rule, refs = 'NEGE', [b, a]
|
| 304 |
+
else: rule, refs = 'IMPE', [a, b]
|
| 305 |
+
i = emit(depth, f, rule, refs)
|
| 306 |
+
eat(';')
|
| 307 |
+
scope[nm] = i
|
| 308 |
+
lastl = i
|
| 309 |
+
return lastl
|
| 310 |
+
|
| 311 |
+
top = {}
|
| 312 |
+
lastl = stmts(top, 0, None)
|
| 313 |
+
eat('exact')
|
| 314 |
+
e = ref(top)
|
| 315 |
+
if pos[0] != len(toks):
|
| 316 |
+
raise ParseFail('trailing tokens')
|
| 317 |
+
if lastl is None or e != lastl:
|
| 318 |
+
raise ParseFail('exact not last')
|
| 319 |
+
return ' '.join(out) + ' QED'
|
runs/long-rl-20261014-v4_untied-ei_s1/source/pretrain.py
ADDED
|
@@ -0,0 +1,948 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# imports the fork (model, tokenizer, train, ...), which is not resolvable here
|
| 2 |
+
# pyright: reportMissingImports=false
|
| 3 |
+
"""long_rl_20261014: run 512's file (autoresearch_loops ae79d23, the final RL recipe: 507 token-budget fine-tune
|
| 4 |
+
batches, 509 Muon fine-tune, 510 more and shorter rounds) with three arms picked by environment variables:
|
| 5 |
+
|
| 6 |
+
ND_ARCH=untied ND_RL=ei A: run 198's untied six blocks (control 590's patch) + the final expert-iteration recipe
|
| 7 |
+
ND_ARCH=looped ND_RL=ei B: 512's looped trunk (two alternating shared core pairs) + the same recipe
|
| 8 |
+
ND_ARCH=untied ND_RL=grpo C: run 198's untied blocks + GRPO with a found-proof pool (rl_grpo)
|
| 9 |
+
|
| 10 |
+
Changes for this experiment, all arms:
|
| 11 |
+
- tokenizer: overlay/lean_tok.py (ten atoms, ten premises h1..h10, names n1..n160)
|
| 12 |
+
- random atom relabelling: every training batch maps each row's atoms through a random permutation of the ten
|
| 13 |
+
atom tokens (gpu_batch), after the fixed statement header; the analogue of the name-offset shift
|
| 14 |
+
- targets are picked per round by body-line band, weighted toward the frontier (pick_targets), from a pool of
|
| 15 |
+
thousands instead of a fixed 1,500
|
| 16 |
+
|
| 17 |
+
The original contract (harness.py's docstring describes this experiment's changes to it):
|
| 18 |
+
|
| 19 |
+
Contract with harness.py (frozen):
|
| 20 |
+
|
| 21 |
+
pretrain(train_recs, budget_secs, device, seed, log) -> (model, tok, stats)
|
| 22 |
+
|
| 23 |
+
train_recs list of dicts {prompt, proof, n_lines<=6, key, ...}; the frozen cap-6 Stage-1 data
|
| 24 |
+
budget_secs wall-clock you are charged for, from call to return, INCLUDING model construction
|
| 25 |
+
and torch.compile. Overrun by more than the harness grace -> the run is a timeout.
|
| 26 |
+
model nn.Module; <= PARAM_CAP unique params (checked again after rl). The harness samples
|
| 27 |
+
from it with the fork's sample.generate, so it must provide:
|
| 28 |
+
- forward(idx) -> logits (B,T,V) and forward(idx, pos=, mask=, caches=) with a
|
| 29 |
+
per-block KV cache dict, exactly like the fork's GPT (model.blocks must exist)
|
| 30 |
+
- an integer `n_loops` (the harness's KNOB): the loop count applied in eval
|
| 31 |
+
mode. The harness sets it to EVAL_LEVEL for the scored eval and to DIAG_LEVEL
|
| 32 |
+
for the diagnostic one.
|
| 33 |
+
tok must provide encode_prompt, encode_proof, decode, shift_abs, pad, eos, mode, and
|
| 34 |
+
mode must be "lean_seq" (harness TOK_MODE): Lean text in and out, Lean-gated samples.
|
| 35 |
+
Decoder rule: decode() is deterministic and single-pass; it may not call the
|
| 36 |
+
verifier or try alternatives.
|
| 37 |
+
stats dict recorded in summary.json and copied into results.json. MUST contain `curve`:
|
| 38 |
+
a list of {secs, step, train_loss, val_loss} taken every ~CURVE_EVERY seconds
|
| 39 |
+
(see log_point below), so a run's trajectory survives in git. Add anything else.
|
| 40 |
+
val_loss is on VAL_N records held out from train_recs by this file; keep that.
|
| 41 |
+
|
| 42 |
+
rl(model, tok, targets, train_recs, oracle, budget_secs, device, seed, log) -> stats | None
|
| 43 |
+
|
| 44 |
+
targets list of dicts {name, prompt, n_lines}: the 1,500 RL target statements. No proofs.
|
| 45 |
+
oracle oracle.sample(model, targets_subset, k, temperature=0.8, batch=1024) samples k
|
| 46 |
+
attempts per target from the model in eval mode at its current n_loops, and returns
|
| 47 |
+
per target {name, prompt, n_lines, proofs, n_ok, n_tried}; `proofs` are the distinct
|
| 48 |
+
attempts Lean AND nd_verify accepted. This is the only source of new training data.
|
| 49 |
+
oracle.used() / oracle.left(): seconds of the RL budget charged / remaining.
|
| 50 |
+
budget_secs RL_SECS: wall-clock inside rl() minus the oracle's Lean-gate time. Returning more
|
| 51 |
+
than the grace late, or calling the oracle with nothing left, is a timeout.
|
| 52 |
+
The model is trained in place. Everything else about RL is yours: rounds, samples per target,
|
| 53 |
+
loop counts when sampling, which proofs to keep, weighting, replay, optimizer, loss.
|
| 54 |
+
|
| 55 |
+
Anything imported from the fork (ND_FORK) is fair game to copy in here and modify.
|
| 56 |
+
"""
|
| 57 |
+
|
| 58 |
+
import collections
|
| 59 |
+
import copy
|
| 60 |
+
import math
|
| 61 |
+
import os
|
| 62 |
+
import random
|
| 63 |
+
import time
|
| 64 |
+
|
| 65 |
+
import torch
|
| 66 |
+
import torch._inductor.config # noqa: F401 (explicit, so the attribute resolves for pyright)
|
| 67 |
+
from lean_tok import HEADER_LEN, MAXN # overlay
|
| 68 |
+
from model import GPT, Block # fork
|
| 69 |
+
from normalize import norm # fork
|
| 70 |
+
from tokenizer import make_tokenizer # fork
|
| 71 |
+
from train import loss_on # fork
|
| 72 |
+
|
| 73 |
+
# ---- knobs
|
| 74 |
+
# Unique blocks: one untied entry block, N_PAIRS pairs of N_CORE shared core blocks that the loops
|
| 75 |
+
# cycle through (loop k applies pair k % N_PAIRS, so 8 loops run A B A B A B A B and 2 loops run
|
| 76 |
+
# A B: the untied six-block topology of control 590), one untied exit block. Same compute per
|
| 77 |
+
# loop count as one shared pair; 6 unique blocks, 9.56M parameters, the untied control's count.
|
| 78 |
+
N_CORE, N_PAIRS = 2, 2
|
| 79 |
+
ARCH = os.environ.get("ND_ARCH", "untied") # untied | looped
|
| 80 |
+
RL_ALGO = os.environ.get("ND_RL", "ei") # ei | grpo
|
| 81 |
+
assert ARCH in ("untied", "looped") and RL_ALGO in ("ei", "grpo"), (ARCH, RL_ALGO)
|
| 82 |
+
N_LAYER, D, N_HEAD = 2 + N_CORE * N_PAIRS, 384, 8
|
| 83 |
+
# Core applications (loops). Training draws one count per batch from TRAIN_LOOPS, in pretraining
|
| 84 |
+
# and in rl()'s fine-tune; eval and sampling apply model.n_loops, which the harness sets for its
|
| 85 |
+
# evals and rl() sets before each oracle call. DEFAULT_LOOPS is used for the validation curve and
|
| 86 |
+
# the harness's post-pretraining greedy check.
|
| 87 |
+
TRAIN_LOOPS = (1, 2, 3, 4, 5, 6, 7, 8)
|
| 88 |
+
DEFAULT_LOOPS = 2
|
| 89 |
+
VAL_LOOPS = (1, 2, 4, 8) # val loss at each count, once, when pretraining ends
|
| 90 |
+
# ---- RL knobs: the old harness's expert iteration (600 AdamW steps per round on up to 4 proofs
|
| 91 |
+
# per solved target, weighted x4, mixed with 20,000 replayed pretraining records), except for
|
| 92 |
+
# where the samples go. Each round every target gets RL_K attempts at RL_FIRST_LOOPS; a target
|
| 93 |
+
# all of them fail on gets RL_RETRY_K more (32 in all, as before) at ONE deeper loop count from
|
| 94 |
+
# RL_RETRY_LOOPS, assigned at random, so proofs that only deeper sampling finds enter the
|
| 95 |
+
# training set and no deep sample is spent on a target one loop already solves. The random
|
| 96 |
+
# assignment makes the retry calls a controlled comparison of loop counts on resistant targets.
|
| 97 |
+
# Rounds repeat until another one would not fit in the budget.
|
| 98 |
+
RL_FIRST_LOOPS, RL_K = 1, 8
|
| 99 |
+
RL_RETRY_LOOPS, RL_RETRY_K = (2, 4, 8), 24
|
| 100 |
+
# The fine-tune sees FT_RECORDS records per round, half the old harness's 600 steps x 128: in
|
| 101 |
+
# 509 the fine-tune had grown to ~74 s of a ~137 s round, so halving it fits about 16 rounds of
|
| 102 |
+
# sampling in RL_SECS instead of 11, with 27% fewer fine-tune records per run; the mix (20-33k
|
| 103 |
+
# records) still gets at least one epoch per round. Records come in the same token-budget
|
| 104 |
+
# batches as pretraining (TOK_BUDGET below) instead of 128-record batches padded to their
|
| 105 |
+
# longest proof, which with 7-14 line RL proofs in nearly every batch was ~3x the content.
|
| 106 |
+
# It uses pretraining's optimizer split: Muon (muon_step, MUON_WD) on the block matrices and the
|
| 107 |
+
# head, AdamW at FT_LR on embeddings, norms and biases. FT_MUON_LR keeps pretraining's 10:1
|
| 108 |
+
# Muon:AdamW ratio and is where pretraining's cosine ends (MUON_LR * MIN_LR_FRAC).
|
| 109 |
+
FT_RECORDS, FT_LR, FT_MUON_LR, FT_WARMUP = 300 * 128, 3e-4, 3e-3, 50
|
| 110 |
+
RETAIN, MAX_PER_THM, RL_WEIGHT = 20000, 4, 4
|
| 111 |
+
# MLP width held at 151's 1280: the fork's Block hardcodes 4 * D (1536 at D 384 would pass the
|
| 112 |
+
# 10M cap), so PeriLNBlock swaps fc1/fc2. 1280 != 3 * D keeps muon_step's QKV-by-shape test valid.
|
| 113 |
+
D_FF = 1280
|
| 114 |
+
BS, LR, MIN_LR_FRAC, WD = 128, 1e-3, 0.3, 0.1
|
| 115 |
+
MUON_LR, MUON_MOMENTUM = 0.01, 0.95
|
| 116 |
+
# Polar Express (Amsel et al. 2025) per-iteration quintic coefficients, as in modded-nanogpt
|
| 117 |
+
# (num_iters=5, safety factor 2e-2): singular values land in ~[0.86, 1.14] instead of the
|
| 118 |
+
# fixed quintic's ~[0.68, 1.13], at the same five iterations.
|
| 119 |
+
NS_COEFFS = (
|
| 120 |
+
(8.156554524902461, -22.48329292557795, 15.878769915207462),
|
| 121 |
+
(4.042929935166739, -2.808917465908714, 0.5000178451051316),
|
| 122 |
+
(3.8916678022926607, -2.772484153217685, 0.5060648178503393),
|
| 123 |
+
(3.285753657755655, -2.3681294933425376, 0.46449024233003106),
|
| 124 |
+
(2.3465413258596377, -1.7097828382687081, 0.42323551169305323),
|
| 125 |
+
)
|
| 126 |
+
# Ten times the AdamW group's per-step multiplicative decay (lr * wd) on the Muon matrices.
|
| 127 |
+
MUON_WD = 10 * WD * LR / MUON_LR
|
| 128 |
+
TOK_MODE = "lean_seq" # required by the harness (Lean protocol)
|
| 129 |
+
# Hybrid heads: half the heads get ALiBi (Press et al. 2021) with the standard slope set for
|
| 130 |
+
# H/2 heads, 2^(-8 i / (H/2)) = 1/4 .. 1/256 with 8 heads; the other half get slope 0, i.e. no
|
| 131 |
+
# positional signal at all (NoPE), so they can look citations up by content at any distance.
|
| 132 |
+
N_ALIBI = N_HEAD // 2
|
| 133 |
+
ALIBI_SLOPES = tuple(2.0 ** (-8.0 * (i + 1) / N_ALIBI) for i in range(N_ALIBI)) + (0.0,) * (
|
| 134 |
+
N_HEAD - N_ALIBI
|
| 135 |
+
)
|
| 136 |
+
VAL_N, CURVE_EVERY = 1024, 15 # records held out for val_loss; seconds between curve points
|
| 137 |
+
# Token-budget batches (fairseq max-tokens): each step takes a run of length-sorted records with
|
| 138 |
+
# count * padded_length <= TOK_BUDGET, so a batch of short proofs has many records and a batch of
|
| 139 |
+
# long ones few, and the padded token count per step is ~constant. 128 x 144 matches the real
|
| 140 |
+
# (unpadded) tokens of the incumbent's 128-record batches (mean record ~135 tokens), whose
|
| 141 |
+
# padding to the batch max (~400) made every step ~3x larger than its content.
|
| 142 |
+
TOK_BUDGET = 128 * 144
|
| 143 |
+
# Multi-token prediction (DeepSeek-V3 2024, Gloeckle et al. 2024), pretraining only: one extra
|
| 144 |
+
# Peri-LN block reads [trunk state at t; embedding of token t+1] and predicts token t+2 through
|
| 145 |
+
# the model's own ln_f/head. Its loss is added at this weight (DeepSeek-V3's early-training value).
|
| 146 |
+
MTP_WEIGHT = 0.3
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
# Muon update adapted from KellerJordan/Muon, commit
|
| 150 |
+
# f98f1cacc0263b04290753e32be8d498c1efc806 (muon.py).
|
| 151 |
+
# MIT License
|
| 152 |
+
# Copyright (c) 2024 Keller Jordan
|
| 153 |
+
#
|
| 154 |
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 155 |
+
# of this software and associated documentation files (the "Software"), to deal
|
| 156 |
+
# in the Software without restriction, including without limitation the rights
|
| 157 |
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 158 |
+
# copies of the Software, and to permit persons to whom the Software is
|
| 159 |
+
# furnished to do so, subject to the following conditions:
|
| 160 |
+
# The above copyright notice and this permission notice shall be included in all
|
| 161 |
+
# copies or substantial portions of the Software.
|
| 162 |
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 163 |
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 164 |
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 165 |
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 166 |
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 167 |
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 168 |
+
# SOFTWARE.
|
| 169 |
+
@torch.no_grad()
|
| 170 |
+
def muon_step(params, buffers, lr):
|
| 171 |
+
"""Nesterov momentum plus five bf16 Polar Express steps, on hidden matrices only."""
|
| 172 |
+
for p, momentum in zip(params, buffers, strict=True):
|
| 173 |
+
if p.grad is None:
|
| 174 |
+
continue
|
| 175 |
+
momentum.lerp_(p.grad, 1 - MUON_MOMENTUM)
|
| 176 |
+
update = p.grad.lerp(momentum, MUON_MOMENTUM).bfloat16()
|
| 177 |
+
# Only QKV has shape (3D, D) in this GPT; orthogonalize its roles separately.
|
| 178 |
+
if update.size(0) == 3 * update.size(1):
|
| 179 |
+
update = update.reshape(3, update.size(1), update.size(1))
|
| 180 |
+
transpose = update.size(-2) > update.size(-1)
|
| 181 |
+
if transpose:
|
| 182 |
+
update = update.mT
|
| 183 |
+
update = update / (update.norm(dim=(-2, -1), keepdim=True) * (1 + 2e-2) + 1e-6)
|
| 184 |
+
for a, b, c in NS_COEFFS:
|
| 185 |
+
gram = update @ update.mT
|
| 186 |
+
polynomial = b * gram + c * gram @ gram
|
| 187 |
+
update = a * update + polynomial @ update
|
| 188 |
+
if transpose:
|
| 189 |
+
update = update.mT
|
| 190 |
+
p.mul_(1 - lr * MUON_WD)
|
| 191 |
+
# lr may be a 0-d tensor (CUDA-graphed step); scale in p's dtype like add_(alpha=-lr)
|
| 192 |
+
p.sub_(lr * update.reshape_as(p).to(p.dtype))
|
| 193 |
+
|
| 194 |
+
|
| 195 |
+
class MuonStep:
|
| 196 |
+
"""muon_step on `matrices` with fresh momentum buffers, called once per step after backward
|
| 197 |
+
(grads must keep fixed addresses: zero_grad(set_to_none=False)). On CUDA the first call
|
| 198 |
+
captures the step as one CUDA graph and later calls replay it instead of ~400 kernel
|
| 199 |
+
launches; CPU smoke runs call muon_step directly."""
|
| 200 |
+
|
| 201 |
+
def __init__(self, matrices, device):
|
| 202 |
+
self.matrices, self.device = matrices, device
|
| 203 |
+
self.buffers = [torch.zeros_like(p) for p in matrices]
|
| 204 |
+
self.lr, self.graph = torch.zeros((), device=device), None
|
| 205 |
+
|
| 206 |
+
def __call__(self, lr):
|
| 207 |
+
self.lr.fill_(lr)
|
| 208 |
+
if self.device != "cuda":
|
| 209 |
+
muon_step(self.matrices, self.buffers, self.lr)
|
| 210 |
+
return
|
| 211 |
+
if self.graph is None:
|
| 212 |
+
state = self.matrices + self.buffers
|
| 213 |
+
saved = [t.clone() for t in state]
|
| 214 |
+
side = torch.cuda.Stream()
|
| 215 |
+
side.wait_stream(torch.cuda.current_stream())
|
| 216 |
+
with torch.cuda.stream(side):
|
| 217 |
+
muon_step(self.matrices, self.buffers, self.lr) # warm-up (lazy cuBLAS init)
|
| 218 |
+
torch.cuda.current_stream().wait_stream(side)
|
| 219 |
+
self.graph = torch.cuda.CUDAGraph()
|
| 220 |
+
with torch.cuda.graph(self.graph):
|
| 221 |
+
muon_step(self.matrices, self.buffers, self.lr)
|
| 222 |
+
with torch.no_grad():
|
| 223 |
+
for t, v in zip(state, saved, strict=True):
|
| 224 |
+
t.copy_(v) # undo the warm-up and capture updates
|
| 225 |
+
self.graph.replay()
|
| 226 |
+
|
| 227 |
+
|
| 228 |
+
class PeriLNBlock(Block):
|
| 229 |
+
"""P22 Peri-LN (Kim et al. 2025): the fork's pre-LN block plus a LayerNorm on each branch
|
| 230 |
+
output, so every residual write has unit scale times a learned gain. Attention has no RoPE:
|
| 231 |
+
`mask` is the additive ALiBi bias (B or 1, H, T, S) that LoopedGPT builds once per forward
|
| 232 |
+
and cos/sin are unused."""
|
| 233 |
+
|
| 234 |
+
def __init__(self, d, h):
|
| 235 |
+
super().__init__(d, h)
|
| 236 |
+
self.fc1, self.fc2 = torch.nn.Linear(d, D_FF), torch.nn.Linear(D_FF, d)
|
| 237 |
+
self.ln_attn_out, self.ln_mlp_out = torch.nn.LayerNorm(d), torch.nn.LayerNorm(d)
|
| 238 |
+
|
| 239 |
+
def attn(self, x, cos, sin, mask, cache):
|
| 240 |
+
B, T, D = x.shape
|
| 241 |
+
q, k, v = self.qkv(x).view(B, T, 3, self.h, D // self.h).permute(2, 0, 3, 1, 4)
|
| 242 |
+
if cache is not None: # the fork's preallocated KV cache, unchanged
|
| 243 |
+
if "k" not in cache:
|
| 244 |
+
cache["k"] = k.new_empty(B, self.h, cache["max"], D // self.h)
|
| 245 |
+
cache["v"] = v.new_empty(B, self.h, cache["max"], D // self.h)
|
| 246 |
+
cache["n"] = 0
|
| 247 |
+
n0, n1 = cache["n"], cache["n"] + T
|
| 248 |
+
cache["k"][:, :, n0:n1] = k
|
| 249 |
+
cache["v"][:, :, n0:n1] = v
|
| 250 |
+
cache["n"] = n1
|
| 251 |
+
k, v = cache["k"][:, :, :n1], cache["v"][:, :, :n1]
|
| 252 |
+
y = torch.nn.functional.scaled_dot_product_attention(q, k, v, attn_mask=mask.to(q.dtype))
|
| 253 |
+
return self.proj(y.transpose(1, 2).reshape(B, T, D))
|
| 254 |
+
|
| 255 |
+
def forward(self, x, cos, sin, mask=None, cache=None):
|
| 256 |
+
x = x + self.ln_attn_out(self.attn(self.ln1(x), cos, sin, mask, cache))
|
| 257 |
+
return x + self.ln_mlp_out(self.fc2(torch.nn.functional.gelu(self.fc1(self.ln2(x)))))
|
| 258 |
+
|
| 259 |
+
|
| 260 |
+
class LoopedGPT(GPT):
|
| 261 |
+
"""Looped trunk (Universal Transformer, Dehghani et al. 2018; sandwich layout and input
|
| 262 |
+
injection as in Geiping et al. 2025): blocks[0] is the entry block, blocks[1:-1] the core
|
| 263 |
+
pairs, of which loop k applies pair k % N_PAIRS, blocks[-1] the exit block. Every core pass
|
| 264 |
+
starts from ln_loop(state) + e, with e the entry block's output, so each pass sees an input
|
| 265 |
+
of the same scale and the prompt is re-injected instead of being buried under accumulated
|
| 266 |
+
writes.
|
| 267 |
+
|
| 268 |
+
P34: the fork's GPT with ALiBi (Press et al. 2021) instead of RoPE. Head h's attention
|
| 269 |
+
logits get -slope_h * (query position - key position), slopes 2^-1 .. 2^-8 for 8 heads, so
|
| 270 |
+
no rotation of q/k anywhere. Positions come from `pos` (sample.generate's left-padded
|
| 271 |
+
batches) or arange; key positions are kept in caches[0] so cached decoding sees the same
|
| 272 |
+
bias as the full forward. Causality/padding come from `mask` when given, else from rel < 0."""
|
| 273 |
+
|
| 274 |
+
def __init__(self, vocab, n_layer, d, n_head, seed, max_len=1024):
|
| 275 |
+
super().__init__(vocab, n_layer, d, n_head, max_len)
|
| 276 |
+
slopes = torch.tensor(ALIBI_SLOPES).view(1, n_head, 1, 1)
|
| 277 |
+
self.register_buffer("slopes", slopes, persistent=False)
|
| 278 |
+
self.ln_loop = torch.nn.LayerNorm(d)
|
| 279 |
+
self.n_loops, self.loop_rng = DEFAULT_LOOPS, random.Random(seed)
|
| 280 |
+
# Control 590's patch: run 198's trunk, the six blocks independent and applied once; n_loops is ignored.
|
| 281 |
+
self.untied = ARCH == "untied"
|
| 282 |
+
|
| 283 |
+
def kv_layers(self):
|
| 284 |
+
"""KV-cache layers sampling allocates at the current n_loops (the harness sizes batches by it)."""
|
| 285 |
+
return len(self.blocks) if self.untied else 2 + N_CORE * self.n_loops
|
| 286 |
+
|
| 287 |
+
def forward(self, idx, pos=None, mask=None, caches=None):
|
| 288 |
+
return self.head(self.ln_f(self.features(idx, pos, mask, caches)[0]))
|
| 289 |
+
|
| 290 |
+
def features(self, idx, pos=None, mask=None, caches=None):
|
| 291 |
+
"""The trunk: (final hidden state before ln_f, the ALiBi bias used)."""
|
| 292 |
+
B, T = idx.shape
|
| 293 |
+
if pos is None: # training/val: one (1, H, T, T) bias broadcast over the batch
|
| 294 |
+
pos = torch.arange(T, device=idx.device)[None]
|
| 295 |
+
key_pos = pos
|
| 296 |
+
if caches is not None: # incremental decoding: keys are every cached token
|
| 297 |
+
c = caches[0]
|
| 298 |
+
if "pos" not in c:
|
| 299 |
+
c["pos"], c["n_pos"] = pos.new_empty(pos.size(0), c["max"]), 0
|
| 300 |
+
n0, n1 = c["n_pos"], c["n_pos"] + T
|
| 301 |
+
c["pos"][:, n0:n1] = pos
|
| 302 |
+
c["n_pos"] = n1
|
| 303 |
+
key_pos = c["pos"][:, :n1]
|
| 304 |
+
rel = pos[:, None, :, None] - key_pos[:, None, None, :] # (B or 1, 1, T, S)
|
| 305 |
+
bias = -self.slopes * rel.to(self.slopes.dtype)
|
| 306 |
+
bias = bias.masked_fill(rel < 0 if mask is None else ~mask, float("-inf"))
|
| 307 |
+
if self.untied:
|
| 308 |
+
x = self.emb(idx)
|
| 309 |
+
for j, b in enumerate(self.blocks):
|
| 310 |
+
x = b(x, None, None, bias, None if caches is None else caches[j])
|
| 311 |
+
return x, bias
|
| 312 |
+
n = self.loop_rng.choice(TRAIN_LOOPS) if self.training else self.n_loops
|
| 313 |
+
entry, *core, exit_block = self.blocks
|
| 314 |
+
x = e = entry(self.emb(idx), None, None, bias, None if caches is None else caches[0])
|
| 315 |
+
for loop in range(n):
|
| 316 |
+
x = self.ln_loop(x) + e
|
| 317 |
+
for i in range(N_CORE):
|
| 318 |
+
j = 1 + (loop % N_PAIRS) * N_CORE + i # index in self.blocks
|
| 319 |
+
# sample.generate makes one cache dict per unique block; a shared block's keys
|
| 320 |
+
# and values differ per pass, so each pass gets its own sub-cache inside it.
|
| 321 |
+
c = caches and caches[j].setdefault(loop, {"max": caches[j]["max"]})
|
| 322 |
+
x = core[j - 1](x, None, None, bias, c)
|
| 323 |
+
x = exit_block(x, None, None, bias, None if caches is None else caches[-1])
|
| 324 |
+
return x, bias
|
| 325 |
+
|
| 326 |
+
|
| 327 |
+
class MTPHead(torch.nn.Module):
|
| 328 |
+
"""The MTP module. A separate nn.Module, never registered on the model, so the harness's
|
| 329 |
+
parameter count, RL AdamW and sampler never see it; it is dropped when pretrain() returns."""
|
| 330 |
+
|
| 331 |
+
def __init__(self, d, h):
|
| 332 |
+
super().__init__()
|
| 333 |
+
self.ln_h, self.ln_e = torch.nn.LayerNorm(d), torch.nn.LayerNorm(d)
|
| 334 |
+
self.proj = torch.nn.Linear(2 * d, d, bias=False)
|
| 335 |
+
self.block = PeriLNBlock(d, h)
|
| 336 |
+
|
| 337 |
+
|
| 338 |
+
def mtp_loss(model, mtp, x, m):
|
| 339 |
+
"""The fork's loss_on (next-token CE on proof tokens) plus MTP_WEIGHT times the CE of the
|
| 340 |
+
MTP module's token-(t+2) prediction at the same proof positions. Returns (total, main)."""
|
| 341 |
+
h, bias = model.features(x[:, :-1])
|
| 342 |
+
logits = model.head(model.ln_f(h))
|
| 343 |
+
V = logits.size(-1)
|
| 344 |
+
ce = torch.nn.functional.cross_entropy(
|
| 345 |
+
logits.reshape(-1, V).float(), x[:, 1:].reshape(-1), reduction="none"
|
| 346 |
+
)
|
| 347 |
+
main = (ce * m[:, 1:].reshape(-1)).sum() / m[:, 1:].sum()
|
| 348 |
+
# Position t (0..T-3) gets h_t and emb(x_{t+1}); causal attention over these keeps every
|
| 349 |
+
# prediction of x_{t+2} a function of x_{<=t+1}.
|
| 350 |
+
z = mtp.proj(torch.cat((mtp.ln_h(h[:, :-1]), mtp.ln_e(model.emb(x[:, 1:-1]))), -1))
|
| 351 |
+
z = mtp.block(z, None, None, bias[..., :-1, :-1], None)
|
| 352 |
+
ce2 = torch.nn.functional.cross_entropy(
|
| 353 |
+
model.head(model.ln_f(z)).reshape(-1, V).float(), x[:, 2:].reshape(-1), reduction="none"
|
| 354 |
+
)
|
| 355 |
+
aux = (ce2 * m[:, 2:].reshape(-1)).sum() / m[:, 2:].sum().clamp(min=1)
|
| 356 |
+
return main + MTP_WEIGHT * aux, main, aux
|
| 357 |
+
|
| 358 |
+
|
| 359 |
+
def val_loss(model, ids, mask, ref_max, lens, tok, gen, autocast):
|
| 360 |
+
"""Mean loss over the first VAL_N records (never trained on), no shift augmentation."""
|
| 361 |
+
model.eval()
|
| 362 |
+
tot = 0.0
|
| 363 |
+
with torch.no_grad(), autocast:
|
| 364 |
+
for i in range(0, VAL_N, BS):
|
| 365 |
+
idxs = torch.arange(i, min(i + BS, VAL_N), device=ids.device)
|
| 366 |
+
x, m = ids[idxs], mask[idxs]
|
| 367 |
+
T = int(lens[idxs].max())
|
| 368 |
+
tot += loss_on(model, x[:, :T], m[:, :T]).item() * len(idxs)
|
| 369 |
+
model.train()
|
| 370 |
+
return tot / VAL_N
|
| 371 |
+
|
| 372 |
+
|
| 373 |
+
def to_gpu(data, tok, device):
|
| 374 |
+
"""Pad all (prompt, proof) records once into (N, T) ids + proof mask on the device."""
|
| 375 |
+
N, T = len(data), max(len(p) + len(q) for p, q in data)
|
| 376 |
+
ids = torch.full((N, T), tok.pad, dtype=torch.long)
|
| 377 |
+
mask = torch.zeros((N, T), dtype=torch.bool)
|
| 378 |
+
ref_max = torch.zeros(
|
| 379 |
+
N, dtype=torch.long
|
| 380 |
+
) # largest N<k> index used in the proof, for the shift augmentation
|
| 381 |
+
for i, (p, q) in enumerate(data):
|
| 382 |
+
ids[i, : len(p) + len(q)] = torch.tensor(p + q)
|
| 383 |
+
mask[i, len(p) : len(p) + len(q)] = True
|
| 384 |
+
ref_max[i] = max((x - tok.ref0 + 1 for x in q if x >= tok.ref0), default=0)
|
| 385 |
+
return ids.to(device), mask.to(device), ref_max.to(device), (ids != tok.pad).sum(1).to(device)
|
| 386 |
+
|
| 387 |
+
|
| 388 |
+
def token_batches(lens, n_train, gen, rng, first=VAL_N):
|
| 389 |
+
"""One epoch of token-budget batches: a random permutation of the n_train records from
|
| 390 |
+
`first` on, stably sorted by length (equal lengths stay shuffled), cut greedily into runs of
|
| 391 |
+
consecutive records with count * max_len <= TOK_BUDGET, and the runs' order shuffled.
|
| 392 |
+
Returns (order, cuts)."""
|
| 393 |
+
perm = torch.randperm(n_train, device=lens.device, generator=gen) + first
|
| 394 |
+
order = perm[torch.argsort(lens[perm], stable=True)]
|
| 395 |
+
sorted_lens = lens[order].cpu()
|
| 396 |
+
cuts, s = [], 0
|
| 397 |
+
while s < len(sorted_lens):
|
| 398 |
+
window = sorted_lens[s : s + TOK_BUDGET // int(sorted_lens[s])]
|
| 399 |
+
# count * max_len is non-decreasing along the window, so the fits form a prefix.
|
| 400 |
+
e = s + int((torch.arange(1, len(window) + 1) * window <= TOK_BUDGET).sum())
|
| 401 |
+
cuts.append((s, e, int(sorted_lens[e - 1]))) # sorted: last is the batch's max length
|
| 402 |
+
s = e
|
| 403 |
+
rng.shuffle(cuts)
|
| 404 |
+
return order, cuts
|
| 405 |
+
|
| 406 |
+
|
| 407 |
+
def gpu_batch(ids, mask, ref_max, lens, idxs, tok, gen, max_len=None, augment=True):
|
| 408 |
+
"""The fork's batch() + tok.shift_abs, vectorised: a random per-row offset is added to
|
| 409 |
+
every ref token, and each row's atoms go through a random permutation of the ten atom tokens
|
| 410 |
+
(positions after the statement header, which declares all ten in a fixed order). augment=False
|
| 411 |
+
leaves rows as sampled (policy-gradient rollouts)."""
|
| 412 |
+
x, m = ids[idxs], mask[idxs]
|
| 413 |
+
# Known on the host for training batches: passing it avoids a GPU sync every step.
|
| 414 |
+
T = int(lens[idxs].max()) if max_len is None else max_len
|
| 415 |
+
x, m = x[:, :T].clone(), m[:, :T]
|
| 416 |
+
if not augment:
|
| 417 |
+
return x, m
|
| 418 |
+
atom_ids = torch.tensor(tok.atom_ids, device=x.device)
|
| 419 |
+
slot = torch.full((tok.vocab_size,), -1, dtype=torch.long, device=x.device)
|
| 420 |
+
slot[atom_ids] = torch.arange(len(atom_ids), device=x.device)
|
| 421 |
+
a = slot[x]
|
| 422 |
+
a[:, :HEADER_LEN] = -1
|
| 423 |
+
perm = torch.rand(len(idxs), len(atom_ids), device=x.device, generator=gen).argsort(1)
|
| 424 |
+
x = torch.where(a >= 0, atom_ids[perm.gather(1, a.clamp(min=0))], x)
|
| 425 |
+
if tok.mode in ("abs", "lean_seq"): # lean_seq: names n1.. get the same start offset
|
| 426 |
+
room = MAXN - ref_max[idxs]
|
| 427 |
+
shift = (
|
| 428 |
+
(torch.rand(len(idxs), device=x.device, generator=gen) * (room + 1))
|
| 429 |
+
.long()
|
| 430 |
+
.clamp(max=room)
|
| 431 |
+
)
|
| 432 |
+
is_ref = (x >= tok.ref0) & m
|
| 433 |
+
x = torch.where(is_ref, x + shift[:, None], x)
|
| 434 |
+
return x, m
|
| 435 |
+
|
| 436 |
+
|
| 437 |
+
def pretrain(train_recs, budget_secs, device, seed, log):
|
| 438 |
+
t0 = time.time()
|
| 439 |
+
tok = make_tokenizer(TOK_MODE)
|
| 440 |
+
data = [(tok.encode_prompt(r["prompt"]), tok.encode_proof(r["proof"])) for r in train_recs]
|
| 441 |
+
ids, mask, ref_max, lens = to_gpu(data, tok, device)
|
| 442 |
+
gen = torch.Generator(device=device)
|
| 443 |
+
gen.manual_seed(seed)
|
| 444 |
+
model = LoopedGPT(tok.vocab_size, N_LAYER, D, N_HEAD, seed)
|
| 445 |
+
model.blocks = torch.nn.ModuleList(PeriLNBlock(D, N_HEAD) for _ in range(N_LAYER))
|
| 446 |
+
model.blocks.apply(model._init) # fork init: zero biases
|
| 447 |
+
model = model.to(device)
|
| 448 |
+
mtp = MTPHead(D, N_HEAD)
|
| 449 |
+
mtp.apply(model._init)
|
| 450 |
+
mtp = mtp.to(device)
|
| 451 |
+
# Compile the repeated blocks once each (torch >= 2.9; dynamic shapes, ~14 s): ~14% faster
|
| 452 |
+
# steps. The coalescing tiling analysis crashes on dynamic shapes, so it is off. Undone at
|
| 453 |
+
# handoff so the harness's RL fine-tune and KV-cache sampling run eager.
|
| 454 |
+
torch._inductor.config.triton.coalesce_tiling_analysis = False
|
| 455 |
+
compiled = list(model.blocks) + [mtp.block]
|
| 456 |
+
for b in compiled if device == "cuda" else []: # CPU smoke runs stay eager
|
| 457 |
+
b.compile(dynamic=True)
|
| 458 |
+
for p in list(model.blocks.parameters()) + list(mtp.parameters()):
|
| 459 |
+
if p.ndim == 2:
|
| 460 |
+
# Orthogonal matrices have element second moment gain^2 / max(rows, cols).
|
| 461 |
+
torch.nn.init.orthogonal_(p, gain=0.02 * math.sqrt(max(p.shape)))
|
| 462 |
+
log(
|
| 463 |
+
f"pretrain: {model.n_params():,} params, {len(data):,} records on {device} "
|
| 464 |
+
f"after {time.time() - t0:.0f}s, budget {budget_secs}s"
|
| 465 |
+
)
|
| 466 |
+
# The output readout joins the hidden matrices under Muon; embeddings stay on AdamW.
|
| 467 |
+
trainable = list(model.parameters()) + list(mtp.parameters())
|
| 468 |
+
matrices = [p for p in model.blocks.parameters() if p.ndim == 2] + [model.head.weight]
|
| 469 |
+
matrices += [p for p in mtp.parameters() if p.ndim == 2]
|
| 470 |
+
matrix_ids = {id(p) for p in matrices}
|
| 471 |
+
auxiliary = [p for p in trainable if id(p) not in matrix_ids]
|
| 472 |
+
muon = MuonStep(matrices, device)
|
| 473 |
+
opt = torch.optim.AdamW(
|
| 474 |
+
auxiliary, lr=LR, weight_decay=WD, betas=(0.9, 0.95), fused=device == "cuda"
|
| 475 |
+
)
|
| 476 |
+
autocast = torch.autocast("cuda", dtype=torch.bfloat16, enabled=(device == "cuda"))
|
| 477 |
+
model.train()
|
| 478 |
+
step, last_loss, records_seen = 0, float("nan"), 0
|
| 479 |
+
curve, recent, recent_aux, next_point = [], [], [], CURVE_EVERY
|
| 480 |
+
n_train = len(data) - VAL_N # records [0, VAL_N) are the val slice
|
| 481 |
+
rng, cuts, batches_per_epoch = random.Random(seed), [], None
|
| 482 |
+
order = torch.empty(0, dtype=torch.long, device=device)
|
| 483 |
+
while True:
|
| 484 |
+
frac = (
|
| 485 |
+
time.time() - t0
|
| 486 |
+
) / budget_secs # cosine over wall-clock, so the cap is the schedule
|
| 487 |
+
if frac >= 1.0:
|
| 488 |
+
break
|
| 489 |
+
step += 1
|
| 490 |
+
# No warmup (as in modded-nanogpt): Muon's step is normalized and Adam's is ~lr per
|
| 491 |
+
# element from step 1, and Peri-LN normalizes every branch write.
|
| 492 |
+
lr = LR * MIN_LR_FRAC + 0.5 * LR * (1 - MIN_LR_FRAC) * (1 + math.cos(math.pi * frac))
|
| 493 |
+
for g in opt.param_groups:
|
| 494 |
+
g["lr"] = lr
|
| 495 |
+
if not cuts: # new epoch
|
| 496 |
+
order, cuts = token_batches(lens, n_train, gen, rng)
|
| 497 |
+
batches_per_epoch = len(cuts)
|
| 498 |
+
s, e, T = cuts.pop()
|
| 499 |
+
idxs = order[s:e]
|
| 500 |
+
records_seen += e - s
|
| 501 |
+
x, m = gpu_batch(ids, mask, ref_max, lens, idxs, tok, gen, T)
|
| 502 |
+
with autocast:
|
| 503 |
+
loss, main, aux = mtp_loss(model, mtp, x, m)
|
| 504 |
+
model.zero_grad(set_to_none=False) # grads keep fixed addresses for the Muon CUDA graph
|
| 505 |
+
mtp.zero_grad(set_to_none=False)
|
| 506 |
+
loss.backward()
|
| 507 |
+
torch.nn.utils.clip_grad_norm_(trainable, 1.0)
|
| 508 |
+
opt.step()
|
| 509 |
+
muon(MUON_LR * lr / LR)
|
| 510 |
+
if step % 20 == 0:
|
| 511 |
+
last_loss = main.item() # the next-token CE, comparable with earlier runs
|
| 512 |
+
recent.append(last_loss)
|
| 513 |
+
recent_aux.append(aux.item())
|
| 514 |
+
if (
|
| 515 |
+
time.time() - t0 >= next_point
|
| 516 |
+
): # curve point: mean recent train loss + val loss on the held-out slice
|
| 517 |
+
curve.append(
|
| 518 |
+
{
|
| 519 |
+
"secs": round(time.time() - t0),
|
| 520 |
+
"step": step,
|
| 521 |
+
"train_loss": sum(recent) / len(recent) if recent else last_loss,
|
| 522 |
+
"val_loss": val_loss(model, ids, mask, ref_max, lens, tok, gen, autocast),
|
| 523 |
+
"mtp_loss": sum(recent_aux) / len(recent_aux) if recent_aux else None,
|
| 524 |
+
}
|
| 525 |
+
)
|
| 526 |
+
log(
|
| 527 |
+
f"pretrain step {step} train {curve[-1]['train_loss']:.4f} "
|
| 528 |
+
f"val {curve[-1]['val_loss']:.4f} lr {lr:.2e} {curve[-1]['secs']}s"
|
| 529 |
+
)
|
| 530 |
+
recent, recent_aux, next_point = [], [], next_point + CURVE_EVERY
|
| 531 |
+
val_by_loops = {}
|
| 532 |
+
for n in (VAL_LOOPS if not model.untied else (DEFAULT_LOOPS,)) if step else (): # no steps: a checkpoint rebuild, not a training run
|
| 533 |
+
model.n_loops = n
|
| 534 |
+
val_by_loops[n] = val_loss(model, ids, mask, ref_max, lens, tok, gen, autocast)
|
| 535 |
+
model.n_loops = DEFAULT_LOOPS
|
| 536 |
+
log(f"pretrain val loss by loops: {val_by_loops}")
|
| 537 |
+
for b in compiled:
|
| 538 |
+
b._compiled_call_impl = None
|
| 539 |
+
model.eval()
|
| 540 |
+
return (
|
| 541 |
+
model,
|
| 542 |
+
tok,
|
| 543 |
+
{
|
| 544 |
+
"steps": step,
|
| 545 |
+
"records_seen": records_seen,
|
| 546 |
+
"epochs": records_seen / n_train,
|
| 547 |
+
"batches_per_epoch": batches_per_epoch,
|
| 548 |
+
"tok_budget": TOK_BUDGET,
|
| 549 |
+
"last_loss": last_loss,
|
| 550 |
+
"train_loops": TRAIN_LOOPS,
|
| 551 |
+
"default_loops": DEFAULT_LOOPS,
|
| 552 |
+
"val_by_loops": val_by_loops,
|
| 553 |
+
"curve": curve,
|
| 554 |
+
},
|
| 555 |
+
)
|
| 556 |
+
|
| 557 |
+
|
| 558 |
+
def finetune(model, tok, data, rng, device):
|
| 559 |
+
"""The RL fine-tune: pretraining's optimizers (Muon on the hidden matrices, AdamW on the
|
| 560 |
+
rest), linear warmup then cosine to lr/10, over FT_RECORDS records in token-budget batches
|
| 561 |
+
(to_gpu / token_batches / gpu_batch, as pretraining). Muon's momentum restarts every round,
|
| 562 |
+
as AdamW's moments did. The model is in train mode, so every batch draws its own loop count
|
| 563 |
+
from TRAIN_LOOPS. Returns (last loss, steps)."""
|
| 564 |
+
ids, mask, ref_max, lens = to_gpu(data, tok, device)
|
| 565 |
+
gen = torch.Generator(device=device)
|
| 566 |
+
gen.manual_seed(rng.getrandbits(31))
|
| 567 |
+
plan, seen = [], 0 # (order, start, end, padded length) per step, epoch after epoch
|
| 568 |
+
while seen < FT_RECORDS:
|
| 569 |
+
order, cuts = token_batches(lens, len(data), gen, rng, first=0)
|
| 570 |
+
for s, e, T in cuts:
|
| 571 |
+
if seen >= FT_RECORDS:
|
| 572 |
+
break
|
| 573 |
+
plan.append((order, s, e, T))
|
| 574 |
+
seen += e - s
|
| 575 |
+
matrices = [p for p in model.blocks.parameters() if p.ndim == 2] + [model.head.weight]
|
| 576 |
+
matrix_ids = {id(p) for p in matrices}
|
| 577 |
+
auxiliary = [p for p in model.parameters() if id(p) not in matrix_ids]
|
| 578 |
+
opt = torch.optim.AdamW(auxiliary, lr=FT_LR, weight_decay=0.1, betas=(0.9, 0.95))
|
| 579 |
+
muon = MuonStep(matrices, device)
|
| 580 |
+
autocast = torch.autocast("cuda", dtype=torch.bfloat16, enabled=(device == "cuda"))
|
| 581 |
+
model.train()
|
| 582 |
+
for step, (order, s, e, T) in enumerate(plan, 1):
|
| 583 |
+
lr = (
|
| 584 |
+
FT_LR * step / FT_WARMUP
|
| 585 |
+
if step < FT_WARMUP
|
| 586 |
+
else FT_LR / 10 + 0.45 * FT_LR * (1 + math.cos(math.pi * step / len(plan)))
|
| 587 |
+
)
|
| 588 |
+
for g in opt.param_groups:
|
| 589 |
+
g["lr"] = lr
|
| 590 |
+
x, m = gpu_batch(ids, mask, ref_max, lens, order[s:e], tok, gen, T)
|
| 591 |
+
with autocast:
|
| 592 |
+
loss = loss_on(model, x, m)
|
| 593 |
+
model.zero_grad(set_to_none=False) # grads keep fixed addresses for the Muon CUDA graph
|
| 594 |
+
loss.backward()
|
| 595 |
+
torch.nn.utils.clip_grad_norm_(model.parameters(), 1.0)
|
| 596 |
+
opt.step()
|
| 597 |
+
muon(FT_MUON_LR * lr / FT_LR)
|
| 598 |
+
model.eval()
|
| 599 |
+
return loss.item(), len(plan)
|
| 600 |
+
|
| 601 |
+
|
| 602 |
+
# Targets per round, picked by pick_targets: the old harness's fixed 1,500 targets, now drawn from the
|
| 603 |
+
# whole pool (thousands, body 7 to ~45) with the samples aimed at the frontier.
|
| 604 |
+
N_ROUND = 1500
|
| 605 |
+
|
| 606 |
+
|
| 607 |
+
def pick_targets(targets, found, rng, n=N_ROUND):
|
| 608 |
+
"""n targets for this round. Bands (body lines) get weight 0.1 + their solved fraction up to one
|
| 609 |
+
band past the highest band with any solve, and 0.02 beyond it, so sampling follows the frontier
|
| 610 |
+
instead of spending most of a round on targets far out of reach; within a band, unsolved targets
|
| 611 |
+
come first."""
|
| 612 |
+
bands = sorted({t["band"] for t in targets}, key=lambda b: int(b.split("-")[0].rstrip("+")))
|
| 613 |
+
by = {b: [t for t in targets if t["band"] == b] for b in bands}
|
| 614 |
+
rate = {b: sum(bool(found[t["name"]]) for t in by[b]) / len(by[b]) for b in bands}
|
| 615 |
+
top = max((i for i, b in enumerate(bands) if rate[b] > 0), default=-1)
|
| 616 |
+
w = {b: (0.1 + rate[b]) if i <= top + 1 else 0.02 for i, b in enumerate(bands)}
|
| 617 |
+
out = []
|
| 618 |
+
for b in bands:
|
| 619 |
+
k = min(len(by[b]), round(n * w[b] / sum(w.values())))
|
| 620 |
+
unsolved = [t for t in by[b] if not found[t["name"]]]
|
| 621 |
+
solved = [t for t in by[b] if found[t["name"]]]
|
| 622 |
+
rng.shuffle(unsolved)
|
| 623 |
+
rng.shuffle(solved)
|
| 624 |
+
out += (unsolved + solved)[:k]
|
| 625 |
+
return out
|
| 626 |
+
|
| 627 |
+
|
| 628 |
+
@torch.no_grad()
|
| 629 |
+
def rollout_stats(model, tok, rows, device):
|
| 630 |
+
"""Diagnostics on a round's own rollouts, before any update on them, at the model's current n_loops: mean per-token
|
| 631 |
+
entropy of the policy at temperature 1 (sampling uses TEMP), mean -log p of the sampled tokens, mean rollout
|
| 632 |
+
length in tokens, and targets whose rollouts all pass / all fail (zero GRPO advantage). Batching uses its own
|
| 633 |
+
generator and rng, so the run's random streams are the same as without it."""
|
| 634 |
+
items = [(tok.encode_prompt(r["prompt"]), ids) for r in rows for ids, _ in r["rollouts"]]
|
| 635 |
+
ids, mask, _, lens = to_gpu(items, tok, device)
|
| 636 |
+
gen = torch.Generator(device=device)
|
| 637 |
+
gen.manual_seed(0)
|
| 638 |
+
order, cuts = token_batches(lens, len(items), gen, random.Random(0), first=0)
|
| 639 |
+
model.eval()
|
| 640 |
+
sums = {k: 0.0 for k in ("entropy", "nll", "entropy_t", "nll_t")}
|
| 641 |
+
n = 0
|
| 642 |
+
for s, e, T in cuts:
|
| 643 |
+
x, m = gpu_batch(ids, mask, None, lens, order[s:e], tok, gen, T, augment=False)
|
| 644 |
+
with torch.autocast("cuda", dtype=torch.bfloat16, enabled=(device == "cuda")):
|
| 645 |
+
logits = model(x[:, :-1]).float()
|
| 646 |
+
m = m[:, 1:]
|
| 647 |
+
for suffix, temp in (("", 1.0), ("_t", GRPO_TEMP)):
|
| 648 |
+
logp = torch.log_softmax(logits / temp, -1)
|
| 649 |
+
sums["entropy" + suffix] += float(((-(logp.exp() * logp).sum(-1)) * m).sum())
|
| 650 |
+
sums["nll" + suffix] += float((-logp.gather(-1, x[:, 1:, None]).squeeze(-1) * m).sum())
|
| 651 |
+
n += float(m.sum())
|
| 652 |
+
# At the sampling temperature E[-log q(token)] = H(q) exactly, so nll_t well above entropy_t means the sampler
|
| 653 |
+
# and this forward pass disagree.
|
| 654 |
+
return {**{k: v / n for k, v in sums.items()}, "tokens": n / len(items),
|
| 655 |
+
"all_pass": sum(all(ok for _, ok in r["rollouts"]) for r in rows),
|
| 656 |
+
"all_fail": sum(not any(ok for _, ok in r["rollouts"]) for r in rows)}
|
| 657 |
+
|
| 658 |
+
|
| 659 |
+
def fmt_stats(rs):
|
| 660 |
+
return (f"rollout entropy {rs['entropy']:.3f}, nll {rs['nll']:.3f}, at T={GRPO_TEMP} entropy "
|
| 661 |
+
f"{rs['entropy_t']:.3f} nll {rs['nll_t']:.3f}, {rs['tokens']:.0f} tokens, "
|
| 662 |
+
f"all pass {rs['all_pass']}, all fail {rs['all_fail']}")
|
| 663 |
+
|
| 664 |
+
|
| 665 |
+
# ---- Per-round KL probes (both arms; v4 on). Exact KLs between next-token distributions at temperature 1, summed over
|
| 666 |
+
# the vocabulary and averaged over proof tokens, both directions, against two references: the previous round's
|
| 667 |
+
# policy (this round's step) and the frozen pretrained model (total drift). On three sets: a sample of this round's
|
| 668 |
+
# rollouts, PROBE_PRETRAIN_N pretraining val records (held out of pretraining, though RL's retained SFT may draw
|
| 669 |
+
# them), and PROBE_GOLD_N dev gold proofs, which the harness hands over as oracle.gold for likelihood only. Weights
|
| 670 |
+
# go to <out>/rl_round_NNN.pt every CKPT_EVERY rounds, so any other KL can be computed later.
|
| 671 |
+
PROBE_ROLLOUTS, PROBE_PRETRAIN_N, PROBE_GOLD_N, CKPT_EVERY = 2048, 512, 200, 5
|
| 672 |
+
|
| 673 |
+
|
| 674 |
+
@torch.no_grad()
|
| 675 |
+
def kl_pair(p_model, q_model, tok, items, device):
|
| 676 |
+
"""Mean per proof token over (prompt ids, proof ids) items: KL(p || q), KL(q || p), and each model's -log p of
|
| 677 |
+
the tokens."""
|
| 678 |
+
ids, mask, _, lens = to_gpu(items, tok, device)
|
| 679 |
+
gen = torch.Generator(device=device)
|
| 680 |
+
gen.manual_seed(0)
|
| 681 |
+
order, cuts = token_batches(lens, len(items), gen, random.Random(0), first=0)
|
| 682 |
+
sums = {k: 0.0 for k in ("kl_pq", "kl_qp", "nll_p", "nll_q")}
|
| 683 |
+
n = 0.0
|
| 684 |
+
for s, e, T in cuts:
|
| 685 |
+
x, m = gpu_batch(ids, mask, None, lens, order[s:e], tok, gen, T, augment=False)
|
| 686 |
+
m = m[:, 1:]
|
| 687 |
+
with torch.autocast("cuda", dtype=torch.bfloat16, enabled=(device == "cuda")):
|
| 688 |
+
lp, lq = (torch.log_softmax(mod(x[:, :-1]).float(), -1) for mod in (p_model, q_model))
|
| 689 |
+
sums["kl_pq"] += float(((lp.exp() * (lp - lq)).sum(-1) * m).sum())
|
| 690 |
+
sums["kl_qp"] += float(((lq.exp() * (lq - lp)).sum(-1) * m).sum())
|
| 691 |
+
sums["nll_p"] -= float((lp.gather(-1, x[:, 1:, None]).squeeze(-1) * m).sum())
|
| 692 |
+
sums["nll_q"] -= float((lq.gather(-1, x[:, 1:, None]).squeeze(-1) * m).sum())
|
| 693 |
+
n += float(m.sum())
|
| 694 |
+
return {k: v / max(n, 1.0) for k, v in sums.items()}
|
| 695 |
+
|
| 696 |
+
|
| 697 |
+
class Probe:
|
| 698 |
+
"""Holds the frozen pretrained model and the previous round's weights; measure() after each round's update."""
|
| 699 |
+
|
| 700 |
+
def __init__(self, model, tok, train_recs, oracle, device, log):
|
| 701 |
+
self.tok, self.device, self.log, self.out = tok, device, log, oracle.a.out
|
| 702 |
+
self.pre, self.prev = copy.deepcopy(model).eval(), copy.deepcopy(model).eval()
|
| 703 |
+
pick = random.Random(1234)
|
| 704 |
+
enc = lambda r: (tok.encode_prompt(r["prompt"]), tok.encode_proof(r["proof"])) # noqa: E731
|
| 705 |
+
self.pretrain = [enc(r) for r in pick.sample(train_recs[:VAL_N], min(PROBE_PRETRAIN_N, VAL_N))]
|
| 706 |
+
gold = getattr(oracle, "gold", [])
|
| 707 |
+
self.gold = [enc(r) for r in pick.sample(gold, min(PROBE_GOLD_N, len(gold)))]
|
| 708 |
+
self.rng, self.history = random.Random(4321), []
|
| 709 |
+
|
| 710 |
+
def measure(self, model, rows, round_n):
|
| 711 |
+
"""rows: this round's first-pass rollouts, sampled by the previous round's weights (self.prev)."""
|
| 712 |
+
items = [(self.tok.encode_prompt(r["prompt"]), ids) for r in rows for ids, _ in r["rollouts"]]
|
| 713 |
+
items = self.rng.sample(items, min(PROBE_ROLLOUTS, len(items)))
|
| 714 |
+
loops = model.n_loops
|
| 715 |
+
model.n_loops = self.prev.n_loops = self.pre.n_loops = RL_FIRST_LOOPS
|
| 716 |
+
model.eval()
|
| 717 |
+
step = kl_pair(self.prev, model, self.tok, items, self.device)
|
| 718 |
+
roll = kl_pair(model, self.pre, self.tok, items, self.device)
|
| 719 |
+
pt = kl_pair(model, self.pre, self.tok, self.pretrain, self.device)
|
| 720 |
+
gold = kl_pair(model, self.pre, self.tok, self.gold, self.device) if self.gold else {"nll_p": float("nan")}
|
| 721 |
+
model.n_loops = loops
|
| 722 |
+
r = {"round": round_n, "step": step["kl_pq"], "step_rev": step["kl_qp"], "pre_roll": roll["kl_pq"],
|
| 723 |
+
"pre_roll_rev": roll["kl_qp"], "pre_pt": pt["kl_pq"], "pre_pt_rev": pt["kl_qp"],
|
| 724 |
+
"nll_pt": pt["nll_p"], "nll_gold": gold["nll_p"]}
|
| 725 |
+
self.history.append(r)
|
| 726 |
+
self.log(f"probe round {round_n}: KL(old||new) {r['step']:.5f} KL(new||old) {r['step_rev']:.5f}, "
|
| 727 |
+
f"rollouts KL(pi||pre) {r['pre_roll']:.4f} KL(pre||pi) {r['pre_roll_rev']:.4f}, "
|
| 728 |
+
f"pretrain KL(pi||pre) {r['pre_pt']:.4f} KL(pre||pi) {r['pre_pt_rev']:.4f}, "
|
| 729 |
+
f"nll pretrain {r['nll_pt']:.4f} gold {r['nll_gold']:.4f}")
|
| 730 |
+
if round_n % CKPT_EVERY == 0:
|
| 731 |
+
torch.save({k: v.detach().cpu() for k, v in model.state_dict().items()}, f"{self.out}/rl_round_{round_n:03d}.pt")
|
| 732 |
+
self.prev.load_state_dict(model.state_dict())
|
| 733 |
+
|
| 734 |
+
|
| 735 |
+
def rl(model, tok, targets, train_recs, oracle, budget_secs, device, seed, log):
|
| 736 |
+
if RL_ALGO == "grpo":
|
| 737 |
+
return rl_grpo(model, tok, targets, train_recs, oracle, device, seed, log)
|
| 738 |
+
return rl_ei(model, tok, targets, train_recs, oracle, device, seed, log)
|
| 739 |
+
|
| 740 |
+
|
| 741 |
+
def rl_ei(model, tok, targets, train_recs, oracle, device, seed, log):
|
| 742 |
+
rng = random.Random(seed)
|
| 743 |
+
probe = Probe(model, tok, train_recs, oracle, device, log)
|
| 744 |
+
found = {t["name"]: {} for t in targets} # name -> {normalized proof: proof text}
|
| 745 |
+
rounds, round_secs, retries, ft_steps, history = 0, 0.0, [], [], []
|
| 746 |
+
# Start a round only if one as long as the last (plus 15%) still fits in the budget.
|
| 747 |
+
while oracle.left() > 1.15 * round_secs:
|
| 748 |
+
t0 = oracle.used()
|
| 749 |
+
model.n_loops = RL_FIRST_LOOPS
|
| 750 |
+
picked = pick_targets(targets, found, rng)
|
| 751 |
+
rows = oracle.sample_rollouts(model, picked, RL_K)
|
| 752 |
+
rs = rollout_stats(model, tok, rows, device) # first pass only: comparable to the GRPO arm's rounds
|
| 753 |
+
first_pass = list(rows)
|
| 754 |
+
failed = [t for t, row in zip(picked, rows, strict=True) if not row["proofs"]]
|
| 755 |
+
rng.shuffle(failed)
|
| 756 |
+
for i, n in enumerate(RL_RETRY_LOOPS):
|
| 757 |
+
part = failed[i :: len(RL_RETRY_LOOPS)]
|
| 758 |
+
if not part:
|
| 759 |
+
continue
|
| 760 |
+
model.n_loops = n
|
| 761 |
+
part_rows = oracle.sample(model, part, RL_RETRY_K)
|
| 762 |
+
cracked = sum(bool(row["proofs"]) for row in part_rows)
|
| 763 |
+
retries.append(
|
| 764 |
+
{"round": rounds + 1, "loops": n, "targets": len(part), "cracked": cracked}
|
| 765 |
+
)
|
| 766 |
+
rows += part_rows
|
| 767 |
+
for row in rows:
|
| 768 |
+
for proof in row["proofs"]:
|
| 769 |
+
found[row["name"]].setdefault(norm(proof), proof)
|
| 770 |
+
mix = []
|
| 771 |
+
for t in targets:
|
| 772 |
+
proofs = list(found[t["name"]].values())
|
| 773 |
+
rng.shuffle(proofs)
|
| 774 |
+
mix += [(t["prompt"], proof) for proof in proofs[:MAX_PER_THM]] * RL_WEIGHT
|
| 775 |
+
n_rl = len(mix)
|
| 776 |
+
# No solves yet: skip the fine-tune and sample again (the old harness stopped RL here). The round is still
|
| 777 |
+
# logged, with its rollout stats.
|
| 778 |
+
loss, steps = float("nan"), 0
|
| 779 |
+
if n_rl:
|
| 780 |
+
mix += [(r["prompt"], r["proof"]) for r in rng.sample(train_recs, RETAIN)]
|
| 781 |
+
data = [(tok.encode_prompt(p), tok.encode_proof(q)) for p, q in mix]
|
| 782 |
+
loss, steps = finetune(model, tok, data, rng, device)
|
| 783 |
+
ft_steps.append(steps)
|
| 784 |
+
rounds += 1
|
| 785 |
+
probe.measure(model, first_pass, rounds)
|
| 786 |
+
round_secs = oracle.used() - t0
|
| 787 |
+
history.append({"round": rounds, "rollouts": rs})
|
| 788 |
+
log(
|
| 789 |
+
f"rl round {rounds}: {n_rl} RL records, fine-tune loss {loss:.4f} in {steps} steps, "
|
| 790 |
+
f"{fmt_stats(rs)}, round {round_secs:.0f}s, {oracle.left():.0f}s left"
|
| 791 |
+
)
|
| 792 |
+
model.n_loops = DEFAULT_LOOPS
|
| 793 |
+
return {
|
| 794 |
+
"rounds": rounds,
|
| 795 |
+
"first_loops": RL_FIRST_LOOPS,
|
| 796 |
+
"k_first": RL_K,
|
| 797 |
+
"retry_loops": RL_RETRY_LOOPS,
|
| 798 |
+
"k_retry": RL_RETRY_K,
|
| 799 |
+
"retries": retries,
|
| 800 |
+
"ft_records": FT_RECORDS,
|
| 801 |
+
"ft_steps": ft_steps,
|
| 802 |
+
"ft_optimizer": "muon (polar express) on block matrices and head + adamw on the rest",
|
| 803 |
+
"ft_lr": FT_LR,
|
| 804 |
+
"ft_muon_lr": FT_MUON_LR,
|
| 805 |
+
"history": history,
|
| 806 |
+
"probe": probe.history,
|
| 807 |
+
}
|
| 808 |
+
|
| 809 |
+
|
| 810 |
+
# ---- GRPO arm (ND_RL=grpo). Group-relative policy gradient (GRPO, Shao et al. 2024) with Dr. GRPO's
|
| 811 |
+
# unnormalised advantages r - mean(r) and a constant length normaliser instead of each rollout's length
|
| 812 |
+
# (Liu et al. 2025), and DAPO's dropping of groups that are all pass or all fail (Yu et al. 2025), since
|
| 813 |
+
# they carry no signal. The found-proof pool: once Lean accepts a proof of a target, a later group on
|
| 814 |
+
# that target with no success gets one stored proof in place of a failed rollout, with reward 1, so a
|
| 815 |
+
# target solved once keeps giving a gradient (that member is off-policy; the rest are the model's own).
|
| 816 |
+
# Same target picking, rollouts per target (EI's first pass) and budget as the EI arm; one pass over each
|
| 817 |
+
# round's rollouts in many steps, so a PPO clipped ratio (Schulman et al. 2017) against the sampling policy
|
| 818 |
+
# keeps later steps from moving far, with DAPO's clip-higher and a dual clip on negative advantages (Ye et
|
| 819 |
+
# al. 2020), Leon's settings. The loss and the ratio score the distribution the rollouts came from, logits
|
| 820 |
+
# / GRPO_TEMP (the harness's TEMP). Optimizer split as in EI's fine-tune (Muon on the matrices, AdamW on
|
| 821 |
+
# the rest), at a tenth of its rates. v2 (2026-10-14) used AdamW 1e-4 on everything, no ratio, loss at
|
| 822 |
+
# T=1, and collapsed: unparseable samples up to 100%, entropy spikes to 0.9.
|
| 823 |
+
GRPO_G = 8 # rollouts per target per round
|
| 824 |
+
GRPO_LR, GRPO_MUON_LR, GRPO_WARMUP = FT_LR / 10, FT_MUON_LR / 10, 20
|
| 825 |
+
GRPO_TEMP = 0.8 # must equal the harness's sampling TEMP (asserted there)
|
| 826 |
+
GRPO_CLIP_LOW, GRPO_CLIP_HIGH, GRPO_DUAL_CLIP = 0.2, 0.28, 3.0
|
| 827 |
+
GRPO_LEN_NORM = 256 # constant per-rollout token normaliser
|
| 828 |
+
GRPO_RETAIN_W = 0.5 # retained-pretraining SFT term per step, in place of EI's replayed records
|
| 829 |
+
|
| 830 |
+
|
| 831 |
+
def rl_grpo(model, tok, targets, train_recs, oracle, device, seed, log):
|
| 832 |
+
rng = random.Random(seed)
|
| 833 |
+
gen = torch.Generator(device=device)
|
| 834 |
+
gen.manual_seed(seed)
|
| 835 |
+
found = {t["name"]: {} for t in targets}
|
| 836 |
+
matrices = [p for p in model.blocks.parameters() if p.ndim == 2] + [model.head.weight]
|
| 837 |
+
matrix_ids = {id(p) for p in matrices}
|
| 838 |
+
auxiliary = [p for p in model.parameters() if id(p) not in matrix_ids]
|
| 839 |
+
opt = torch.optim.AdamW(auxiliary, lr=GRPO_LR, weight_decay=0.0, betas=(0.9, 0.95))
|
| 840 |
+
muon = MuonStep(matrices, device)
|
| 841 |
+
probe = Probe(model, tok, train_recs, oracle, device, log)
|
| 842 |
+
autocast = torch.autocast("cuda", dtype=torch.bfloat16, enabled=(device == "cuda"))
|
| 843 |
+
rounds, round_secs, history, step = 0, 0.0, [], 0
|
| 844 |
+
while oracle.left() > 1.15 * round_secs:
|
| 845 |
+
t0 = oracle.used()
|
| 846 |
+
model.n_loops = RL_FIRST_LOOPS
|
| 847 |
+
picked = pick_targets(targets, found, rng)
|
| 848 |
+
rows = oracle.sample_rollouts(model, picked, GRPO_G)
|
| 849 |
+
rs = rollout_stats(model, tok, rows, device) # on-policy, before the found-proof injection and the update
|
| 850 |
+
items, adv, st = [], [], collections.Counter()
|
| 851 |
+
for row in rows:
|
| 852 |
+
for p in row["proofs"]:
|
| 853 |
+
found[row["name"]].setdefault(norm(p), p)
|
| 854 |
+
group = [(ids, float(ok)) for ids, ok in row["rollouts"]]
|
| 855 |
+
if not any(r for _, r in group) and found[row["name"]]:
|
| 856 |
+
group[0] = (tok.encode_proof(rng.choice(list(found[row["name"]].values()))), 1.0)
|
| 857 |
+
st["injected"] += 1
|
| 858 |
+
mean = sum(r for _, r in group) / len(group)
|
| 859 |
+
if mean in (0.0, 1.0):
|
| 860 |
+
st["all_fail" if mean == 0 else "all_pass"] += 1
|
| 861 |
+
continue
|
| 862 |
+
prompt = tok.encode_prompt(row["prompt"])
|
| 863 |
+
items += [(prompt, ids) for ids, _ in group]
|
| 864 |
+
adv += [r - mean for _, r in group]
|
| 865 |
+
st["groups"] += 1
|
| 866 |
+
if items:
|
| 867 |
+
retain = [(tok.encode_prompt(r["prompt"]), tok.encode_proof(r["proof"]))
|
| 868 |
+
for r in rng.sample(train_recs, min(len(items), len(train_recs)))]
|
| 869 |
+
loss, n_steps, ratio = pg_update(model, tok, items, adv, retain, opt, muon, step, gen, rng, autocast, device)
|
| 870 |
+
step += n_steps
|
| 871 |
+
st["steps"], st["items"] = n_steps, len(items)
|
| 872 |
+
st.update(ratio)
|
| 873 |
+
rounds += 1
|
| 874 |
+
probe.measure(model, rows, rounds)
|
| 875 |
+
round_secs = oracle.used() - t0
|
| 876 |
+
history.append({"round": rounds, **st, "rollouts": rs})
|
| 877 |
+
log(f"grpo round {rounds}: {dict(st)}, {fmt_stats(rs)}, round {round_secs:.0f}s, {oracle.left():.0f}s left")
|
| 878 |
+
model.n_loops = DEFAULT_LOOPS
|
| 879 |
+
model.eval()
|
| 880 |
+
return {"rounds": rounds, "algo": "grpo", "g": GRPO_G, "lr": GRPO_LR, "muon_lr": GRPO_MUON_LR, "temp": GRPO_TEMP,
|
| 881 |
+
"clip": [GRPO_CLIP_LOW, GRPO_CLIP_HIGH, GRPO_DUAL_CLIP], "len_norm": GRPO_LEN_NORM,
|
| 882 |
+
"retain_w": GRPO_RETAIN_W, "history": history, "probe": probe.history}
|
| 883 |
+
|
| 884 |
+
|
| 885 |
+
def token_logp(model, x):
|
| 886 |
+
"""log p of each next token of x under logits / GRPO_TEMP, the sampling distribution: (B, T-1)."""
|
| 887 |
+
logits = model(x[:, :-1]).float() / GRPO_TEMP
|
| 888 |
+
return -torch.nn.functional.cross_entropy(
|
| 889 |
+
logits.reshape(-1, logits.size(-1)), x[:, 1:].reshape(-1), reduction="none"
|
| 890 |
+
).view(len(x), -1)
|
| 891 |
+
|
| 892 |
+
|
| 893 |
+
def ppo_surrogate(ratio, a):
|
| 894 |
+
"""Per-token objective to maximise: PPO's clipped min(r a, clip(r) a) with the asymmetric range
|
| 895 |
+
[1 - GRPO_CLIP_LOW, 1 + GRPO_CLIP_HIGH], and for a < 0 floored at GRPO_DUAL_CLIP * a so a token whose
|
| 896 |
+
ratio has grown large cannot drive an unbounded push-down."""
|
| 897 |
+
surr = torch.min(ratio * a, ratio.clamp(1 - GRPO_CLIP_LOW, 1 + GRPO_CLIP_HIGH) * a)
|
| 898 |
+
return torch.where(a < 0, torch.max(surr, GRPO_DUAL_CLIP * a), surr)
|
| 899 |
+
|
| 900 |
+
|
| 901 |
+
def pg_update(model, tok, items, adv, retain, opt, muon, step0, gen, rng, autocast, device):
|
| 902 |
+
"""One pass over the round's rollouts in token-budget batches, each step paired with a retained
|
| 903 |
+
pretraining batch (augmented, as in pretraining). Per token, the PPO clipped surrogate with ratio
|
| 904 |
+
p / p_old, p_old scored before the first step. Returns (last loss, steps, ratio stats)."""
|
| 905 |
+
ids, mask, _, lens = to_gpu(items, tok, device)
|
| 906 |
+
adv_t = torch.tensor(adv, device=device)
|
| 907 |
+
r_ids, r_mask, r_ref, r_lens = to_gpu(retain, tok, device)
|
| 908 |
+
order, cuts = token_batches(lens, len(items), gen, rng, first=0)
|
| 909 |
+
r_order, r_cuts = token_batches(r_lens, len(retain), gen, rng, first=0)
|
| 910 |
+
old = torch.zeros(ids.shape[0], ids.shape[1] - 1, device=device)
|
| 911 |
+
model.eval()
|
| 912 |
+
with torch.no_grad():
|
| 913 |
+
for s, e, T in cuts:
|
| 914 |
+
idxs = order[s:e]
|
| 915 |
+
x, _ = gpu_batch(ids, mask, None, lens, idxs, tok, gen, T, augment=False)
|
| 916 |
+
with autocast:
|
| 917 |
+
old[idxs, : T - 1] = token_logp(model, x)
|
| 918 |
+
model.train()
|
| 919 |
+
loss = torch.zeros(())
|
| 920 |
+
clipped = ratio_sum = n_tok = 0.0
|
| 921 |
+
for k, (s, e, T) in enumerate(cuts):
|
| 922 |
+
step = step0 + k + 1
|
| 923 |
+
warm = min(1.0, step / GRPO_WARMUP)
|
| 924 |
+
for g in opt.param_groups:
|
| 925 |
+
g["lr"] = GRPO_LR * warm
|
| 926 |
+
idxs = order[s:e]
|
| 927 |
+
x, m = gpu_batch(ids, mask, None, lens, idxs, tok, gen, T, augment=False)
|
| 928 |
+
m = m[:, 1:]
|
| 929 |
+
a = adv_t[idxs, None]
|
| 930 |
+
with autocast:
|
| 931 |
+
ratio = torch.exp(token_logp(model, x) - old[idxs, : T - 1])
|
| 932 |
+
pg = -(ppo_surrogate(ratio, a) * m).sum() / (len(idxs) * GRPO_LEN_NORM)
|
| 933 |
+
rs, re_, rT = r_cuts[k % len(r_cuts)]
|
| 934 |
+
rx, rm = gpu_batch(r_ids, r_mask, r_ref, r_lens, r_order[rs:re_], tok, gen, rT)
|
| 935 |
+
loss = pg + GRPO_RETAIN_W * loss_on(model, rx, rm)
|
| 936 |
+
with torch.no_grad():
|
| 937 |
+
out = (ratio < 1 - GRPO_CLIP_LOW) | (ratio > 1 + GRPO_CLIP_HIGH)
|
| 938 |
+
clipped += float((out & m).sum())
|
| 939 |
+
ratio_sum += float((ratio * m).sum())
|
| 940 |
+
n_tok += float(m.sum())
|
| 941 |
+
model.zero_grad(set_to_none=False) # grads keep fixed addresses for the Muon CUDA graph
|
| 942 |
+
loss.backward()
|
| 943 |
+
torch.nn.utils.clip_grad_norm_(model.parameters(), 1.0)
|
| 944 |
+
opt.step()
|
| 945 |
+
muon(GRPO_MUON_LR * warm)
|
| 946 |
+
model.eval()
|
| 947 |
+
return loss.item(), len(cuts), {"clip_frac": round(clipped / max(n_tok, 1), 4),
|
| 948 |
+
"ratio": round(ratio_sum / max(n_tok, 1), 4)}
|
runs/long-rl-20261014-v4_untied-ei_s1/source/remote.sh
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# Runs on the pod. Checks out Dan's fork at the pinned commit (model, sampler, nd2lean; the tokenizer and the Lean
|
| 3 |
+
# gate come from overlay/), installs Lean, runs the harness.
|
| 4 |
+
# Usage: ND_ARCH=untied|looped ND_RL=ei|grpo bash remote.sh <out-dir> [harness.py args...]
|
| 5 |
+
set -euo pipefail
|
| 6 |
+
FORK_COMMIT=51604b3feaa5e66821d1faba22238fe6d96d46d0 # dan-pandori/nd-takehome, branch dan_lean_seed2
|
| 7 |
+
export ND_FORK=/workspace/nd-takehome
|
| 8 |
+
OUT=$1; shift
|
| 9 |
+
HERE=$(cd "$(dirname "$0")" && pwd)
|
| 10 |
+
|
| 11 |
+
if [ ! -d "$ND_FORK/.git" ]; then
|
| 12 |
+
git clone -q https://github.com/dan-pandori/nd-takehome.git "$ND_FORK"
|
| 13 |
+
fi
|
| 14 |
+
git -C "$ND_FORK" cat-file -e "$FORK_COMMIT" 2>/dev/null || git -C "$ND_FORK" fetch -q origin
|
| 15 |
+
git -C "$ND_FORK" checkout -q "$FORK_COMMIT"
|
| 16 |
+
[ -f "$ND_FORK/data/train.jsonl" ] || gunzip -k "$ND_FORK/data/train.jsonl.gz"
|
| 17 |
+
# Lean 4 core is the only checker (overlay/lean_gate.py). Installed before harness.py starts, so it is not charged.
|
| 18 |
+
[ -x ~/.elan/bin/lean ] || curl -sSf https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh \
|
| 19 |
+
| sh -s -- -y --default-toolchain leanprover/lean4:v4.34.0 > /dev/null
|
| 20 |
+
export LEAN_GATE_WORKERS=$(nproc) LEAN_GATE_LOG="$OUT/lean_gate.jsonl" ND_DATA="$HERE/data"
|
| 21 |
+
mkdir -p "$OUT"
|
| 22 |
+
nvidia-smi --query-gpu=name,memory.total --format=csv,noheader
|
| 23 |
+
echo "cpus $(nproc), $(~/.elan/bin/lean --version), arm $ND_ARCH/$ND_RL"
|
| 24 |
+
PY=$(for p in python python3; do "$p" -c "import torch" 2>/dev/null && echo "$p" && break; done)
|
| 25 |
+
echo "python $($PY --version 2>&1), torch $($PY -c 'import torch; print(torch.__version__)')"
|
| 26 |
+
cd "$HERE"
|
| 27 |
+
$PY harness.py --out "$OUT" "$@" 2>&1 | tee "$OUT.log"
|
runs/long-rl-20261014-v4_untied-ei_s1/summary.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|