Two score-centering PRs: what #4833 does that #4818 does not, if #4818 lands first

#4818 (head c9d5fbe2) next to draft #4833 (head ddd0dcb7). All links are pinned to those two heads.

Before
Score centering is not on main. Two PRs add it, written separately, with no shared code.
#4818
Score centering for the SingleController (v2) trainer, carried by token capture, with unfiltered sampling only. This page assumes it is accepted.
#4833
Score centering for the v1 GRPO loops (native vLLM, and Gym without token capture), plus top-k/top-p sampling through vLLM's sampling mask.
Status
#4833 is a draft. It has never run in CI and pins a personal Gym fork. Nothing on this page is merged.

Six pages on #4818, one question each. This one asks what the other score-centering PR covers that #4818 does not.

Background. Score centering needs, for every generated token, the K tokens the sampler thought most likely and their probabilities. Call these "the K candidates". The trainer then subtracts the score the sampler expected from the score it actually got. Both PRs record the K candidates in vLLM and compute the same correction in the loss. They differ in which trainer they support, how the candidates travel from vLLM to the trainer, and how the correction joins the loss. v1 and v2 are the two GRPO trainers. Dotted words have a short explanation: hover or tap them.

Where each PR moves the K candidates

Example: a 4-token prompt and 3 generated tokens, so a row is S = 7 tokens. K = 2. At the first generated token the sampler's top 2 are ids 17 and 4, with q = 0.45 and 0.25 (log q = −0.80, −1.39). The trainer gives them p = 0.50 and 0.32. [3, 2] means [generated tokens, K candidates], and [7, 2] means [row tokens, K candidates].

#4818 · v2 trainer, token capture #4833 · v1 loops, native vLLM or Gym HTTP 1 · vLLM WORKER PULLS THE K CANDIDATES extract_score_centering_samples ids int32 [3, 2] [[17, 4], …] log q [[-0.80, -1.39], …] · runs in a thread _score_centering_head ids int64 [3, 2] [[17, 4], …] log q [[-0.80, -1.39], …] · Gym path: on the event loop 2 · HOW IT TRAVELS TO THE TRAINER token-capture staging write sampler_topk_token_ids [3, 2] → data store never passes through Gym HTTP JSON in the chat response "score_centering_ids": [[17, 4], …] Gym must pass the new fields through (fork only) 3 · LINED UP WITH THE FULL ROW finalizer → [7, 2] zeros on the 4 prompt tokens Gym result → message_log → [7, 2] -inf log q on the 4 prompt tokens 4 · TRAINER LOG-PROBS AT THOSE IDS get_policy_logprobs_at_sampler_topk p [0.50, 0.32] · packing + Megatron CP ok get_distillation_topk_logprobs_from_logits p [0.50, 0.32] · unpacked only · Automodel TP ok 5 · INTO THE LOSS c = [-0.383, -0.283], added to the loss PPO ratio and clipping stay as configured c = [-0.383, -0.283], replaces the loss REINFORCE only: disable_ppo_ratio required same idea both sides the PRs differ

The two PRs give the same numbers at the start and at the end. Both record ids 17 and 4, both read p = 0.50 and 0.32, and both compute c = q − ρ·p = −0.383 and −0.283, where ρ = (1 − 0.70) ÷ (1 − 0.82) = 1.667 scales the part of the vocabulary nobody recorded. They differ in the middle (how the K candidates reach the trainer) and at the end (what the correction is added to).

What each one covers

Setup#4818#4833
v2 trainer with token capture✓✗ v2 setup and its train fields are not wired
v1 GRPO, native vLLM (sync or async)✗ raises at setup✓
v1 GRPO + Gym, no token capture✗✓ needs the Gym fork
top-k / top-p sampling✗ rejected✓ positive top_k ≤ K, using the vLLM sampling mask (L1010, renormalize)
Automodel with TP or CP✗ rejected at setup✓ unpacked rows only
Sequence packing, Megatron CP✓✗ packing rejected
PPO ratio and clipping kept✓✗ requires disable_ppo_ratio
Sequence-level loss averaging✓✗ token-level only
Upstream Gym, GPU CI run✓ Gym main, CI passed before the last fixes✗ fork pin, never run in CI

The math is the same estimator. Both compute c = m − α·p on the K candidates, with the same IS, TIS and ICE-POP rules for m and α (#4818 score_centering.py L89, #4833 clipped_pg.py L99). The only difference is what that term is added to. A is the advantage, y the sampled token, w its importance weight, sg means no gradient:

\mathcal{L}_{\#4818} = \htmlClass{t1}{\underbrace{\mathcal{L}_{\text{policy gradient}}}_{\text{any configured PG loss}}} + A\sum_{v\in\text{K}} \mathrm{sg}[c_v]\,\log p_v
\mathcal{L}_{\#4833} = \htmlClass{t2}{\underbrace{-A\,\mathrm{sg}[w]\,\log p_y}_{\text{REINFORCE only}}} + A\sum_{v\in\text{K}} \mathrm{sg}[c_v]\,\log p_v

With disable_ppo_ratio: true and token-level loss, #4818's first term is that same REINFORCE term, so #4818 already covers #4833's loss. One small difference: #4833 computes w from the current log-probs, while #4818 uses the standard importance weight from the old ones. These match on the first update of a batch.

What to take from #4833 after #4818 lands — proposed, not in either PR

Where it would land: RL, as follow-ups to #4818. Only the Gym-without-capture item needs a Gym change, and it should go to Gym main, not a fork.

#4833 pieceTake it?How, on top of #4818
top-k / top-p via vLLM's sampling maskYes, this is the planned top-p follow-upUse vLLM's return_sampling_mask so the replay does not depend on score centering. Carry over #4833's validation rule: the mask is on for the whole engine, so validation must keep the training top_k and cannot be greedy.
Automodel TP/CPYes, small#4818 raises for Automodel's sharded logits (model_utils.py L1751). The existing get_distillation_topk_logprobs_from_logits already handles them, and #4833 shows it works for this (2-GPU test on H100). Then drop #4818's Automodel setup check.
v1 loops, Gym without token captureOnly if v1 users ask for itAdds a second way for the K candidates to travel (HTTP JSON), and needs a Gym schema change. #4833's HTTP path also repeats two things #4818 fixed in review: K is forced onto every request that asks for token-id logprobs, not only training calls, and the per-token Python extraction runs on vLLM's event loop.
REINFORCE-only lossNo#4818's added term already reduces to it (see above).
So what. If you accept #4818, you get the same correction, but only for the v2 trainer with unfiltered sampling. #4833's two real additions are top-k/top-p through vLLM's sampling mask and Automodel TP/CP. Both port cleanly onto #4818's columns, and the first is already the planned follow-up. Its other addition, v1 and Gym-without-capture support, is worth taking only if v1 users need score centering. Do not merge #4833 as is: it would add a second, incompatible copy of the feature (score_centering_top_k next to score_centering), and it pins a personal Gym fork.