Elegant proof in Sampler Replay paper: Full-vocab Score Centering equals Logits Replay

apsarathchandar · x · 2026-12-03

A highlighted proof from the Sampler Replay paper: in Full-vocab Score Centering, subtracting E{pμ}[∇log pπ] makes the trainer's distribution pπ cancel cleanly, leaving A(ey − pμ) — exactly the same upstream gradient obtained by replaying sampler logits via STE, proving the two techniques mathematically equivalent.

The original post notes SC only fixes the output layer, while Sampler Replay extends the idea to hidden states and MoE routing. The attached figure walks through the full derivation: under train-inference mismatch the trainer's score function has non-zero expectation under the sampler's distribution, and subtracting it yields the corrected loss whose logit gradient proves the equivalence.

Related event: Mila's Sampler Replay: Train the Sampler, Not the Trainer in RLVR(6 posts)→

Original post →

More from Models

Models channel →