--- license: mit tags: - ml-intern - replication - chess - scaling-laws - reinforcement-learning --- [![Built with ML Intern](https://huggingface.co/datasets/huggingface/badges/resolve/main/built-with-ml-intern-sm.svg)](https://hf.co/chat?mode=ml-intern) # Replication: "Understanding Reasoning from Pretraining to Post-Training" Reduced-scale replication of core claims from **"Understanding Reasoning from Pretraining to Post-Training"** (Shen et al., arXiv:[2607.16097](https://arxiv.org/abs/2607.16097)), using the authors' released checkpoints, benchmark and code ([pavelslab-nyu](https://huggingface.co/pavelslab-nyu), [Pre2Post-Chess-RL](https://huggingface.co/Pre2Post-Chess-RL), [GitHub](https://github.com/pavelslab-nyu/pre2post-chess)). **Scope (agreed with the task owner):** T0 = rebuild + calibrate the eval harness against the authors' protocol; T2 = replicate the joint pretraining–RL scaling law (their Fig. 3); T4 = replicate the move-level mechanism analysis (their Sec. 4.1 / App. H). Faithful but reduced-scale; no training of our own. ## T0 — Eval harness (calibrated) We reconstructed the authors' exact evaluation protocol from their released code (verl fork rollout worker, `reward_function_multiturn.py`, `sft/evaluation/multiturn_puzzle_evaluator.py`): - **SFT protocol** (`code/eval_chess.py --protocol sft`): natural-CoT generation up to 1024 tokens from `{pgn}`, stopping at ``; then a move loop (≤32 tokens per move, stop at ``), env replies injected after ``, ≤5 solver moves, temp 1.0. Episode success = every solver move matches the ground-truth UCI line (= paper's pass@1). - **verl protocol** (`--protocol verl`, for RL checkpoints): fixed 1024-token thinking budget where a premature `` is replaced by `` and thinking continues; forced `` at budget exhaustion; answer phase (≤1536 tokens, ≤6 env calls); extraction = first LAN move after ``, else last LAN move in the segment (the authors' fallback). - Batched generation uses left padding (verified exactly equal to unbatched greedy generation); right padding was verified **incorrect**. Calibration on released checkpoints (B1+B2, 25/bin, k=8, temp 1.0): | checkpoint | protocol | pass@1 | pass@8 | first-move acc | |---|---|---|---|---| | SFT `model_20m_5.3B` | sft | 1.5% | 8% | 5.3% | | SFT `model_680m_16B` | sft | 2.5% | 12% | 15.3% | | RL `model_20m_5.3B` @ step 5000 | verl | 3.3% | 12% | — | This already reproduces three qualitative claims: RL improves pass@1 without improving pass@k; larger pretraining improves move quality; absolute pass@1 is percent-level, consistent with the paper's own R₀(L) = 14.62·10^(−4.30·L) fit. Dominant failure mode at 20M: illegal committed moves (~78%), matching the authors' own `illegal_move` failure category. ## T2 — Joint pretraining–RL scaling law **Data.** 48 RL evals across the full 20M family (10 pretraining budgets × up to 5 RL steps; steps 100–5000) on the paper's fitting bins **B3+B4** (`results/t2/`), plus a focused high-power sweep on **B1+B2** (6 pretraining levels × 3 RL steps, 640 draws/point; `results/t2b_*.json`). Pretraining validation loss L(N,T) computed on 3000 held-out Lichess 2023-01 games (460k tokens per checkpoint; `results/loss/`) — a *proxy* for the authors' unreleased val split. **Finding 1 (B3+B4 floors out).** On the paper's fitting bins, the entire 20M family measures 0–1% pass@1 (B4 = 0.000 in all 48 evals; only 40B@step4900 reaches 1%). At our measurement scale (400 draws/point vs the paper's ~8900) these bins cannot resolve the correlation. The paper used B3–B4 to avoid saturation of *larger* models; at 20M with our draw budget nothing saturates, so we moved the high-power sweep to B1+B2. **Finding 2 (claim 4a — pretraining loss predicts post-RL pass@1: reproduced directionally).** On B1+B2, measured pass@1 at fixed RL compute (step 5000) vs our L: **Spearman ρ = −0.54, Pearson r = −0.63** (n = 6; lower pretraining loss → higher post-RL pass@1). The paper reports ρ = −0.93…−0.99 via R_ref extrapolated to C_ref = 10²⁰ FLOPs; our extrapolated R_ref is noise-dominated (ρ = +0.60, wrong sign) because each per-run slope is fit from 3 points with ±0.7% per-point noise and then extrapolated ~3.5 decades. We therefore treat the non-extrapolated correlation as our replication of 4a and report the extrapolation failure as a scale limitation. Measured points (B1+B2, step 5000): | pretrain tokens | L (ours) | pass@1 | |---|---|---| | 0.53B | 0.704 | 2.0% | | 1.6B | 0.588 | 3.3% | | 5.3B | 0.531 | 2.5% | | 11B | 0.513 | 3.6% | | 32B | 0.488 | 4.4% | | 53B | 0.480 | 2.8% | **Finding 3 (claim 4b — RL slope grows with log pretraining tokens: not resolvable).** Per-run slopes B from 3-point curves at our noise level are unidentified (Pearson r(B, log T) = −0.66, wrong sign, driven by one noisy point). The paper's r = +0.84 over 36 runs with ~8900 draws/point is outside what this budget can resolve. ## T4 — Mechanism analysis (RL policy evolution) Induced root-conditioned move policies π̂(a|s) via K=10–12 verl-protocol trace rollouts per puzzle and teacher-forced move scoring (paper: K=128), 12 puzzles each from B1 (easy), B4, B5 (hard); SFT vs RL steps 100/300/500; Table-13 categorization (top-k=3, ε_tail=0.05). Counts per bin (`results/t4_mechanism.json`): | category | B1 (rl100/300/500) | B4 | B5 | |---|---|---|---| | gt_amplification | 1/2/2 | 4/3/4 | 2/3/3 | | tail_discovery | 3/1/4 | 0/2/0 | 2/2/0 | | gt_regression | 1/2/1 | 0/1/1 | 0/1/3 | | topk_correction | 1/1/1 | 0/0/1 | 0/0/1 | | wrong_mode_amplification | 0/1/0 | 2/1/3 | 2/1/1 | | other | 6/5/4 | 6/5/3 | 6/5/5 | **Partially reproduced / not resolved.** All five categories of the authors' taxonomy occur, including tail discovery on hard bins at intermediate RL steps (2/12 on B4 at step 300; 2/12 on B5 at steps 100–300). But the paper's headline contrast (amplification concentrated on easy puzzles, discovery on hard ones) is not resolved at K≈12 rollouts and 12 puzzles/bin: our dominant consistent signal is amplification on B4/B5, and single-count swings dominate. K=128 and larger puzzle samples would be needed for a decisive test. ## Deviations from the paper 1. **Validation loss is a proxy** (held-out Lichess 2023-01 games, our tokenization/windows) — absolute L values are not comparable to the authors'; correlations use our internally consistent L. 2. **Measurement scale**: 400–640 draws/point vs the paper's ~8900; K≈12 rollouts vs 128 for T4. This is the dominant limitation and is the explanation we propose for the un-resolved claims, since the harness itself is calibrated against the authors' code paths. 3. **Bin substitution for the high-power sweep** (B1+B2 instead of B3+B4), justified above. 4. 20m_21B/40B RL runs excluded from loss correlations (no released pretrain checkpoint for those budgets). 5. RL-compute C per step estimated as 10·N·2048·(L_prompt+L_resp) with measured prompt length and assumed response length (paper App. D); slopes are unaffected by the constant. ## Artifacts - `code/` — eval harness, val-loss computation, scaling-law fit, mechanism analysis - `results/t2/` — 48 B3+B4 RL evals + B1+B2 evals (`t2b_*` tags) - `results/loss/` — held-out pretraining loss for 32 checkpoints - `results/fit_results.json` — all fit statistics - `results/t4_mechanism.json` — induced policies + category counts - Calibration JSONs: `results/t2/…` (see T0 table; B1+B2 25/bin runs) ## Citation Paper: https://arxiv.org/abs/2607.16097 — Shen, Li, Rahman, Sun, Goldblum, Telgarsky, Izmailov, "Understanding Reasoning from Pretraining to Post-Training", 2026. All checkpoints/data evaluated here are the authors' release.