With `top_p` / `top_k` / `min_p` truncation, the Geo-RS and Seq-MIS rollout-correction presets reject every sequence; proposal: replay the sampling support size
What happens
verl asks vLLM for processed_logprobs by default (rollout.logprobs_mode). With top_p, top_k or min_p truncating the distribution, those log-probs are normalised over the kept set, while old_log_probs from the actor are normalised over the full vocabulary. So old_log_probs - rollout_log_probs carries log(kept mass) at every token, with no policy change at all. #6240 raised the semantics; this issue is about what it does to training.
Measured on main (6093e00), GSM8K, GRPO, 32 prompts x n=4, temperature 1.0, 2-3 steps per arm, one L40. vLLM is 0.28 rather than the 0.29 the vllm extra pins, because this machine's driver stops at CUDA 12.6; setup.py accepts it.
The term is visible in the existing metrics (Qwen2.5-0.5B-Instruct, rollout_is=token):
rollout_corr/rollout_is_mean |
rollout_corr/kl |
|
|---|---|---|
top_p=1.0 |
0.9998 - 1.0000 | 0.0007 - 0.0008 |
top_p=0.8 |
0.964 - 0.968 | 0.034 - 0.039 |
With the default thresholds, two presets reject every sequence and the gradient is zero (Qwen2.5-1.5B-Instruct, rewards 8-22%; every arm sees the same batches, and on them the uncorrected arm's advantages run from -1.5 to 1.5):
| arm | rollout_rs_seq_masked_fraction |
actor/grad_norm |
|---|---|---|
top_p=0.8, no correction (control) |
- | 0.345, 0.455 |
decoupled_geo_rs() defaults, top_p=1.0 |
0.55, 0.57 | 0.151, 0.265 |
decoupled_geo_rs() defaults, top_p=0.8 |
1.0, 1.0 | 0.0, 0.0 |
decoupled_seq_is_rs() defaults, top_p=0.8 |
1.0, 1.0 | 0.0, 0.0 |
The 0.55 at top_p=1.0 comes from the engine/trainer mismatch that remains without truncation in this setup (sdpa, use_remove_padding=False, FSDP2 with CPU offload); I have not checked it with flash-attn.
The per-token geometric-mean ratio is about 0.964, outside Geo-RS's 0.999_1.001; summed over responses that average 257-279 tokens it is far outside Seq-MIS's 0.5_2.0 (rollout_is_mean 0.0012 - 0.0017 in that arm). What the user sees is Response mask is all False, returning default advantage metrics once per step and critic/advantages/* as NaN; nothing names the rejection, the preset or the truncation, and rollout_corr_helper.py itself has no warning path. decoupled_k3_rs() does not notice the term at all (0% rejected at top_p=0.8, 0.5B run): for a near-uniform shift K3 is second order, r - 1 - log r is about 0.0007 at r = 0.964, far below 0.01, but the bias is still in the weights.
The incompatibility itself is known: #8010 (score centering) accepts only top_p=1, top_k=-1 and refuses other combinations at config validation or worker start, and #8009 lists top_p < 1 replay as a follow-up. The presets above are where it bites without anyone opting in.
Proposal
1. A warning now. When rollout_rs or rollout_is is set and the rollout truncates (top_p < 1, top_k > 0 or min_p > 0), warn at config time that the ratio carries the kept mass; and warn at step time when rollout_rs_seq_masked_fraction == 1.0. Cheap, and it names the cause the current generic warning leaves out.
2. The fix: replay the support size, not the support. top-k, top-p and min-p all keep a prefix of the tokens sorted by probability, so the kept set at a position is the |S_t| most likely tokens. vLLM 0.28 returns the kept ids (return_sampling_mask=True, vllm-project/vllm#49577); the server only needs to send len() per position, one integer per generated token, through the same path rollout_log_probs takes. The actor then computes log_kept_mass = logsumexp(top-|S_t| logits / T) - logsumexp(logits / T) in the same forward that produces old_log_probs, exactly where calculate_sum_pi_squared is computed today, and it is added to rollout_log_probs so both sides are on the full-vocabulary support.
Replaying the size instead of the ids, against the exact ids, on the same sampled tokens (Qwen2.5-1.5B-Instruct, vLLM 0.28, 64 GSM8K prompts, ~14.6k tokens per arm; trainer = HF bf16):
| sampling | mean |S| | trainer top-|S| == vLLM set | ratio mean / out of [0.9, 1.1]: no correction | exact ids | size only |
|---|---|---|---|---|---|
top_p=0.8 |
1.3 | 99.52% | 0.964 / 16.4% | 1.000 / 0.90% | 1.000 / 0.91% |
top_p=0.95 |
2.4 | 98.37% | 0.987 / 2.6% | 1.000 / 2.04% | 1.000 / 2.03% |
top_p=0.9, T=0.7 |
1.3 | 99.65% | 0.987 / 3.8% | 0.999 / 2.34% | 0.999 / 2.35% |
top_k=20 |
20 | 72.09% | 0.998 / 2.7% | 1.000 / 2.50% | 1.000 / 2.50% |
min_p=0.05 |
1.7 | 99.87% | 0.982 / 5.2% | 1.000 / 1.58% | 1.000 / 1.58% |
Where the sets differ it is at the boundary, on tokens with almost no mass (mean |Δ log kept mass| 2e-6 to 2e-5). The size costs 1 integer per token; the ids cost |S| per token, and up to 1024 per token under a top_k=1024 cap with top_p=1.0.
THUDM/slime#2406 (the replay #8009 points to) sends the complete top-p support, ids plus a log-prob per kept token through an SGLang patch, and renormalises the trainer over it; score centering uses the rollout distribution over the whole support, hence the log-probs. The ratio correction alone needs less: the size carries the same information for it, as the table shows.
vLLM's replay has three conditions of its own (0.28, input_processor.py and config/vllm.py): temperature > 0, top_k > 0 "to bound sampling mask size, reduce transfer overhead, and avoid potential OOMs", and Model Runner V2, which vLLM 0.28 picks by default for dense models and for an allow-list of MoE architectures (DeepSeek-V2/V4, Qwen2-MoE, Granite-MoE, Kimi-K3 and a few others) that does not include Qwen3-MoE or DeepSeek-V3. So a top_p-only config would need a top_k cap, and those MoE models would need VLLM_USE_V2_MODEL_RUNNER=1. Through verl's own vLLM server the flag passes as-is (+actor_rollout_ref.rollout.engine_kwargs.vllm.return_sampling_mask=True, Qwen2.5-0.5B-Instruct, one RTX 4090): without top_k, vLLM rejects every generation request with that top_k > 0 error and the run stops; with top_k=1024, the run completes its 2 steps, including the per-step weight sync. With CPU offload also on, one run crashed in offload_fsdp_optimizer with CUDA invalid argument; an identical rerun passed.
Questions before a PR
- Warning, or an error for the RS presets when truncation is on?
- Support size as above, or the full support as in slime#2406 (exact, heavier to move through the agent loop)? If #8009 brings
top_p < 1to score centering, one replay path could serve both, with the size as the cheap mode when only the ratio is corrected. - Bypass mode:
old_log_probs = rollout_log_probsthere, so the correction has to come from π_θ's forward during the update rather than the old-log-prob pass. In scope for the first PR, or decoupled mode first? - Config:
actor_rollout_ref.rollout.return_sampling_mask(vLLM backend only for now)?
I can take the PR. Scripts, the parser that turns verl logs into JSON, and the JSON behind every table above: https://github.com/GuoCheng24/batch-logprob-gap/tree/main/verl
Update: 100-step runs, and a working prototype of the replay
Same setup as above with Qwen2.5-1.5B-Instruct, 100 steps per run, each run on two RTX 4090s (FSDP2, no CPU offload):
| run | reward, steps 1-10 | reward, last 20 steps | sequences rejected, mean | steps with zero gradient | rollout_corr/kl, mean |
|---|---|---|---|---|---|
top_p=0.8, no correction |
0.34 | 0.83 | - | 0 | 0.039 |
top_p=0.8, decoupled_geo_rs() defaults |
0.13 | 0.14 | 1.0 | 100 | 0.034 |
top_p=0.8, decoupled_seq_is_rs() defaults |
0.14 | 0.10 | 0.997 | 89 | 0.034 |
top_p=0.8, Geo-RS defaults + support-size replay (prototype) |
0.28 | 0.82 | 0.53 | 0 | 0.00029 |
top_p=1.0, Geo-RS defaults |
0.20 | 0.77 | 0.63 | 0 | 0.00043 |

- The stall is not a start-up effect. Geo-RS rejects every sequence at all 100 steps. Seq-MIS lets a few through in some steps, but every sequence is rejected in 86 of the 100 steps, and its reward ends lower than it started.
- With the kept-set size replayed,
rollout_corr/klfalls below thetop_p=1.0value, and Geo-RS rejects fewer sequences than attop_p=1.0; the rest is the sdpa engine/trainer mismatch mentioned above. The reward follows the uncorrected run. - The
top_k=1024cap that vLLM needs for the replay does not help on its own: with the cap and without the replay, Geo-RS still rejects every sequence (Qwen2.5-0.5B-Instruct, 2 steps).
The prototype follows the design proposed above, in about 140 lines over 9 files:
- The vLLM server returns the length of each position's sampling mask.
- The single-turn agent loop aligns it like the log-probs.
- TransferQueue stores it in the layout of the rolled labels.
- The FSDP engine computes
logsumexp(top-|S| logits / T) - logsumexp(logits / T)in the old-log-prob forward. - The v1 trainer adds that to
rollout_log_probsbefore rollout correction.
It covers vLLM, the single-turn agent loop, the v1 trainer, the FSDP engine without fused kernels, and decoupled mode. It has run on both padding paths; Ulysses SP is handled like the per-token temperature but has not been run. For now it is switched on by engine_kwargs.vllm.return_sampling_mask=True: patch against 6093e00. The scripts and JSON behind every number are in section 4 of the write-up.
Once the questions above are settled, I'd turn it into a PR with a proper config switch, the legacy trainer, multi-turn loops and tests.