The previous lesson sorted the gap between rollout engine and trainer by its shape and removed what could be removed. This one asks a sharper question about what is left: why is RL so sensitive to it at all? Supervised fine-tuning trains happily on text written by a different model, at a mismatch far larger than any bf16 rounding, with no correction. Yet a quantised sampler, or even a fixed random perturbation of the sampler’s weights, can collapse an online RL run. Marek and Ryabinin’s answer is a single term in the policy gradient — drift — and a correction that removes it by subtracting rather than reweighting.
Notation, as in the paper and at one fixed prefix : is the trainer’s probability of next token (what the site elsewhere calls or ), the sampler’s (the rollout engine’s ), and the score of token . The sampled token is ; is the rollout’s reward or advantage.
Why SFT shrugs off mismatch and RL does not
Policy gradient with advantages in on a fixed dataset is SFT on the positive examples (rejection fine-tuning). So RL differs from SFT in two places only: the reward mode (negative advantages exist) and online sampling (the data come from the current policy). The paper separates the two with a controlled mismatch: Qwen3-1.7B on Countdown, with the sampler’s weights perturbed by a small fixed amount, trained offline and online under three reward modes. The result is a mirror image:
- Offline, training is stable only with rewards. With negative rewards the objective is unbounded below — of a negative sample can be pushed to on a dataset that never changes — and the squeezing effect (Ren & Sutherland) sharpens the distribution onto whatever is already likely.
- Online, rewards are the least stable and group-centred rewards the most stable.
So there are two mechanisms. The offline one is well known. The online one is what this lesson is about, and the clue is in a footnote of the paper: on-policy, adding a constant to every reward does not change the expected gradient (group centring only rescales it by ); its only purpose is variance reduction. Off-policy, a constant shift does change the expected gradient — which means the gradient contains a term that sees the reward only through its mean.
The constant-reward experiment
Give every rollout reward . There is nothing to learn, and on-policy the expected update is zero at every prefix, because the score has mean zero under the distribution it is the score of:
Under mismatch the token is drawn from but the score goes through , and the cancellation is gone:
The ratio that appears is the inverse importance ratio: multiplying each score by would restore the zero. What direction is ? Holding fixed,
The constant-reward update is SFT with the sampler as the teacher. In the coordinates of the final logits , where , it is simply : push the trainer’s next-token distribution toward the sampler’s. (The first NumPy block checks the KL identity by finite differences.)
Drift and signal
Now let the reward vary. The covariance identity applied at one prefix, with the expectation over the sampled token and the rest of the rollout (both from ), gives the paper’s Eq. 3:
The signal is the only part that knows which token led to which reward: raises tokens whose rollouts did better than average at this prefix and lowers the others. The drift depends on the rewards only through their mean, points along , and vanishes whenever or the prefix’s expected reward is zero — which can happen at any depth even with . With a positive mean it pulls the trainer toward the sampler, with a negative mean it pushes it away. It is the distillation of the last section, scaled (and signed) by how good the prefix is.
A fixed teacher is harmless; a moving one is not. If were a fixed model, drift would be ordinary distillation and converge to the maximum-likelihood fit of . But the sampler is a biased copy of the trainer — quantised, stale or computed with different kernels — and it is refreshed from the trainer at every sync. A toy makes the consequence exact. Let the trainer’s logits at a prefix be , the sampler’s for a fixed mismatch direction , and the expected advantage there . The drift moves the logits by
Tilting a distribution by can only raise the mean of (), so the bracket is positive whenever is not constant on the support. With the trainer moves along at every step; the refreshed sampler is again ahead of it; the push never ends until has collapsed onto — the token the numerical error favours. With it collapses onto instead. Freeze the sampler (offline) and the same equation with converges to and stops; with it pushes away from a fixed without bound — the offline negative-reward instability again. As the paper’s conclusion puts it, what matters is not the size of the mismatch but whether the teacher is fixed or tracks the student. This also explains why rewards are the worst online setting: at every prefix, so drift always pulls the same way.
Group centring does not remove it
Group-centred advantages , with the group mean, sum to zero over the rollouts of a prompt. But drift is a per-prefix quantity. With and constants dropping out of the covariance,
Prompt-level centring guarantees the bracket is zero only at the root (); at deeper prefixes it is zero only where a prefix happens to be exactly as good as its group, and in general drift remains. A prefix that is on its way to a correct answer has positive expected advantage, so the trainer is pulled toward the sampler there; a prefix that already contains a mistake has negative expected advantage, so it is pushed away — whether or not the next token affects the reward at all. A formatting token after a correct derivation is pulled toward the sampler’s formatting habits. Group centring shrinks the coefficient compared with rewards (consistent with it being the most stable online setting), but does not make it zero.
Two consequences are easy to get wrong. A group whose rewards are all equal has for every token: it contributes neither signal nor drift, so there is nothing for any correction to fix there. And a baseline equal to the exact value of each prefix, , would cancel drift in expectation — that is a critic. Score centering obtains the same expected update without one.
Score centering
Instead of centring the reward per prefix (which needs a value function), centre the score. Replace every token’s score by
a vector that is deterministic given the prefix — the same for every token that could be sampled there. Both expectations are under , so at every prefix, even off-policy, and Eq. 3 becomes the paper’s Eq. 5:
the last step because subtracting a constant does not change a covariance. Drift is gone and the signal is untouched. When , and the method is a no-op. As a loss, with the stop-gradient (surrogate gradients):
What is left. On-policy the update is ; score centering gives . In logit coordinates for one step, the first is and the second : the same form, with the sampler deciding how much each token’s signal counts. This residual is zero when the reward is constant, so unlike drift it cannot produce a reward-independent push that feeds back through the sampler — but it is not zero, and it grows when the trainer moves far from the sampler (staleness). Two further things no per-token correction touches: the prefixes themselves were visited under , not (only a sequence-level ratio corrects that — sequence vs token), and anything that is not a difference of next-token distributions (a re-tokenised sequence, a different chat template) is a bug, not a mismatch.
Relation to baselines. Subtracting a zero-mean quantity is the classical variance-reduction trick (reward baselines, score-function control variates); it relies on and leaves the mean unchanged. Score centering is the opposite: a bias correction that deliberately shifts the mean. Classical off-policy RL could not do this because is an intractable sum over the action space; for an LLM it is a sum over the next token’s vocabulary, which the sampler has just computed.
이전 레슨은 rollout 엔진과 trainer의 차이를 모양별로 나누고 없앨 수 있는 것을 없앴다. 이 레슨은 남은 것에 대해 더 날카로운 질문을 던진다. RL은 애초에 왜 이렇게 민감한가? SFT는 다른 모델이 쓴 텍스트로도 잘 학습한다. 그 불일치는 bf16 반올림과는 비교도 안 되게 크고, 보정도 없다. 그런데 양자화된 sampler, 아니 sampler weight에 고정된 작은 섭동 하나만으로도 online RL 실행이 무너진다. Marek과 Ryabinin의 답은 정책 경사 안의 항 하나, drift다. 그리고 그것을 재가중이 아니라 빼기로 없애는 보정이다.
표기는 논문을 따르고, 하나의 고정된 prefix 에서 본다. 는 다음 토큰 에 대한 trainer의 확률(사이트의 다른 곳에서 나 라 부른 것), 는 sampler의 확률(rollout 엔진의 ), 는 토큰 의 score다. 샘플된 토큰은 이고 은 rollout의 보상 또는 advantage다.
SFT는 불일치를 견디는데 RL은 왜 못 견디나
advantage가 이고 고정된 데이터셋에서 하는 정책 경사는 양의 예시에 대한 SFT(rejection fine-tuning) 그 자체다. 그러니 RL이 SFT와 다른 곳은 둘뿐이다. 보상 방식(음의 advantage가 있다)과 online 샘플링(데이터가 현재 정책에서 온다)이다. 논문은 통제된 불일치로 둘을 떼어 낸다. Countdown의 Qwen3-1.7B에서 sampler weight를 고정된 작은 양만큼 섭동하고, offline과 online, 세 가지 보상 방식으로 학습한다. 결과는 거울상이다.
- Offline에서는 보상일 때만 안정적이다. 음의 보상이면 목적함수가 아래로 유계가 아니다. 바뀌지 않는 데이터셋에서 음의 샘플의 를 까지 밀 수 있고, squeezing 효과(Ren & Sutherland)가 분포를 이미 확률 높은 쪽으로 날카롭게 만든다.
- Online에서는 보상이 가장 불안정하고 group-centred 보상이 가장 안정적이다.
메커니즘이 둘이라는 뜻이다. offline 쪽은 잘 알려져 있다. online 쪽이 이 레슨의 주제이고, 단서는 논문의 각주에 있다. on-policy에서는 모든 보상에 상수를 더해도 기대 gradient가 바뀌지 않는다(group centering은 그것을 배 할 뿐이다). 목적은 분산 감소뿐이다. off-policy에서는 상수 이동이 기대 gradient를 바꾼다. gradient 안에 보상을 평균으로만 보는 항이 있다는 뜻이다.
상수 보상 실험
모든 rollout에 보상 을 주자. 배울 것이 없고, on-policy에서는 모든 prefix에서 기대 업데이트가 0이다. score는 그것이 score인 분포 아래에서 평균이 0이기 때문이다.
불일치가 있으면 토큰은 에서 뽑히는데 score는 를 지나므로 상쇄가 사라진다.
여기 나타나는 는 importance ratio의 역수다. score마다 를 곱하면 0이 되돌아온다. 는 어느 방향인가? 를 고정하면
이다. 상수 보상의 업데이트는 sampler를 teacher로 하는 SFT다. 마지막 logit 의 좌표에서는 이므로 그냥 다. trainer의 다음 토큰 분포를 sampler 쪽으로 민다. (첫 NumPy 블록이 KL 항등식을 유한 차분으로 확인한다.)
Drift와 signal
이제 보상이 달라지게 하자. 하나의 prefix에서 공분산 항등식 를 쓰면(기댓값은 샘플된 토큰과 rollout의 나머지에 대한 것이고, 둘 다 에서 나온다) 논문의 Eq. 3이 된다.
signal만이 어느 토큰이 어느 보상으로 이어졌는지 안다. 는 이 prefix에서 평균보다 나은 rollout의 토큰을 올리고 나머지를 내린다. drift는 보상을 평균으로만 보고 방향을 가리키며, 이거나 또는 prefix의 기대 보상 가 0이면 사라진다. 후자는 여도 어느 깊이에서든 일어날 수 있다. 평균이 양수면 trainer를 sampler 쪽으로 당기고, 음수면 밀어낸다. 앞 절의 증류에 prefix가 얼마나 좋은지를 (부호까지) 곱한 것이다.
고정된 teacher는 해가 없고, 움직이는 teacher는 해롭다. 가 고정된 모델이라면 drift는 평범한 증류라서 의 최대우도 적합으로 수렴한다. 그러나 sampler는 trainer의 편향된 사본이고 — 양자화됐거나, 낡았거나, 다른 kernel로 계산된 — sync마다 trainer에서 갱신된다. 장난감 하나가 그 결과를 정확히 보여 준다. 어떤 prefix에서 trainer의 logit을 , sampler의 logit을 고정된 불일치 방향 에 대해 , 그곳의 기대 advantage를 라 하자. drift는 logit을
만큼 움직인다. 분포를 로 기울이면 의 평균은 오르기만 하므로(), 가 support에서 상수가 아닌 한 괄호는 양수다. 이면 trainer는 매 step 방향으로 움직이고, 갱신된 sampler는 다시 그보다 앞에 있다. 밀기는 가 — 수치 오차가 선호하는 토큰 — 로 붕괴할 때까지 끝나지 않는다. 이면 대신 로 붕괴한다. sampler를 고정하면(offline) 같은 식은 에서 로 수렴하고 멈추며, 에서는 고정된 로부터 를 끝없이 밀어낸다. offline 음의 보상 불안정이 다시 나온다. 논문의 결론대로, 중요한 것은 불일치의 크기가 아니라 teacher가 고정돼 있는지 student를 따라가는지다. 보상이 online에서 최악인 이유도 이것이다. 모든 prefix에서 이므로 drift가 늘 같은 쪽으로 당긴다.
Group centering은 이것을 지우지 못한다
group-centred advantage (는 그룹 평균)는 한 프롬프트의 rollout들에 걸쳐 합이 0이다. 그러나 drift는 prefix마다의 양이다. 로 두고 공분산에서 상수가 빠진다는 것을 쓰면
이다. 프롬프트 단위 중심화가 괄호를 0으로 보장하는 곳은 root()뿐이다. 더 깊은 prefix에서는 그 prefix가 우연히 그룹 평균만큼 좋을 때만 0이고, 일반적으로 drift가 남는다. 정답으로 가는 중인 prefix는 기대 advantage가 양수라서 거기서 trainer는 sampler 쪽으로 당겨진다. 이미 실수를 담은 prefix는 기대 advantage가 음수라서 밀려난다. 다음 토큰이 보상에 영향을 주든 말든 그렇다. 맞는 유도 뒤의 서식 토큰은 sampler의 서식 습관 쪽으로 당겨진다. group centering은 보상에 비해 이 계수를 줄이지만(online에서 가장 안정적이었던 것과 맞는다) 0으로 만들지는 않는다.
틀리기 쉬운 결론이 둘 있다. 보상이 모두 같은 그룹은 모든 토큰의 이다. signal도 drift도 내지 않으므로 어떤 보정이든 거기서 고칠 것이 없다. 그리고 각 prefix의 정확한 가치와 같은 baseline 는 기댓값에서 drift를 지운다. 그것이 critic이다. score centering은 critic 없이 같은 기대 업데이트를 얻는다.
Score centering
보상을 prefix마다 중심화하는 대신(가치함수가 필요하다) score를 중심화하자. 모든 토큰의 score를
로 바꾼다. 빼는 벡터는 prefix가 주어지면 결정적이다. 그 자리에서 샘플될 수 있는 모든 토큰에 대해 같다. 두 기댓값이 모두 아래이므로 off-policy여도 모든 prefix에서 이고, Eq. 3은 논문의 Eq. 5가 된다.
마지막 단계는 상수를 빼도 공분산이 바뀌지 않기 때문이다. drift는 사라지고 signal은 그대로다. 이면 이라 아무 일도 하지 않는다. 손실로 쓰면(는 stop-gradient, 정지 기울기)
이다.
남는 것. on-policy 업데이트는 이고 score centering은 를 준다. 한 step의 logit 좌표에서 앞의 것은 , 뒤의 것은 다. 같은 꼴이고, 각 토큰의 signal을 얼마나 셀지를 sampler가 정한다. 이 잔차는 보상이 상수면 0이므로 drift와 달리 sampler를 거쳐 되먹임되는 보상과 무관한 밀기를 만들 수 없다. 그러나 0은 아니고, trainer가 sampler에서 멀어지면(staleness) 커진다. 토큰 단위 보정이 건드리지 못하는 것이 둘 더 있다. prefix 자체가 가 아니라 아래에서 방문됐다는 것(시퀀스 단위 ratio만 이것을 고친다 — 시퀀스냐 토큰이냐), 그리고 다음 토큰 분포의 차이가 아닌 것(다시 tokenize한 시퀀스, 다른 chat template)은 불일치가 아니라 버그라는 것이다.
baseline과의 관계. 평균이 0인 양을 빼는 것은 고전적인 분산 감소 기법이다(보상 baseline, score-function control variate). 그것은 에 기대고 평균을 바꾸지 않는다. score centering은 반대다. 평균을 일부러 옮기는 bias 보정이다. 고전적 off-policy RL은 가 행동 공간 전체에 대한 다루기 힘든 합이라 이것을 할 수 없었다. LLM에서는 다음 토큰 vocabulary에 대한 합이고, sampler가 방금 계산한 것이다.
Things to notice, beyond the caption:
- Defaults (ε = 1.2, Ā = +0.5, σ = 0.6, online): plain policy gradient never learns y*; its p(★) ends near 1. The signal is there and of the same size as for every other rule — drift simply out-pushes it once the sampler’s favourite gains mass, and the online refresh keeps the push alive.
- σ = 0 isolates drift. SC and SC + TIS are exactly flat (their expected update is identically zero), and so is the on-policy line. At the default ε = 1.2 and Ā = +0.5, TIS and MIS still move: that motion is the drift their clipping and masking leave behind (at ε = 0.4 the largest initial ratio is about 1.98, below the TIS cap of 2, so TIS stays flat too), derived in the next section. Switch the bars to TIS: the tokens it drags down are the ones whose trainer probability exceeds twice the sampler’s — here the tokens the offset disfavours most.
- ε = 0.4: every rule except plain ends where the on-policy line ends (0.996 at step 400, to three decimals; along the way TIS differs from it by at most about 0.02). This is the regime where the paper’s best methods overlap and cannot be told apart within a short run — it takes many more steps for mild drift to matter.
- ε = 2: only SC and SC + TIS still learn. They are slower than on-policy because their signal is weighted by the sampler (y*‘s sampler probability is small here) — the covariance-under- residual, visible as a gap, not as a collapse.
Additive vs multiplicative corrections
Importance sampling also cancels drift — when it is exact. Apply any weight to the score and use the covariance identity again:
For exact IS, — provided wherever . Numerical mismatch with a full softmax satisfies this; a hard top-k, top-p or mask on the sampler side does not, and then the sum runs only over the sampler’s support. With and a top-1 sampler , a constant reward with weight on the observable token gives the logit update , not zero. For TIS with cap , using ,
so TIS leaves drift exactly on the tokens whose trainer probability exceeds times the sampler’s — the tokens the sampler under-samples, which are also the ones whose signal TIS truncates. For MIS / IcePop with band , the drift direction is : drift on the masked-out tokens. The second NumPy block shows the consequence in an online loop: a token with ratio above 5 at its prefix is the rewarded one, TIS clips it, and the trainer drifts away from it.
The difference in kind is variance. The IS weight is a random multiplicative factor that depends on the sampled token; its second moment is for exact IS (the weight’s second moment — the gradient’s variance also depends on and ) (importance sampling), which is why every practical method clips or masks it — and reintroduces drift. The score-centering term is additive and deterministic given the prefix: it is computed exactly from the sampler’s logged distribution, needs no threshold, and has no hyperparameter.
| Rule (per token) | Drift direction left at a prefix, | Signal term | Weight size |
|---|---|---|---|
| Plain policy gradient | |||
| Exact token IS | if | (at this prefix) | unbounded; |
| TIS, cap (= CISPO’s weight) | each | ||
| MIS / IcePop, band | (masked tokens drop out) | each | |
| Score centering | |||
| SC on top of | for any | — not in general between the - and -covariances | that of |
Composing them (the paper’s Appendix A.2). Let IS reweight first and then centre the weighted score:
Its expected update under a constant reward is zero for any weighting function , clipped or masked. With exact IS the subtracted term is : there is nothing left to centre. The two pieces therefore divide the work: centring removes the drift that clipping reintroduces, and the weights change the signal from to — exactly for exact IS. For clipped or masked weights that is not guaranteed to lie between the - and -covariances: with , , and an MIS band , both ratios (9 and 0.11) fall outside the band, every token is masked and the update is zero, although both unweighted covariances equal in logit coordinates.
Which is why the trade-off shows up only under staleness. For numerical mismatch, and are close, the covariance residual is small, and SC alone is as good as the combination. When the trainer has moved many updates past the sampler, the residual matters and the combination wins — the paper recommends composing SC with an IS correction “whenever the trainer can move far from the sampler between syncs”. Its experiments also explain an old observation: PPO’s and DAPO’s clips survive staleness but collapse under quantisation and weight noise, because their clip is designed for ratios produced by policy movement; numerical error does not produce such ratios.
The top-k approximation
Exact centring needs the sampler’s full next-token distribution at every position. For a 152K vocabulary that is about 608 KB per token in fp32; for 1,024 rollouts of 32K tokens, about 20 TB (the paper’s numbers). The paper logs only the sampler’s top- log-probs (head , ) and models the tail with the trainer’s own probabilities, rescaled to the sampler’s tail mass (Eq. 9; the paper calls the scale , renamed here because is the PPO ratio on this site):
The expectation over the whole vocabulary then collapses onto the head, because lets the tail sum be replaced by minus the head sum (Eq. 10):
Only coefficients per position, and the loss is (Eq. 8). The tail model is not a cosmetic detail: dropping the tail and using would break the no-op property — at it equals — while the rescaled version gives coefficients exactly. The third NumPy block measures both.
With an IS weight , the tail ratio is constant, , so the same reduction gives head coefficients with (Eq. 12); for vanilla SC and ; for exact IS gives and , so the term vanishes, as it should.
Cost and accuracy, as reported. With the runs finished within 1% of the baselines’ wall-clock time for both model sizes (with the authors’ own JAX sampler, which computes top- log-probs during decoding; vLLM and SGLang expose top- log-probs natively, but the paper did not measure their overhead). The head covered more than 99.9% of the sampler’s mass on average in every setting except INT8 weights/activations with an INT4 KV cache at 30B (99.45% on average, 95.8% in the worst batch), and and even matched full-vocabulary centring in every setting (Appendix A.4). Two implementation details: the sampled token may fall outside the head, so its sampler log-prob is stored separately; and must be the distribution the token was actually drawn from — if the engine samples with temperature or top-p but returns raw log-probs, the centring term is computed for the wrong and the cancellation no longer holds (sampling masks and processed log-probs). verl exposes the method as score_centering in its rollout correction (verl’s rollout correction).
What the experiments show
Setup. Every method is applied in isolation on one shared objective — REINFORCE with group-centred rewards, 8 completions per prompt, one SGD step per batch at learning rate — with all importance ratios computed against the sampler’s logged probabilities and default parameters (TIS/CISPO clip ; MIS/IcePop drop outside ; PPO and DAPO with dual clip at 3; GSPO at sequence level ; TOPR; DPPO with a total-variation threshold 0.2). Qwen3-0.6B-Instruct trains on Countdown with 64 prompts per batch and a maximum length of 512; Qwen3-30B-A3B-Base on the maths subset of INTELLECT-2 with 16 prompts and a maximum length of 1,024.
- Synthetic weight noise (0.6B; , Gaussian, fixed): methods collapse earlier as noise grows — DPPO at roughly step 160, 80 and 20 across the three scales; TIS is stable at the smallest and collapses at roughly 180 and 40 at the larger two. At the largest noise only SC, SC + TIS and SC + MIS train stably.
- INT8 sampler (weights, activations and KV cache quantised, trainer bf16): SC alone and its compositions perform best.
- Staleness (the inference engine updated only every 64 steps): SC composed with TIS or MIS performs best, better than SC alone. PPO and DAPO survive staleness but collapse under quantisation and weight noise.
- 30B (800 steps, no router replay — which the paper notes would be preferable in practice): with an FP8 sampler, uncorrected policy gradient is stable at 58% training accuracy. With an FP4 KV cache, policy gradient collapses within 200 steps and MIS late in training, while SC reaches 52% and TIS 51%. With an INT8 sampler and an INT4 KV cache, SC reaches 30%, TIS 12%, every other method below 5%.
How to read this. The mismatches are deliberately severe and the sequences short (512 and 1,024 tokens), as a proxy for long training under mild mismatch — the authors could not separate the best methods under natural mismatch within a few GPU-hours, which is itself what accumulating drift predicts. The same view reconciles two reports the paper cites: FP8 rollouts that stayed stable with token-level IS, and runs that diverged despite bf16 sampling; mild mismatch destabilises too, it just takes more steps. Seeds: three per curve for the small models; at 30B many methods ran once, with more seeds for the best ones (SC 5 and 4, TIS 4 and 3 in the two harder panels). The 30B and quantisation curves are training accuracy; the noise sweep is held-out accuracy.
When it helps, and when it is not the tool
- Helps most with a persistent numerical gap in an online loop: quantised or low-precision rollouts, kernel differences, any mismatch that does not average out and is refreshed with the weights. It also removes the drift that clipping and masking leave, so it belongs on top of TIS/IcePop rather than instead of them.
- Needs IS alongside under heavy staleness, because its signal is measured under the sampler; add an ESS-triggered resynchronisation as in DLC (asynchronous RL).
- Does nothing where there is no signal (zero-variance groups) — correctly, since there is no drift there either.
- Is not a substitute for removing causes: it does not change the function the trainer computes, so MoE routing flips still mean the score is taken through a different expert (replay routes — mismatch engineering); it does not correct the distribution of prefixes; and it is exactly as correct as the you log.
- Needs the sampler’s top- log-probs ( = 32–128) and the sampled token’s log-prob at every position, and a REINFORCE-style per-token loss to attach to.
Implementing it
First the identities, exactly, on a two-token toy: the reward depends only on the first token, so the true gradient at the second position is zero and anything a rule does there is drift or clipping residue.
import numpy as np
np.set_printoptions(precision=3, suppress=True)
def softmax(z):
e = np.exp(z - z.max(-1, keepdims=True))
return e / e.sum(-1, keepdims=True)
# A two-token "language": y1, y2 in {0..5}. Logits z1 (V,) and z2[y1] (V,) are the trainer's parameters.
# Scores are taken w.r.t. the logits: d log p_v / dz = e_v - p (one row per token v).
rng = np.random.default_rng(0)
V = 6
z1, z2 = rng.normal(0, 1, V), rng.normal(0, 1, (V, V))
D1, D2 = rng.normal(0, 1, V), rng.normal(0, 1, (V, V)) # fixed direction of the engine mismatch
R = np.array([1, 1, 0, 0, 0, 0.]) # reward depends on y1 only: y2 is "formatting"
I = np.eye(V)
def expected_update(eps, rule, C=2.0):
"""Exact expectation (enumerating all 36 sequences) of the per-token update for one rule.
Tokens are drawn from the sampler q = softmax(z + eps*D); scores go through the trainer p."""
p1, p2 = softmax(z1), softmax(z2)
q1, q2 = softmax(z1 + eps * D1), softmax(z2 + eps * D2)
A = R - q1 @ R # group-centred advantage (infinite group)
f = {'plain': lambda r: 1 + 0 * r, 'SC': lambda r: 1 + 0 * r, 'IS': lambda r: r,
'TIS': lambda r: np.minimum(r, C), 'SC+TIS': lambda r: np.minimum(r, C)}[rule]
centre = rule.startswith('SC')
def pos(q, p, adv): # E_{y~q}[adv(y) * (w_y s_y - centring term)]
ws = f(p / q)[:, None] * (I - p) # weighted scores, one row per token
if centre:
ws = ws - q @ ws # subtract E_q[w s]: deterministic given the prefix
return (q * adv) @ ws
g1 = pos(q1, p1, A)
g2 = np.array([q1[a] * pos(q2[a], p2[a], A[a] * np.ones(V)) for a in range(V)])
true1 = p1 * (R - p1 @ R) # on-policy gradient; position 2 truly has none
return np.linalg.norm(g1 - true1), np.linalg.norm(g2), np.linalg.norm(true1)
q1 = softmax(z1 + 1.0 * D1)
print("expected advantage after each first token y1 (eps=1):", R - q1 @ R)
print(" at the root prefix: %.1e -> group centring guarantees zero drift only at the root\n" % abs(q1 @ (R - q1 @ R)))
print(" eps rule |error at pos 1| |update at pos 2| (|true grad at pos 1| = %.3f, at pos 2 = 0)"
% expected_update(0, 'plain')[2])
for eps in [0.0, 0.5, 1.0, 2.0]:
for rule in ['plain', 'IS', 'TIS', 'SC', 'SC+TIS']:
e1, n2, _ = expected_update(eps, rule)
print(f" {eps:3.1f} {rule:7s} {e1:12.4f} {n2:12.4f}")
# Constant reward R = 1, one position: the plain update is exactly -grad KL(q || p_theta), i.e. SFT on the sampler.
p, q = softmax(z1), softmax(z1 + D1)
drift = q @ (I - p) # E_q[score] = q - p in logit coordinates
kl = lambda z: np.sum(q * (np.log(q) - np.log(softmax(z))))
fd = np.array([(kl(z1 + 1e-6 * I[v]) - kl(z1 - 1e-6 * I[v])) / 2e-6 for v in range(V)])
print("\nconstant reward: E_q[score] =", drift, "\n -grad KL(q||p) =", -fd,
"\n max |difference| = %.1e" % np.abs(drift + fd).max())Read the two columns separately. Position 2 carries no reward information at all, so its true gradient is zero. Plain policy gradient puts 0.077 there at ε = 1 and 0.135 at ε = 2 — comparable to the whole true gradient (0.182) — because after the first token the expected advantage is +0.72 or −0.28, not zero. TIS shrinks that to 0.017 and 0.025 (the clipped-token residue); SC and SC + TIS make it exactly zero; exact IS also does. Position 1 is the root, where group centring already removed drift: what remains for plain and SC alike (0.099 at ε = 1) is the covariance measured under instead of , which IS removes and TIS partly removes (0.022) — the piece SC alone does not fix. The last lines confirm that the constant-reward update equals to .
Now the feedback loop with sampled minibatches and a sampler that is refreshed from the trainer after every step. Two prefixes: “on track” (expected advantage about +0.5) and “already wrong” (about −0.5); in both, token y* earns a small bonus.
import numpy as np
def softmax(z):
e = np.exp(z - z.max(-1, keepdims=True))
return e / e.sum(-1, keepdims=True)
# Two prefixes: "on track" (state 0) and "already wrong" (state 1), each 50% of rollouts. The policy picks one
# of V tokens there; token y* earns a small bonus in both. Reward = 1[on track] + 0.3 * 1[y = y*]; advantages
# are centred by the batch mean. The sampler is the trainer plus a FIXED logit offset eps*D, refreshed each step.
V, N, steps, lr, eps, C = 8, 256, 200, 2.0, 1.0, 2.0
rng0 = np.random.default_rng(1)
D = rng0.normal(0, 1, (2, V))
z0 = rng0.normal(0, 0.5, (2, V))
ystar = 3
fav, unfav = D[0].argmax(), D[1].argmin()
print("trainer/sampler ratio p/q at the start, per prefix:\n", (softmax(z0) / softmax(z0 + eps * D)).round(2))
def run(rule, seed=0):
rng = np.random.default_rng(seed)
z = z0.copy()
for _ in range(steps):
p, q = softmax(z), softmax(z + eps * D) # online: the sampler tracks the trainer
s = (rng.random(N) < 0.5).astype(np.intp) # prefix of each rollout
y = (rng.random(N)[:, None] > np.cumsum(q[s], 1)).sum(1).clip(0, V - 1) # y ~ q(. | s)
Rw = (s == 0) + 0.3 * (y == ystar)
A = Rw - Rw.mean()
w = np.ones(N) if rule in ('plain', 'SC') else np.minimum(p[s, y] / q[s, y], C)
upd = w[:, None] * (np.eye(V)[y] - p[s]) # weighted score d log p(y|s) / dz_s
if rule.startswith('SC'): # subtract E_q[w s] at this prefix (exact: V is small)
wq = np.minimum(p / q, C) if rule == 'SC+TIS' else np.ones((2, V))
cbar = q * wq - (q * wq).sum(1, keepdims=True) * p
upd = upd - cbar[s]
g = np.zeros((2, V))
np.add.at(g, s, A[:, None] * upd)
z = z + lr * g / N
return softmax(z)
print(f"\nstart: p(y*|on)={softmax(z0)[0, ystar]:.3f} p(y*|wrong)={softmax(z0)[1, ystar]:.3f}")
print("rule p(y*|on) p(y*|wrong) p(sampler-favourite|on) p(sampler-least-favourite|wrong)")
for rule in ['plain', 'TIS', 'SC', 'SC+TIS']:
P = np.mean([run(rule, k) for k in range(2)], 0)
print(f"{rule:7s} {P[0, ystar]:8.3f} {P[1, ystar]:10.3f} {P[0, fav]:16.3f} {P[1, unfav]:24.3f}")Plain policy gradient learns nothing it was rewarded for: after 200 updates the on-track prefix puts 0.96 on the sampler’s favourite token and the already-wrong prefix 0.97 on its least favourite — attraction and repulsion, as derived. TIS learns y* after the wrong prefix (0.97) but not after the on-track one (0.03): there y* has at the start, so TIS clips exactly the rewarded token, and the drift it leaves pulls the trainer away from it. SC learns both (0.90 and 0.97), and SC + TIS is best (0.97 and 0.98), because TIS also moves the covariance toward while centring cancels what the clip leaves.
Finally the top-k approximation, on 32 positions of a 32K vocabulary with peaked and flat next-token distributions.
import numpy as np
def softmax(z):
e = np.exp(z - z.max(-1, keepdims=True))
return e / e.sum(-1, keepdims=True)
# 32 positions over a 32k vocabulary, from confident to uncertain. In logit coordinates the score of token v
# is e_v - p, so a weighted sum of scores sum_v c_v (e_v - p) = c - (sum c) p is cheap to form exactly.
rng = np.random.default_rng(0)
n, V = 32, 32_000
sharp = np.linspace(1.2, 3.0, n)[:, None] # Zipf exponent per position
z = 1.5 * rng.standard_normal((n, V)) - sharp * np.log(np.arange(1, V + 1))
p = softmax(z)
noise = rng.standard_normal((n, V))
cases = {
"dense noise (kernels, bf16)": z + 0.1 * noise,
"noisy tail (coarse quant)": z + 0.1 * noise + 0.6 * rng.standard_normal((n, V)) * (np.argsort(np.argsort(-z, 1), 1) >= 64),
}
wsum = lambda c: c - c.sum(1, keepdims=True) * p # rows: sum_v c_v (e_v - p)
rel = lambda a, b: np.median(np.linalg.norm(a - b, axis=1) / np.linalg.norm(b, axis=1))
for name, zq in cases.items():
q = softmax(zq)
exact = wsum(q) # s_bar = E_q[score] = q - p, per position
order = np.argsort(-q, 1) # the sampler logs its own top-k
print(f"{name}")
print(" k mean head mass median rel. error: head only head + rescaled trainer tail")
for k in [8, 32, 128]:
H = order[:, :k]
qH, pH = np.take_along_axis(q, H, 1), np.take_along_axis(p, H, 1)
kappa = (1 - qH.sum(1, keepdims=True)) / (1 - pH.sum(1, keepdims=True))
c_head, c_sc = np.zeros((n, V)), np.zeros((n, V))
np.put_along_axis(c_head, H, qH, 1)
np.put_along_axis(c_sc, H, qH - kappa * pH, 1) # Eq. 10: only k coefficients per position
print(f" {k:4d} {qH.sum(1).mean():12.5f} {rel(wsum(c_head), exact):22.3f} {rel(wsum(c_sc), exact):22.4f}")
# Sanity: on-policy (q = p) the rescaled-tail formula gives exactly zero; head-only does not.
H = np.argsort(-p, 1)[:, :32]; pH = np.take_along_axis(p, H, 1)
c = np.zeros((n, V)); np.put_along_axis(c, H, pH, 1)
print("\nq = p: |head-only term| = %.2e, |rescaled-tail term| = 0 (coefficients p_v - 1*p_v)" % np.linalg.norm(wsum(c), axis=1).mean())
# Composition with an IS weight f(r): head coefficients q_v f(r_v) - alpha p_v with alpha = kappa f(1/kappa).
q, i = softmax(cases["dense noise (kernels, bf16)"])[0], 0
H = np.argsort(-q)[:32]
kappa = (1 - q[H].sum()) / (1 - p[i, H].sum())
qhat = kappa * p[i].copy(); qhat[H] = q[H] # the reconstructed sampler over the full vocabulary
f = lambda r: np.minimum(r, 2.0) # TIS
full = qhat * f(p[i] / qhat); full = full - full.sum() * p[i]
c = np.zeros(V); c[H] = q[H] * f(p[i, H] / q[H]) - kappa * f(1 / kappa) * p[i, H]
print("TIS-composed centring: head-only formula vs full sum over qhat, max diff %.1e" % np.abs(c - c.sum() * p[i] - full).max())Ignoring the tail is worse than useless at small : with the head-only term is off by about twice the size of the drift it is meant to cancel, and even at it is off by about 10%. With the rescaled trainer tail the error is 0.6% at and below 0.1% at for dense noise. When quantisation distorts the tail’s shape — exactly what the tail model assumes away — the error grows (1.7% at , 0.5% at ) but stays small, because the tail carries little mass; this toy’s heads are flatter than a real LLM’s (96–97% mass at against the paper’s more than 99.9%). The last two lines check that the rescaled form is an exact no-op at and that the formula reproduces the full-vocabulary sum.
The loss in PyTorch, batched, with an optional IS weight — the paper’s Eq. 14 (its reference code is JAX).
import torch
def tis(r, cap=2.0): # truncated IS (TIS / CISPO weight)
return r.clamp(max=cap)
def mis(r, lo=0.5, hi=5.0): # masked IS (IcePop band)
return torch.where((r >= lo) & (r <= hi), r, torch.zeros_like(r))
def score_centering_loss(logits, tokens, samp_topk_ids, samp_topk_logp, samp_token_logp,
adv, mask, weight_fn=None, eps=1e-6):
"""logits: (B, T, V) trainer logits at the positions that predict `tokens` (B, T).
samp_topk_ids / samp_topk_logp: (B, T, K) the sampler's top-k ids and log-probs, from the distribution it
actually sampled (after temperature / top-p). samp_token_logp: (B, T) sampler log-prob of the sampled token,
stored separately because that token can fall outside the top-k. adv: (B,) advantages; mask: (B, T)."""
logp = torch.log_softmax(logits.float(), dim=-1) # FP32 log-softmax
tok_logp = logp.gather(-1, tokens.unsqueeze(-1)).squeeze(-1) # (B, T) log p(y_t)
head_logp = logp.gather(-1, samp_topk_ids) # (B, T, K) log p(v), v in head
f = weight_fn if weight_fn is not None else (lambda r: torch.ones_like(r))
with torch.no_grad(): # every coefficient is detached
p_head, q_head = head_logp.exp(), samp_topk_logp.exp()
kappa = (1 - q_head.sum(-1)).clamp_min(eps) / (1 - p_head.sum(-1)).clamp_min(eps) # tail-mass ratio
alpha = kappa * f(1.0 / kappa) # = kappa for vanilla SC
coef = q_head * f((head_logp - samp_topk_logp).exp()) - alpha.unsqueeze(-1) * p_head
w_tok = f((tok_logp - samp_token_logp).exp()) # IS weight of the sampled token
centred = w_tok * tok_logp - (coef * head_logp).sum(-1) # grad: w s_y - sum_H coef_v s_v
loss_tok = -adv.unsqueeze(-1) * centred
return (loss_tok * mask).sum() / mask.sum().clamp_min(1)
# usage: vanilla SC, SC + TIS, SC + MIS
# loss = score_centering_loss(logits, ids, topk_ids, topk_logp, tok_logp, adv, mask)
# loss = score_centering_loss(logits, ids, topk_ids, topk_logp, tok_logp, adv, mask, weight_fn=tis)
# loss = score_centering_loss(logits, ids, topk_ids, topk_logp, tok_logp, adv, mask, weight_fn=mis)You train with group-centred advantages and token-level TIS (cap 2). A colleague argues that drift cannot matter because the advantages of every group sum to zero. Which statement is correct?
Group centring zeroes , the expected advantage at the root. At a prefix the drift coefficient is : positive on promising prefixes, negative after mistakes, zero only where a prefix happens to match the group mean. TIS cancels drift only on tokens it does not clip; its residual direction is . Adding the score-centering term on top of the TIS-weighted score ( for the tail) removes the remainder for any cap.
Your sampler is an INT8 copy of the trainer, refreshed every step, and in another run a bf16 sampler that is synced only every 64 steps. In which run should score centering alone be enough, according to the paper's experiments and its derivation?
Score centering leaves instead of . For numerical mismatch , the difference is small, and SC alone matched its compositions with an INT8 sampler. Staleness makes and genuinely different policies; there SC + TIS/MIS was best and SC alone fell behind. The paper’s recommendation: compose with an IS correction whenever the trainer can move far from the sampler between syncs.
Summary
- At every prefix the off-policy policy gradient is . The drift term sees rewards only through their mean and is times that mean: distillation toward the sampler.
- Distillation toward a fixed teacher converges; toward a sampler that is a biased copy of the trainer and is refreshed from it, it never stops — in the toy, the policy collapses onto the token the numerical error favours. That is why online rewards are the least stable and SFT on foreign data is fine.
- Group centring guarantees zero drift only at the root; deeper prefixes have expected advantage equal to their value minus the group mean. Clipped and masked IS leave drift on the clipped tokens: for TIS.
- Score centering subtracts , an additive, deterministic term: drift is zero at every prefix, the signal becomes , and on-policy it is a no-op. Composed on top of any IS weight it cancels the drift that clipping reintroduces; under heavy staleness the composition is what works.
- In practice the sampler’s top- log-probs ( = 32–128) plus a rescaled trainer tail give the exact correction for an approximate sampler at under 1% cost; the reported gains are largest where mismatch is most severe (INT4 KV at 30B: 30% vs 12% for TIS).
캡션 너머로 볼 것:
- 기본값(ε = 1.2, Ā = +0.5, σ = 0.6, online): 평범한 정책 경사는 y*를 끝내 배우지 못하고 p(★)가 1 근처로 끝난다. signal은 다른 모든 규칙과 똑같은 크기로 있다. sampler가 선호하는 토큰이 질량을 얻으면 drift가 그것을 밀어내고, online 갱신이 그 밀기를 계속 살려 둔다.
- σ = 0은 drift만 떼어 낸다. SC와 SC + TIS는 정확히 평평하고(기대 업데이트가 항등적으로 0이다) on-policy 선도 그렇다. 기본 설정(ε = 1.2, Ā = +0.5)에서는 TIS와 MIS가 여전히 움직인다. 그 움직임이 clipping과 masking이 남기는 drift이고(ε = 0.4에서는 처음 최대 ratio가 약 1.98로 TIS 상한 2보다 작아 TIS도 평평하다) 다음 절에서 유도한다. 막대를 TIS로 바꿔 보면 끌려 내려가는 토큰은 trainer 확률이 sampler의 두 배를 넘는 토큰, 여기서는 오프셋이 가장 싫어하는 토큰들이다.
- ε = 0.4: plain을 뺀 모든 규칙이 on-policy 선과 같은 곳에서 끝난다(400 step에서 소수 셋째 자리까지 0.996. 도중에는 TIS가 최대 약 0.02 차이 난다). 논문의 최상위 방법들이 겹쳐서 짧은 실행 안에서는 구별되지 않는 영역이다. 약한 drift가 문제가 되려면 훨씬 많은 step이 걸린다.
- ε = 2: SC와 SC + TIS만 여전히 배운다. signal이 sampler로 가중되기 때문에(여기서 y*의 sampler 확률은 작다) on-policy보다 느리다. 공분산이 아래에서 재진다는 잔차이고, 붕괴가 아니라 간격으로 보인다.
가산 보정 대 곱셈 보정
importance sampling도 drift를 지운다. 정확할 때는. score에 어떤 가중치 를 곱하고 공분산 항등식을 다시 쓰면
이다. 정확한 IS에서는 이다. 단 인 모든 곳에서 이어야 한다. 전체 softmax에서 생긴 수치 불일치는 이를 만족하지만, sampler 쪽의 hard top-k·top-p·mask는 그렇지 않고, 그러면 합이 sampler의 support 위에서만 돈다. 이고 top-1 sampler 이면, 관측 가능한 토큰에 가중치 를 쓴 상수 보상의 logit 업데이트는 이고 0이 아니다. 상한 의 TIS는 을 쓰면
이므로, trainer 확률이 sampler의 배를 넘는 토큰 — sampler가 덜 뽑는 토큰이자 TIS가 signal을 잘라 버리는 바로 그 토큰 — 에 정확히 drift를 남긴다. 밴드 의 MIS / IcePop은 drift 방향이 , 즉 mask된 토큰 위의 drift다. 두 번째 NumPy 블록이 online 루프에서 그 결과를 보여 준다. 그 prefix에서 ratio가 5를 넘는 토큰이 보상받는 토큰이고, TIS는 그것을 자르며, trainer는 그것에서 멀어진다.
종류의 차이는 분산이다. IS 가중치는 샘플된 토큰에 따라 달라지는 무작위 곱셈 인자이고, 정확한 IS의 2차 모멘트는 다(가중치의 2차 모멘트다. gradient의 분산은 과 에도 달려 있다)(importance sampling). 그래서 실전의 모든 방법이 그것을 clip하거나 mask하고, drift를 다시 들여온다. score centering 항은 prefix가 주어지면 가산적이고 결정적이다. sampler가 기록한 분포로 정확히 계산하고, 문턱이 필요 없고, hyperparameter도 없다.
| 규칙(토큰별) | prefix에 남는 drift 방향, | signal 항 | 가중치 크기 |
|---|---|---|---|
| 평범한 정책 경사 | |||
| 정확한 토큰 IS | 이면 | (이 prefix에서) | 무한정, |
| TIS, 상한 (= CISPO의 가중치) | 각 | ||
| MIS / IcePop, 밴드 | (mask된 토큰은 빠진다) | 각 | |
| Score centering | |||
| 위의 SC | 어떤 든 | . 일반적으로 · 공분산 사이에 있지 않다 | 의 것 |
결합하기(논문 부록 A.2). IS가 먼저 재가중하고 가중된 score를 중심화한다.
상수 보상에서의 기대 업데이트는 clip하든 mask하든 어떤 가중 함수 에 대해서도 0이다. 정확한 IS라면 빼는 항이 이라 중심화할 것이 남지 않는다. 그러니 두 조각은 일을 나눈다. 중심화는 clipping이 다시 들여온 drift를 지우고, 가중치는 signal을 에서 로 바꾼다. 정확한 IS면 이것이 정확히 다. clip하거나 mask한 가중치에서는 · 공분산 사이에 있다는 보장이 없다. , , , MIS 밴드 이면 두 ratio(9와 0.11)가 모두 밴드 밖이라 모든 토큰이 mask되고 업데이트는 0인데, 가중치 없는 두 공분산은 logit 좌표에서 모두 다.
그래서 trade-off는 staleness에서만 드러난다. 수치 불일치에서는 와 가 가깝고 공분산 잔차가 작아서 SC만으로도 결합만큼 좋다. trainer가 sampler보다 여러 업데이트 앞서 가면 잔차가 중요해지고 결합이 이긴다. 논문은 “trainer가 sync 사이에 sampler에서 멀리 움직일 수 있을 때마다” SC를 IS 보정과 결합하라고 권한다. 실험은 오래된 관찰도 설명한다. PPO와 DAPO의 clip은 staleness는 견디지만 양자화와 weight 잡음에서는 무너진다. 그 clip은 정책 이동이 만드는 ratio를 위해 설계됐고, 수치 오차는 그런 ratio를 만들지 않기 때문이다.
top-k 근사
정확한 중심화에는 모든 위치에서 sampler의 다음 토큰 분포 전체가 필요하다. 152K vocabulary면 fp32로 토큰당 약 608 KB이고, 32K 토큰 rollout 1,024개면 약 20 TB다(논문의 숫자). 논문은 sampler의 top- log-prob(head , )만 기록하고, 꼬리는 trainer 자신의 확률을 sampler의 꼬리 질량에 맞게 rescale해 모델링한다(Eq. 9. 논문은 이 배율을 라 부르는데, 이 사이트에서 는 PPO ratio라서 여기서는 로 바꿨다).
그러면 vocabulary 전체의 기댓값이 head로 접힌다. 덕분에 꼬리 합을 head 합의 음수로 바꿀 수 있기 때문이다(Eq. 10).
위치당 계수 개면 되고, 손실은 다(Eq. 8). 꼬리 모델은 장식이 아니다. 꼬리를 버리고 를 쓰면 no-op 성질이 깨진다. 에서 그 값은 이다. rescale한 쪽은 계수가 정확히 이다. 세 번째 NumPy 블록이 둘을 잰다.
IS 가중치 가 있으면 꼬리의 ratio가 상수 이므로, 같은 접기로 head 계수 , 를 얻는다(Eq. 12). 평범한 SC는 이라 이고, 정확한 IS 은 , 라서 항이 사라진다. 그래야 한다.
보고된 비용과 정확도. 에서 두 모델 크기 모두 baseline의 wall-clock 대비 1% 안에서 끝났다(저자들의 JAX sampler는 decoding 중에 top- log-prob를 계산한다. vLLM과 SGLang도 top- log-prob를 기본 제공하지만 논문은 그 overhead를 재지 않았다). head는 30B의 INT8 weight/activation + INT4 KV cache를 뺀 모든 설정에서 평균적으로 sampler 질량의 99.9% 넘게 덮었고(그 설정은 평균 99.45%, 최악의 배치 95.8%), 은 물론 도 모든 설정에서 vocabulary 전체 중심화와 맞먹었다(부록 A.4). 구현 세부 둘. 샘플된 토큰은 head 밖에 있을 수 있으므로 그 sampler log-prob를 따로 저장한다. 그리고 는 토큰이 실제로 뽑힌 분포여야 한다. 엔진이 temperature나 top-p로 샘플하면서 raw log-prob를 돌려주면 중심화 항이 엉뚱한 에 대해 계산되고 상쇄가 성립하지 않는다(sampling mask와 processed log-prob). verl은 rollout correction에서 score_centering으로 이 방법을 제공한다(verl의 rollout correction).
실험이 보여 주는 것
설정. 모든 방법을 하나의 공통 목적함수 위에 따로 얹는다. group-centred 보상의 REINFORCE, 프롬프트당 completion 8개, 배치당 SGD 한 step, 학습률 . 모든 importance ratio는 sampler가 기록한 확률 기준이고 parameter는 기본값이다(TIS/CISPO는 로 clip, MIS/IcePop은 밖을 버림, PPO 와 DAPO 는 dual clip 3, GSPO는 시퀀스 단위 , TOPR, DPPO는 total variation 문턱 0.2). Qwen3-0.6B-Instruct는 Countdown에서 배치당 프롬프트 64개, 최대 길이 512로, Qwen3-30B-A3B-Base는 INTELLECT-2의 수학 부분에서 프롬프트 16개, 최대 길이 1,024로 학습한다.
- 인공 weight 잡음(0.6B, , 는 고정된 Gaussian): 잡음이 클수록 방법들이 일찍 무너진다. DPPO는 세 크기에서 대략 step 160, 80, 20에, TIS는 가장 작은 크기에서 안정적이고 나머지 둘에서 대략 180과 40에 무너진다. 가장 큰 잡음에서는 SC, SC + TIS, SC + MIS만 안정적으로 학습한다.
- INT8 sampler(weight, activation, KV cache를 양자화, trainer는 bf16): SC 단독과 그 결합이 가장 좋다.
- Staleness(추론 엔진을 64 step마다 한 번만 갱신): TIS나 MIS와 결합한 SC가 가장 좋고 SC 단독보다 낫다. PPO와 DAPO는 staleness는 견디지만 양자화와 weight 잡음에서 무너진다.
- 30B(800 step, router replay 없음. 논문은 실전에서는 replay가 바람직하다고 적는다): FP8 sampler에서는 보정 없는 정책 경사도 학습 정확도 58%로 안정적이다. FP4 KV cache에서는 정책 경사가 200 step 안에, MIS가 학습 후반에 무너지고, SC는 52%, TIS는 51%다. INT8 sampler + INT4 KV cache에서는 SC 30%, TIS 12%, 나머지는 모두 5% 아래다.
읽는 법. 불일치는 일부러 심하게, 시퀀스는 짧게(512와 1,024 토큰) 만들었다. 약한 불일치의 긴 학습을 대신하는 대리 실험이다. 저자들은 자연스러운 불일치로는 GPU 몇 시간 안에 최상위 방법들을 갈라내지 못했는데, 그것 자체가 쌓이는 drift가 예측하는 바다. 같은 관점이 논문이 인용하는 두 보고를 화해시킨다. 토큰 단위 IS만으로 안정적이었던 FP8 rollout과, bf16 샘플링인데도 발산한 실행이다. 약한 불일치도 불안정하게 만들고, 다만 step이 더 걸린다. seed는 작은 모델에서 곡선당 셋이고, 30B에서는 많은 방법이 한 번씩 돌았으며 최상위 방법에만 seed를 더했다(어려운 두 패널에서 SC 5와 4, TIS 4와 3). 30B와 양자화 곡선은 학습 정확도, 잡음 sweep은 held-out 정확도다.
언제 돕고, 언제 이 도구가 아닌가
- 가장 돕는 곳은 online 루프의 지속적인 수치 차이다. 양자화되거나 정밀도 낮은 rollout, kernel 차이, 평균으로 사라지지 않고 weight와 함께 갱신되는 모든 불일치. clipping과 masking이 남기는 drift도 지우므로 TIS/IcePop을 대신하기보다 그 위에 얹는 것이다.
- IS가 함께 필요한 곳은 심한 staleness다. signal을 sampler 아래에서 재기 때문이다. DLC처럼 ESS로 촉발하는 재동기화를 더하자(비동기 RL).
- 아무것도 하지 않는 곳은 signal이 없는 곳(신호 없는 그룹)이다. 거기에는 drift도 없으니 맞는 동작이다.
- 원인 제거의 대체물이 아니다. trainer가 계산하는 함수를 바꾸지 않으므로 MoE routing이 뒤집히면 score는 여전히 다른 expert를 지난다(routing을 재사용하자 — 불일치 엔지니어링). prefix의 분포를 고치지 않는다. 그리고 기록한 만큼만 정확하다.
- 필요한 것은 모든 위치에서 sampler의 top- log-prob( = 32–128)와 샘플된 토큰의 log-prob, 그리고 붙일 REINFORCE 꼴의 토큰별 손실이다.
구현해 보기
먼저 두 토큰 장난감에서 항등식을 정확히 본다. 보상은 첫 토큰에만 달려 있으므로 두 번째 위치의 참 gradient는 0이고, 규칙이 거기서 하는 일은 모두 drift이거나 clipping의 찌꺼기다.
import numpy as np
np.set_printoptions(precision=3, suppress=True)
def softmax(z):
e = np.exp(z - z.max(-1, keepdims=True))
return e / e.sum(-1, keepdims=True)
# 두 토큰짜리 "언어": y1, y2 ∈ {0..5}. logit z1 (V,)과 z2[y1] (V,)이 trainer의 매개변수다.
# score는 logit에 대해 잰다: d log p_v / dz = e_v - p (토큰 v마다 한 행).
rng = np.random.default_rng(0)
V = 6
z1, z2 = rng.normal(0, 1, V), rng.normal(0, 1, (V, V))
D1, D2 = rng.normal(0, 1, V), rng.normal(0, 1, (V, V)) # 엔진 불일치의 고정된 방향
R = np.array([1, 1, 0, 0, 0, 0.]) # 보상은 y1에만 달렸다: y2는 "서식"
I = np.eye(V)
def expected_update(eps, rule, C=2.0):
"""한 규칙의 토큰별 업데이트의 정확한 기댓값(36개 시퀀스를 모두 나열).
토큰은 sampler q = softmax(z + eps*D)에서 뽑고, score는 trainer p를 지난다."""
p1, p2 = softmax(z1), softmax(z2)
q1, q2 = softmax(z1 + eps * D1), softmax(z2 + eps * D2)
A = R - q1 @ R # group-centred advantage (무한 그룹)
f = {'plain': lambda r: 1 + 0 * r, 'SC': lambda r: 1 + 0 * r, 'IS': lambda r: r,
'TIS': lambda r: np.minimum(r, C), 'SC+TIS': lambda r: np.minimum(r, C)}[rule]
centre = rule.startswith('SC')
def pos(q, p, adv): # E_{y~q}[adv(y) * (w_y s_y - 중심화 항)]
ws = f(p / q)[:, None] * (I - p) # 가중된 score, 토큰마다 한 행
if centre:
ws = ws - q @ ws # E_q[w s]를 뺀다: prefix가 주어지면 결정적
return (q * adv) @ ws
g1 = pos(q1, p1, A)
g2 = np.array([q1[a] * pos(q2[a], p2[a], A[a] * np.ones(V)) for a in range(V)])
true1 = p1 * (R - p1 @ R) # on-policy gradient. 위치 2에는 진짜로 없다
return np.linalg.norm(g1 - true1), np.linalg.norm(g2), np.linalg.norm(true1)
q1 = softmax(z1 + 1.0 * D1)
print("expected advantage after each first token y1 (eps=1):", R - q1 @ R)
print(" at the root prefix: %.1e -> group centring guarantees zero drift only at the root\n" % abs(q1 @ (R - q1 @ R)))
print(" eps rule |error at pos 1| |update at pos 2| (|true grad at pos 1| = %.3f, at pos 2 = 0)"
% expected_update(0, 'plain')[2])
for eps in [0.0, 0.5, 1.0, 2.0]:
for rule in ['plain', 'IS', 'TIS', 'SC', 'SC+TIS']:
e1, n2, _ = expected_update(eps, rule)
print(f" {eps:3.1f} {rule:7s} {e1:12.4f} {n2:12.4f}")
# 상수 보상 R = 1, 위치 하나: 평범한 업데이트는 정확히 -grad KL(q || p_theta), 즉 sampler에 대한 SFT다.
p, q = softmax(z1), softmax(z1 + D1)
drift = q @ (I - p) # logit 좌표에서 E_q[score] = q - p
kl = lambda z: np.sum(q * (np.log(q) - np.log(softmax(z))))
fd = np.array([(kl(z1 + 1e-6 * I[v]) - kl(z1 - 1e-6 * I[v])) / 2e-6 for v in range(V)])
print("\nconstant reward: E_q[score] =", drift, "\n -grad KL(q||p) =", -fd,
"\n max |difference| = %.1e" % np.abs(drift + fd).max())두 열을 따로 읽자. 위치 2는 보상 정보가 전혀 없으므로 참 gradient가 0이다. 평범한 정책 경사는 거기에 ε = 1에서 0.077, ε = 2에서 0.135를 놓는다. 참 gradient 전체(0.182)와 맞먹는다. 첫 토큰 뒤의 기대 advantage가 0이 아니라 +0.72나 −0.28이기 때문이다. TIS는 그것을 0.017과 0.025로 줄이고(잘린 토큰의 찌꺼기), SC와 SC + TIS는 정확히 0으로 만들며, 정확한 IS도 그렇다. 위치 1은 root이고 거기서는 group centering이 이미 drift를 지웠다. plain과 SC에 똑같이 남는 것(ε = 1에서 0.099)은 대신 아래에서 잰 공분산이다. IS는 그것을 지우고 TIS는 일부 지운다(0.022). SC 혼자서는 고치지 못하는 조각이다. 마지막 줄들은 상수 보상의 업데이트가 안에서 와 같음을 확인한다.
이제 샘플한 minibatch와, 매 step 뒤 trainer에서 갱신되는 sampler로 되먹임 루프를 돌린다. prefix 둘: “제대로 가는 중”(기대 advantage 약 +0.5)과 “이미 틀림”(약 −0.5). 둘 다에서 토큰 y*가 작은 보너스를 받는다.
import numpy as np
def softmax(z):
e = np.exp(z - z.max(-1, keepdims=True))
return e / e.sum(-1, keepdims=True)
# prefix 둘: "제대로 가는 중"(state 0)과 "이미 틀림"(state 1), 각각 rollout의 50%. 정책은 거기서 V개 토큰 중
# 하나를 고르고, 두 곳 모두 토큰 y*가 작은 보너스를 받는다. 보상 = 1[제대로] + 0.3 * 1[y = y*], advantage는
# 배치 평균으로 중심화한다. sampler는 trainer에 고정된 logit 오프셋 eps*D를 더한 것이고 매 step 갱신된다.
V, N, steps, lr, eps, C = 8, 256, 200, 2.0, 1.0, 2.0
rng0 = np.random.default_rng(1)
D = rng0.normal(0, 1, (2, V))
z0 = rng0.normal(0, 0.5, (2, V))
ystar = 3
fav, unfav = D[0].argmax(), D[1].argmin()
print("trainer/sampler ratio p/q at the start, per prefix:\n", (softmax(z0) / softmax(z0 + eps * D)).round(2))
def run(rule, seed=0):
rng = np.random.default_rng(seed)
z = z0.copy()
for _ in range(steps):
p, q = softmax(z), softmax(z + eps * D) # online: sampler가 trainer를 따라간다
s = (rng.random(N) < 0.5).astype(np.intp) # rollout마다의 prefix
y = (rng.random(N)[:, None] > np.cumsum(q[s], 1)).sum(1).clip(0, V - 1) # y ~ q(. | s)
Rw = (s == 0) + 0.3 * (y == ystar)
A = Rw - Rw.mean()
w = np.ones(N) if rule in ('plain', 'SC') else np.minimum(p[s, y] / q[s, y], C)
upd = w[:, None] * (np.eye(V)[y] - p[s]) # 가중된 score d log p(y|s) / dz_s
if rule.startswith('SC'): # 이 prefix에서 E_q[w s]를 뺀다 (V가 작으니 정확히)
wq = np.minimum(p / q, C) if rule == 'SC+TIS' else np.ones((2, V))
cbar = q * wq - (q * wq).sum(1, keepdims=True) * p
upd = upd - cbar[s]
g = np.zeros((2, V))
np.add.at(g, s, A[:, None] * upd)
z = z + lr * g / N
return softmax(z)
print(f"\nstart: p(y*|on)={softmax(z0)[0, ystar]:.3f} p(y*|wrong)={softmax(z0)[1, ystar]:.3f}")
print("rule p(y*|on) p(y*|wrong) p(sampler-favourite|on) p(sampler-least-favourite|wrong)")
for rule in ['plain', 'TIS', 'SC', 'SC+TIS']:
P = np.mean([run(rule, k) for k in range(2)], 0)
print(f"{rule:7s} {P[0, ystar]:8.3f} {P[1, ystar]:10.3f} {P[0, fav]:16.3f} {P[1, unfav]:24.3f}")평범한 정책 경사는 보상받은 것을 하나도 배우지 못한다. 업데이트 200번 뒤 제대로 가는 prefix는 sampler가 가장 선호하는 토큰에 0.96을, 이미 틀린 prefix는 가장 덜 선호하는 토큰에 0.97을 둔다. 유도대로 끌림과 밀림이다. TIS는 틀린 prefix 뒤에서는 y를 배우지만(0.97) 제대로 가는 prefix 뒤에서는 못 배운다(0.03). 거기서 y는 처음에 라서 TIS가 정확히 보상받는 토큰을 자르고, 남긴 drift가 trainer를 그것에서 멀어지게 한다. SC는 둘 다 배우고(0.90과 0.97), SC + TIS가 가장 좋다(0.97과 0.98). TIS가 공분산도 쪽으로 옮기고 중심화가 clip이 남긴 것을 지우기 때문이다.
마지막으로 top-k 근사를, 뾰족한 분포와 평평한 분포가 섞인 32K vocabulary의 위치 32개에서 본다.
import numpy as np
def softmax(z):
e = np.exp(z - z.max(-1, keepdims=True))
return e / e.sum(-1, keepdims=True)
# 32k vocabulary 위의 위치 32개, 확신하는 곳부터 불확실한 곳까지. logit 좌표에서 토큰 v의 score는 e_v - p이므로
# score의 가중합 sum_v c_v (e_v - p) = c - (sum c) p를 싸게 정확히 만들 수 있다.
rng = np.random.default_rng(0)
n, V = 32, 32_000
sharp = np.linspace(1.2, 3.0, n)[:, None] # 위치마다의 Zipf 지수
z = 1.5 * rng.standard_normal((n, V)) - sharp * np.log(np.arange(1, V + 1))
p = softmax(z)
noise = rng.standard_normal((n, V))
cases = {
"dense noise (kernels, bf16)": z + 0.1 * noise,
"noisy tail (coarse quant)": z + 0.1 * noise + 0.6 * rng.standard_normal((n, V)) * (np.argsort(np.argsort(-z, 1), 1) >= 64),
}
wsum = lambda c: c - c.sum(1, keepdims=True) * p # 행: sum_v c_v (e_v - p)
rel = lambda a, b: np.median(np.linalg.norm(a - b, axis=1) / np.linalg.norm(b, axis=1))
for name, zq in cases.items():
q = softmax(zq)
exact = wsum(q) # 위치마다 s_bar = E_q[score] = q - p
order = np.argsort(-q, 1) # sampler는 자기 top-k를 기록한다
print(f"{name}")
print(" k mean head mass median rel. error: head only head + rescaled trainer tail")
for k in [8, 32, 128]:
H = order[:, :k]
qH, pH = np.take_along_axis(q, H, 1), np.take_along_axis(p, H, 1)
kappa = (1 - qH.sum(1, keepdims=True)) / (1 - pH.sum(1, keepdims=True))
c_head, c_sc = np.zeros((n, V)), np.zeros((n, V))
np.put_along_axis(c_head, H, qH, 1)
np.put_along_axis(c_sc, H, qH - kappa * pH, 1) # Eq. 10: 위치마다 계수 k개뿐
print(f" {k:4d} {qH.sum(1).mean():12.5f} {rel(wsum(c_head), exact):22.3f} {rel(wsum(c_sc), exact):22.4f}")
# 확인: on-policy(q = p)에서 rescale한 꼬리 식은 정확히 0이고, head만 쓰면 0이 아니다.
H = np.argsort(-p, 1)[:, :32]; pH = np.take_along_axis(p, H, 1)
c = np.zeros((n, V)); np.put_along_axis(c, H, pH, 1)
print("\nq = p: |head-only term| = %.2e, |rescaled-tail term| = 0 (coefficients p_v - 1*p_v)" % np.linalg.norm(wsum(c), axis=1).mean())
# IS 가중치 f(r)와의 결합: head 계수 q_v f(r_v) - alpha p_v, alpha = kappa f(1/kappa).
q, i = softmax(cases["dense noise (kernels, bf16)"])[0], 0
H = np.argsort(-q)[:32]
kappa = (1 - q[H].sum()) / (1 - p[i, H].sum())
qhat = kappa * p[i].copy(); qhat[H] = q[H] # vocabulary 전체에서 재구성한 sampler
f = lambda r: np.minimum(r, 2.0) # TIS
full = qhat * f(p[i] / qhat); full = full - full.sum() * p[i]
c = np.zeros(V); c[H] = q[H] * f(p[i, H] / q[H]) - kappa * f(1 / kappa) * p[i, H]
print("TIS-composed centring: head-only formula vs full sum over qhat, max diff %.1e" % np.abs(c - c.sum() * p[i] - full).max())꼬리를 무시하면 작은 에서는 쓸모없는 것보다 나쁘다. 에서 head만 쓴 항은 지우려는 drift 크기의 약 두 배만큼 틀리고, 에서도 약 10% 틀린다. rescale한 trainer 꼬리를 쓰면 조밀한 잡음에서 오차가 에서 0.6%, 에서 0.1% 아래다. 양자화가 꼬리의 모양을 일그러뜨리면 — 꼬리 모델이 바로 그것을 가정으로 무시한다 — 오차가 커지지만(에서 1.7%, 에서 0.5%) 꼬리가 질량을 거의 갖지 않으므로 작게 머문다. 이 장난감의 head는 실제 LLM보다 평평하다(에서 질량 96–97%, 논문은 99.9% 이상). 마지막 두 줄은 rescale한 꼴이 에서 정확한 no-op이고 식이 vocabulary 전체 합을 재현함을 확인한다.
PyTorch로 쓴 손실이다. 배치 단위이고 IS 가중치는 선택이다. 논문의 Eq. 14다(참조 코드는 JAX).
import torch
def tis(r, cap=2.0): # truncated IS (TIS / CISPO 가중치)
return r.clamp(max=cap)
def mis(r, lo=0.5, hi=5.0): # masked IS (IcePop 밴드)
return torch.where((r >= lo) & (r <= hi), r, torch.zeros_like(r))
def score_centering_loss(logits, tokens, samp_topk_ids, samp_topk_logp, samp_token_logp,
adv, mask, weight_fn=None, eps=1e-6):
"""logits: `tokens` (B, T)를 예측하는 위치의 trainer logit (B, T, V).
samp_topk_ids / samp_topk_logp: sampler의 top-k id와 log-prob (B, T, K). 실제로 샘플한 분포
(temperature / top-p 적용 후)에서 와야 한다. samp_token_logp: 샘플된 토큰의 sampler log-prob (B, T).
그 토큰은 top-k 밖일 수 있으므로 따로 저장한다. adv: advantage (B,), mask: (B, T)."""
logp = torch.log_softmax(logits.float(), dim=-1) # FP32 log-softmax
tok_logp = logp.gather(-1, tokens.unsqueeze(-1)).squeeze(-1) # (B, T) log p(y_t)
head_logp = logp.gather(-1, samp_topk_ids) # (B, T, K) head의 log p(v)
f = weight_fn if weight_fn is not None else (lambda r: torch.ones_like(r))
with torch.no_grad(): # 모든 계수는 detach
p_head, q_head = head_logp.exp(), samp_topk_logp.exp()
kappa = (1 - q_head.sum(-1)).clamp_min(eps) / (1 - p_head.sum(-1)).clamp_min(eps) # 꼬리 질량 비
alpha = kappa * f(1.0 / kappa) # 평범한 SC면 = kappa
coef = q_head * f((head_logp - samp_topk_logp).exp()) - alpha.unsqueeze(-1) * p_head
w_tok = f((tok_logp - samp_token_logp).exp()) # 샘플된 토큰의 IS 가중치
centred = w_tok * tok_logp - (coef * head_logp).sum(-1) # grad: w s_y - sum_H coef_v s_v
loss_tok = -adv.unsqueeze(-1) * centred
return (loss_tok * mask).sum() / mask.sum().clamp_min(1)
# 사용: 평범한 SC, SC + TIS, SC + MIS
# loss = score_centering_loss(logits, ids, topk_ids, topk_logp, tok_logp, adv, mask)
# loss = score_centering_loss(logits, ids, topk_ids, topk_logp, tok_logp, adv, mask, weight_fn=tis)
# loss = score_centering_loss(logits, ids, topk_ids, topk_logp, tok_logp, adv, mask, weight_fn=mis)group-centred advantage와 토큰 단위 TIS(상한 2)로 학습한다. 동료가 모든 그룹의 advantage 합이 0이므로 drift는 문제가 될 수 없다고 말한다. 옳은 것은?
group centering은 root의 기대 advantage 를 0으로 만든다. prefix 에서 drift 계수는 다. 유망한 prefix에서 양수, 실수 뒤에서 음수이고, prefix가 우연히 그룹 평균과 같을 때만 0이다. TIS는 자르지 않는 토큰에서만 drift를 지우고, 남는 방향은 다. TIS로 가중된 score 위에 score centering 항을 더하면(꼬리는 ) 상한이 무엇이든 나머지가 사라진다.
한 실행의 sampler는 매 step 갱신되는 trainer의 INT8 사본이고, 다른 실행은 64 step마다만 sync되는 bf16 sampler다. 논문의 실험과 유도에 따르면 score centering만으로 충분해야 하는 쪽은?
score centering은 대신 를 남긴다. 수치 불일치에서는 라 그 차이가 작고, INT8 sampler에서 SC 단독은 그 결합들과 맞먹었다. staleness는 와 를 진짜로 다른 정책으로 만든다. 거기서는 SC + TIS/MIS가 가장 좋았고 SC 단독은 뒤처졌다. 논문의 권고는 trainer가 sync 사이에 sampler에서 멀리 움직일 수 있을 때마다 IS 보정과 결합하라는 것이다.
정리
- off-policy 정책 경사는 모든 prefix에서 다. drift 항은 보상을 평균으로만 보고, 그 평균 곱하기 다. sampler 쪽으로의 증류다.
- 고정된 teacher로의 증류는 수렴한다. trainer의 편향된 사본이고 trainer에서 갱신되는 sampler로의 증류는 멈추지 않는다. 장난감에서 정책은 수치 오차가 선호하는 토큰으로 붕괴한다. online 보상이 가장 불안정하고 남의 데이터로 하는 SFT가 멀쩡한 이유다.
- group centering이 drift 0을 보장하는 곳은 root뿐이다. 더 깊은 prefix의 기대 advantage는 그 가치 빼기 그룹 평균이다. clip하고 mask한 IS는 잘린 토큰에 drift를 남긴다. TIS는 다.
- score centering은 가산적이고 결정적인 항 를 뺀다. 모든 prefix에서 drift가 0이 되고 signal은 가 되며, on-policy에서는 no-op이다. 어떤 IS 가중치 위에 얹어도 clipping이 다시 들여온 drift를 지운다. 심한 staleness에서는 그 결합이 통한다.
- 실전에서는 sampler의 top- log-prob( = 32–128)와 rescale한 trainer 꼬리로, 근사한 sampler에 대한 정확한 보정을 1% 미만의 비용에 얻는다. 보고된 이득은 불일치가 가장 심한 곳에서 가장 크다(30B INT4 KV: SC 30% 대 TIS 12%).
더 읽을거리Further reading
- Marek & Ryabinin, Score Centering Stabilizes Off-policy Reinforcement Learning (arXiv 2609.20807, 2026) — drift/signal 분해(Eq. 3), score centering(Eq. 4–5), top-k 근사(Eq. 9–10)와 IS 결합(Eq. 11–12). 0.6B–30B 실험. 코드는 github.com/martin-marek/score-centering.The drift/signal decomposition (Eq. 3), score centering (Eq. 4–5), the top-k approximation (Eq. 9–10) and the composition with IS (Eq. 11–12); experiments from 0.6B to 30B. Code at github.com/martin-marek/score-centering.
- Cameron R. Wolfe, Score Centering: Understanding and Fixing Instability in RL (Deep (Learning) Focus, 2026) — 논문을 단계별로 풀어 쓴 해설. 학습–추론 불일치 관련 읽기 목록과 IS 선택지가 있는 PyTorch 구현.A step-by-step explainer of the paper, with a reading list on training–inference mismatch and a PyTorch implementation with IS options.
- Chris Liu, Off-Policy Drift in LLM RL (2026, blog, WIP) — "on-policy" LLM RL이 off-policy가 되는 원인의 분류, verl 기준 진단 지표와 rollout correction, 증상에서 처방으로 가는 결정 트리.A taxonomy of why "on-policy" LLM RL is off-policy, diagnostic metrics and rollout correction as implemented in verl, and a symptom-to-fix decision tree.
- Nathan Lambert, RLHF Book, Ch. 6 Policy Gradients (Score Centering section) — 같은 유도와 top-k 손실을 교과서 표기로 정리하고, TIS 위에 더해 쓰는 보정으로 소개한다.The same derivation and top-k loss in textbook notation, presented as a correction used on top of TIS.
- Ren & Sutherland, Learning Dynamics of LLM Finetuning (ICLR 2025) — 음의 gradient가 offline에서 분포를 날카롭게 만드는(squeezing) 메커니즘. offline 음의 보상이 불안정한 이유.The squeezing mechanism by which negative gradients sharpen the distribution offline — why offline negative rewards are unstable.
- Ionides, Truncated Importance Sampling (J. Computational and Graphical Statistics, 2008) — 잘린 IS의 bias–variance. TIS가 남기는 bias의 고전적 분석.Bias and variance of truncated IS — the classical analysis of the bias TIS leaves behind.