Sam Babichenko

Reading notes / Running RL at scale

Popular and rare tokens

Wang et al., 2026; Yang et al., 2025

One position
ssa state: the prompt and the tokens generated so far
aathe token sampled at ss
b,b, cctokens of the vocabulary
zbz_blogit of token bb at ss
πb\pi_bprobability of token bb at ss, ezb/∑cezce^{z_b}/\sum_ce^{z_c}
π\pithe vector of the πb\pi_b
eae_aindicator vector of the token aa
πold\pi_{\rm old}the sampler, the policy that generated the batch
πθ\pi_\thetathe policy being trained
ppπold(a∣s)\pi_{\rm old}(a\mid s), the sampler's probability of the token in question
ρ\rhotoken ratio πθ(a∣s)/p\pi_\theta(a\mid s)/p
A^\hat Aadvantage of the token
η\etastep size
Δzb\Delta z_bchange in the logit zbz_b made by one update
Δπa\Delta\pi_again in the token's probability within one round of updates
SScollision probability ∑cπc2\sum_c\pi_c^2
πb∗\pi_{b^*}probability of the most likely token other than aa
H(s)H(s)entropy of the next-token distribution at ss
Updates and clipping
ε\varepsilonPPO's clip range: the gradient stops at ρ=1±ε\rho=1\pm\varepsilon
εhigh\varepsilon_{\rm high}upper clip range of clip-higher
μ\muoptimizer updates made on one batch of sampled answers
σz2\sigma_z^2variance of one update's change in a single logit (Wang et al., 2026)
σℓ\sigma_\ellstandard deviation of the ratios in probability bin ℓ\ell of a minibatch (ACPO)
εℓ\varepsilon_\ellACPO's clip range for bin ℓ\ell, 0.2+3σℓ0.2+3\sigma_\ell
δ\deltaRIPO's per-token budget for p(ρ−1)2p(\rho-1)^2
Answers and representations
qqprobability that one sampled answer solves a prompt
kknumber of samples in pass@kk
hˉi\bar h_iprojected, centered mean last-layer hidden state of answer ii
bib_iRepExp's elliptical bonus of answer ii
λ\lambdaridge term in RepExp's bonus
Constants
ε=0.2\varepsilon=0.2default clip range of PPO and GRPO
0.2,0.2, 33ACPO's base clip range and multiplier of σℓ\sigma_\ell
βrank=0.25\beta_{\rm rank}=0.25largest cut of a correct answer's reward in the unlikeliness reward
Paper symbols
πi,t\pi_{i,t}what Wang et al. (2026) write for pp
κ2\kappa^2Wang et al.'s (2026) per-update drift scale, σz2\sigma_z^2 times a factor between 1 and 2
r(θ)r(\theta)what Cai et al. write for ρ\rho
pass@NNwhat He et al. write for pass@kk

Context. A policy-gradient update on a sampled token raises its logit and lowers every other logit at the same position. RL methods for reasoning disagree on whether rare tokens should move more or less. low-probability token isolation (Yang et al., 2025): each batch's tokens are split at probability 0.5 and the low-probability ones are updated first, then the rest. The same paper's advantage reweighting multiplies each token's advantage by α\alpha times its probability plus 1−α1-\alpha damps rare tokens because their gradients dominate the update. Training only on the 20% of positions in a chain of thought with the highest next-token entropy, where the reasoning can branch (Wang et al., 2025); a gradient on them alone matched or beat the full gradient. Reading note: Entropy collapse in RL for reasoning isolates high-entropy positions where the sampled token tends to be unlikely. PPO's clip with a larger upper bound than lower bound, [1−εlow,1+εhigh][1-\varepsilon_{\rm low},1+\varepsilon_{\rm high}] with εhigh>εlow\varepsilon_{\rm high}\gt\varepsilon_{\rm low}, so that a token with positive advantage can rise further in one round of updates. Reading note: DAPO and Dr. GRPO lets rare tokens rise further, and low-probability regularization (Huang et al., 2025): for low-probability tokens in wrong answers, a KL penalty toward the policy's own next-token distribution with its least likely tokens removed and the rest renormalized keeps them from being pushed to zero. Each reports gains.

Three quantities govern which tokens an update moves. One sample shifts a token's logit in proportion to one minus its probability, so rare samples carry the largest gradients. Over repeated sampling, a token appears only in proportion to its probability, so a rare token gets almost no expected push. Within a round, PPO's clip stops pushing a token up once its probability rises by a fixed fraction of itself. For a rare token, that gain is tiny in probability units. Rare tokens dominate the first quantity and are starved by the other two. Each opposing method targets one of the three.

How far training runs off-policy decides which quantity dominates. Wang et al. (2026) show that the variance of a token's probability ratio grows as the square of one minus its probability. As updates per batch rise from 2 to 16, rare tokens drift outside the clip window first, and popular tokens take over the update. Lopti was developed near on-policy, using 2 updates per batch in its released scripts, while the forking-token method trained at 16. That difference reconciles their prescriptions. Wang et al.'s reruns confirm how each method degrades as updates per batch grow, though not which method wins overall.

Setting. Fix a the prompt together with the tokens generated so far; the next token is the action with logits zbz_b and softmax probabilities πb=ezb/∑cezc\pi_b=e^{z_b}/\sum_ce^{z_c}, and write π\pi for the probability vector. The sampler the policy that generated the batch of answers, frozen while the batch is used; πθ\pi_\theta is the policy being trained, equal to πold\pi_{\rm old} at the start of a round draws token aa with probability pp=πold(a∣s){}=\pi_{\rm old}(a\mid s). The update adds ηA^ ∇log⁡πθ(a∣s)\eta\hat A\,\nabla\log\pi_\theta(a\mid s), where η\eta is the step size and the advantage the token receives; in GRPO, its answer's reward minus the mean reward of the answers sampled for the same prompt, divided by their standard deviation. Reading note: GRPO and DeepSeek-R1 is the advantage. At the start of a round, where πθ=πold\pi_\theta=\pi_{\rm old}, the logit gradient is∇zlog⁡πa=ea−π,\nabla_z\log\pi_a=e_a-\pi,with eae_a the indicator vector of aa. Raising the sampled token pulls logit from every other token in proportion to its probability. As updates proceed, the ratio ρ\rho=πθ(a∣s)/p{}=\pi_\theta(a\mid s)/p tracks how far the token has moved. PPO's the surrogate min⁡(ρA^,clip⁡(ρ,1−ε,1+ε)A^)\min\big(\rho\hat A,\operatorname{clip}(\rho,1-\varepsilon,1+\varepsilon)\hat A\big), whose gradient is zero once ρ>1+ε\rho\gt1+\varepsilon for A^>0\hat A\gt0 or ρ<1−ε\rho\lt1-\varepsilon for A^<0\hat A\lt0; ε=0.2\varepsilon=0.2 by default. Reading note: DAPO and Dr. GRPO with range ε\varepsilon zeroes a positive-advantage token's gradient once ρ>1+ε\rho\gt1+\varepsilon.

For fixed A^\hat A, the three quantities are one sample's logit move, the expected move from the token's own draws, and the gain Δπa\Delta\pi_a before the clip stops its gradient within a round:one sample:Δza=ηA^ (1−p),own draws:p⋅ηA^ (1−p),clip:Δπa≤εp.\begin{aligned}\text{one sample:}&\quad\Delta z_a=\eta\hat A\,(1-p),\\\text{own draws:}&\quad p\cdot\eta\hat A\,(1-p),\\\text{clip:}&\quad\Delta\pi_a\le\varepsilon p.\end{aligned}The first sets the gradient norm, since ∥ea−π∥\|e_a-\pi\| lies between 1−p1-p and 2 (1−p)\sqrt2\,(1-p). Yang et al. (2025) bound the gradient at every layer's activations by the same 1−p1-p factor. The second weights that move by the draw probability pp, giving the expected push from the token's own draws at state ss across batches. The third caps the gain in probability units. Once the token rises by εp\varepsilon p within a round, its own samples stop pushing it. At p=0.01p=0.01 and ε=0.2\varepsilon=0.2, its own samples stop pushing after a 0.002 gain, however large its gradient. Only updates on other tokens can move it further through shared parameters.

Near on-policy the clip rarely binds, so the per-sample gradient drives the batch. Yang et al. (2025) split tokens of GRPO batches on logic puzzles into four probability bands of width 0.25. The lowest band carries the largest gradients. Updating only that band shifted the top band's probabilities more than updating the top band itself, because all positions share parameters. Yang et al. damp rare tokens by reweighting their advantages or by updating them first. Combining both raised a 3B model's puzzle score by 46% relative. On math, damping raised a 7B model's averages by 0.6 to 1.3 points. Each result comes from one seed.

Off-policy, token ratios spread across updates, and they spread most for rare tokens. Wang et al. (2026) model one update's logit changes Δzb\Delta z_b as uncorrelated across the vocabulary with common variance the variance of one update's change in a single logit, the same for every token of the vocabulary in Wang et al.'s (2026) model. By the softmax gradient, ρ−1≈Δlog⁡πa=Δza−∑bπbΔzb\rho-1\approx\Delta\log\pi_a=\Delta z_a-\sum_b\pi_b\Delta z_b to first order:ρ−1≈(1−p) Δza−∑b≠aπbΔzb,Var⁡ρ≈σz2(1−p)2+σz2∑b≠aπb2.\begin{aligned}\rho-1&\approx(1-p)\,\Delta z_a\\&\quad-\textstyle\sum_{b\ne a}\pi_b\Delta z_b,\\\operatorname{Var}\rho&\approx\sigma_z^2(1-p)^2\\&\quad+\sigma_z^2\textstyle\sum_{b\ne a}\pi_b^2.\end{aligned}That variance lies between σz2(1−p)2\sigma_z^2(1-p)^2 and 2σz2(1−p)22\sigma_z^2(1-p)^2. Measured variance scales as (1−p)1.90±0.14(1-p)^{1.90\pm0.14} across 54,173 tokens grouped into 20 probability bins. Drift accumulates over the the number of optimizer updates made on one batch of sampled answers before new ones are drawn; the last update uses answers sampled μ−1\mu-1 updates earlier, so μ=1\mu=1 is on-policy. Reading notes: μ-GRPO, Weighting stale samples in off-policy RL, pushing rare tokens outside a fixed clip window first. On Qwen2.5-7B math at μ=16\mu=16, DAPO's clip removed 35 to 50% of tokens with p<0.4p\lt0.4, against 5 to 15% of those with p>0.8p\gt0.8. In GRPO runs on the same model and task, gradient-norm dominance reverses as training moves off-policy. Low-probability tokens carry far larger norms than high-probability ones near on-policy, and smaller norms far off-policy.

Damping rare tokens helps while their gradients dominate, but cuts into surviving signal once clipping already drops many of them. At μ=16\mu=16, restricting updates to high-entropy positions instead preserves the rare-token updates that remain. Wang et al. (2026) rerun both methods on Qwen2.5-7B math at μ=2\mu=2 and μ=16\mu=16. On the six-benchmark average, Lopti with advantage reweighting drops from 33.42 to 26.47, while the forking-token method moves only from 35.41 to 35.02. Plain DAPO beats both at both settings. Their own method, adaptive clip policy optimization (Wang et al., 2026): PPO-style clipping with a separate clip range for each bin of the sampler's token probability, widens the clip window where ratios spread. It sorts tokens into five equal-width bins of pp and clips bin ℓ\ell at 1±εℓ1\pm\varepsilon_\ell. Here εℓ=0.2+3σℓ\varepsilon_\ell=0.2+3\sigma_\ell, where σℓ\sigma_\ell is the minibatch standard deviation of ratios in bin ℓ\ell. ACPO ranks first in 15 of 18 combinations of benchmark, model, and μ\mu, counting the six math benchmarks separately and including two ties. Its mean rank is 1.22, against 2.56 for DAPO.

Updates on popular and rare tokens push next-token H(s)=−∑bπblog⁡πbH(s)=-\sum_b\pi_b\log\pi_b, the entropy of the next-token distribution at ss. Cui et al. (2025) derive its first-order change under an update. Reading note: Entropy collapse in RL for reasoning in opposite directions. Cui et al. (2025) show that an update shifts entropy to first order by ΔH≈−Covb∼π(log⁡πb,Δzb)\Delta H\approx-\mathrm{Cov}_{b\sim\pi}(\log\pi_b,\Delta z_b). Since log⁡πb\log\pi_b is larger for popular tokens, raising a popular token's logit makes that covariance positive and lowers entropy. Raising a rare token's logit has the opposite sign and raises entropy. Off-policy clipping therefore speeds up entropy collapse. Positive updates on popular tokens survive the clip and shrink entropy, whereas positive updates on rare tokens get clipped first. Cui et al.'s (2025) fixes: Clip-Cov removes from the gradient a small random fraction of the tokens whose centered product of log-probability and advantage is far above average, and KL-Cov penalizes the change in log-probability of the top fraction ranked by that product. Reading note: Entropy collapse in RL for reasoning restrain the few tokens with the largest covariance, and clip-higher raises the upper cap for rare tokens.

Clip-higher raises the upper bound by the same factor for every token, so a rare token's own samples still stop pushing after a gain of εhighp\varepsilon_{\rm high}p. Sizing the window per token gives rare ones more room. Riemannian isometric policy optimization (Cai et al., 2026): a clip whose half-width for a token is δ/p\sqrt{\delta/p}, so that every sampled token may use the same budget δ\delta of the divergence. Reading note: Trust regions in LLM reinforcement learning (Cai et al., 2026) gives every token the same budget δ\delta for its second-order KL term 12p(ρ−1)2\tfrac12p(\rho-1)^2. Absorbing the factor of 2 into δ\delta yields∣ρ−1∣≤δ/p,Δπa≤δp.\begin{aligned}|\rho-1|&\le\sqrt{\delta/p},\\\Delta\pi_a&\le\sqrt{\delta p}.\end{aligned}The ratio window widens as tokens get rarer, so the probability cap scales as p\sqrt p rather than pp. ACPO's bins widen the window for rare tokens in a similar way, using their measured ratio spread.

When an advantage is negative, the token's probability determines where the freed mass lands. For A^<0\hat A\lt0, the logit step is Δz=η∣A^∣ (π−ea)\Delta z=\eta|\htmlData{gr=g8}{\hat A}|\,(\pi-e_a), so Δzb=η∣A^∣πb\Delta z_b=\eta|\hat A|\pi_b for b≠ab\ne a and Δza=η∣A^∣(p−1)\Delta z_a=\eta|\hat A|(p-1). Write SS=∑cπc2{}=\sum_c\pi_c^2 for the collision probability. To first order, every token b≠ab\ne a moves byΔlog⁡πb=Δzb−∑cπcΔzc,∑cπcΔzc=η∣A^∣ (S−p),Δπb≈η∣A^∣ πb (πb+p−S).\begin{aligned}\Delta\log\pi_b&=\Delta z_b-\textstyle\sum_c\pi_c\Delta z_c,\\\textstyle\sum_c\pi_c\Delta z_c&=\eta|\hat A|\,(S-p),\\\Delta\pi_b&\approx\eta|\hat A|\,\pi_b\,(\pi_b+p-S).\end{aligned}If p>Sp\gt S, which holds whenever the wrong token is the most likely one, every other token gains and mass spreads over alternatives in ranked order. Zhu et al. (2025) use that spread to explain training on wrong answers alone. On MATH with Qwen2.5-Math-7B, it holds the base model's pass@256 at 96.9%, while training on correct answers alone drops it to 91.2%. If the wrong token is rare (p≈0p\approx0), only tokens with πb>S\pi_b\gt S gain, so the mass is squeezed into the mode. The most likely other token always gains because S≤p2+πb∗(1−p)S\le p^2+\pi_{b^*}(1-p) for its probability πb∗\pi_{b^*}. Ren and Sutherland (2025) call this the squeezing effect and show it in DPO's negative gradient. Lp-Reg protects rare tokens against that squeeze. In on-policy runs on Qwen3-14B, it averages 60.17% across five math benchmarks, 2.66 points above the forking-token method trained on-policy the same way.

Whole answers face the same sampling arithmetic, since on average an answer is pushed in proportion to its probability. On Lean theorem proving, He et al. (2025) find that GRPO raises the probability of a group's most likely correct proofs while rarely lifting its least likely ones. They call this GRPO's tendency to raise the probability of a group's most likely correct answers and not of its least likely ones, measured by the fraction of correct samples at each likelihood rank whose probability rose after training. Pass@NN improves at small NN, then gains less as NN grows. Their He et al.'s (2025) reward: the group's answers are ranked by likelihood under the sampler, and a correct answer's reward 1 is cut by up to βrank=0.25\beta_{\rm rank}=0.25, the cut falling linearly from the most likely answer to the least likely; wrong answers keep reward 0 cuts a correct answer's reward by up to βrank=0.25\beta_{\rm rank}=0.25, taking the largest cut from the most likely answer. Pairing that reward with a larger KL weight proves 8,023 of 9,600 theorems at least once in a single pass over the data, against 7,860 for default GRPO. Without that reward, running a second PPO epoch per batch with the same larger KL weight reaches 8,008 theorems. In He et al.'s reading, popular proofs hit the clip first, leaving later updates for rarer ones.

the probability that at least one of kk answers sampled for a prompt is correct objectives pay for rare correct answers through the reward itself. If one sample solves a prompt with probability qq, thenddq[1−(1−q)k]=k(1−q)k−1,\tfrac{d}{dq}\big[1-(1-q)^k\big]=k(1-q)^{k-1},so large kk concentrates the gradient on prompts the policy rarely solves. Chen et al. (2025) compute the resulting per-answer advantage in closed form from the group's counts of correct and wrong answers.

Credit can also come from internal representations instead of token probabilities. RepExp (Tuyls et al., 2026) builds the projected, centered average of the last-layer hidden states over the tokens of answer ii by averaging each answer's last-layer hidden states across tokens, centering within the prompt's group, and applying a sparse random projection to 32 to 128 dimensions. It then adds a small multiple of the bi=hˉi⊤M−1hˉib_i=\bar h_i^\top M^{-1}\bar h_i with M=λI+∑jhˉjhˉj⊤M=\lambda I+\sum_j\bar h_j\bar h_j^\top, the leverage of answer ii among the group's answers; it is large when hˉi\bar h_i points where the other answers' representations are sparse to each answer's reward,bi=hˉi⊤(λI+∑jhˉjhˉj⊤)−1hˉi,b_i=\bar h_i^\top\big(\lambda I+\textstyle\sum_j\bar h_j\bar h_j^\top\big)^{-1}\bar h_i,with ridge term λ>0\lambda\gt0 and jj running over the group. The bonus is large when hˉi\bar h_i points into directions sparsely covered by the group's other answers. On Qwen2.5-7B-Instruct trained on DAPO math problems across three seeds, RepExp reaches GRPO's AIME 2024 pass@256 score at pass@80. Its MATH answers are also less likely under the base model than GRPO's.

Attention offers a cheaper internal signal, while activation probes show the hazard of optimizing against internal features. Li et al. (2026) score each token by the mean attention it receives from later tokens and multiply the advantages of the top 40% by 1.5. On Countdown, that lifts Qwen3-4B-Base from 52.6% to 60.4%. When Cundy and Gleave (2025) labeled preference data with a lie detector on the original model's activations, GRPO learned answers that evade it. Deception rates stayed above 85% unless the detector's true-positive rate or the KL weight was high. Gupta and Jenner (2025) trained directly against classifiers on a model's internal activations that flag a behavior such as deception or a harmful answer; a probe used as a training signal can be evaded. Reading note: Shaping and monitoring through representations on the policy's own activations. RL learned to evade probes that average per-token scores, while max-pooled and attention-based probes held.

Consequences. Log the clip fraction by bin of pp. With one or two updates per batch, rare samples dominate the gradient, and damping them helped in Yang et al.'s runs. At high μ\mu, clipping already drops many rare tokens. Widen their window with ACPO's bins or a δ/p\sqrt{\delta/p} band rather than damping them further. When coverage at large kk matters, reward rare or novel correct answers.

Limits. The off-policy reconciliation rests on a first-order model with uncorrelated logit changes, backed by the variance fit and by gradient norms and clip fractions on Qwen2.5-7B math. The sharper off-policy drop for Lopti with advantage reweighting holds on math and Countdown, whereas on table question answering both methods lose 1.5 to 2.5 points. ACPO reports no repeated training runs, and its significance tests treat the 8 or 32 evaluation samples per problem as replicates. Lopti uses one seed. Lp-Reg's lead comes from on-policy runs scored at each run's best checkpoint, and its 8-update variant leads at neither model size. The attention-credit paper reports no repeated runs, and amplifying randomly chosen tokens also gained 2.4 points. RepExp picked each seed's checkpoint by pass@1 on AIME 2024, the same set it reports.

Terms

Softmax gradient
∇zlog⁡πa=ea−π\nabla_z\log\pi_a=e_a-\pi: the sampled logit rises by 1−p1-p, every other falls by its probability
Three quantities
one sample 1−p1-p; own draws p(1−p)p(1-p); clip gain Δπa≤εp\Delta\pi_a\le\varepsilon p
Ratio spread
Var⁡ρ≈σz2[(1−p)2+∑b≠aπb2]\operatorname{Var}\rho\approx\sigma_z^2[(1-p)^2+\sum_{b\ne a}\pi_b^2], measured exponent 1.90 on 1−p1-p
Dominance reversal
rare tokens dominate the gradient near on-policy; at μ=16\mu=16 their ratios are clipped and popular tokens dominate
ACPO
clip at 1±εℓ1\pm\varepsilon_\ell, εℓ=0.2+3σℓ\varepsilon_\ell=0.2+3\sigma_\ell, in five bins ℓ\ell of pp
Entropy change
ΔH≈−Cov(log⁡πb,Δzb)\Delta H\approx-\mathrm{Cov}(\log\pi_b,\Delta z_b): gains on popular tokens lower it, on rare ones raise it
RIPO window
∣ρ−1∣≤δ/p|\rho-1|\le\sqrt{\delta/p}, so Δπa≤δp\Delta\pi_a\le\sqrt{\delta p}
Negative sample
Δπb≈η∣A^∣πb(πb+p−S)\Delta\pi_b\approx\eta|\hat A|\pi_b(\pi_b+p-S), S=∑cπc2S=\sum_c\pi_c^2: a wrong token with p>Sp\gt S spreads mass, a rare one squeezes it into the mode
Unlikeliness reward
cut a correct answer's reward by up to 0.25, most for the group's most likely answer
Pass@k gradient
k(1−q)k−1k(1-q)^{k-1}: large kk pays for prompts rarely solved
RepExp bonus
hˉi⊤(λI+∑jhˉjhˉj⊤)−1hˉi\bar h_i^\top(\lambda I+\sum_j\bar h_j\bar h_j^\top)^{-1}\bar h_i over the group's answers

Sources

Connected notes

  • Performative predictionStrategic and performative prediction · Feedback between a model and its data

    Retraining follows only the part of the gradient with the data held fixed, so when the model's effect on its own data outweighs the curvature, retraining can converge to the worst model.

  • With two gradient steps per batch the PPO loss is clipped on fewer than 5% of tokens, and turning clipping off, then dropping the ratio as well, does not hurt, since the policy has little room to move far from the one that sampled the data.

  • Naming the best of several Gaussian arms with error at most δ\delta takes at least about 4σ2log⁡(1/δ)/(μ1−μ2)24\sigma^2\log(1/\delta)/(\mu_1-\mu_2)^2 samples, so the cost grows without bound as the top two means approach each other, and a tolerance ε\varepsilon on the named arm keeps it finite.

  • Because the judge's decision decides whose outcome is observed, evaluating on released cases alone or imputing the rest overstates the model's performance, and a model trained on them can learn that a screened-in group is safe.

Threads