On the Gym/HTTP path, the top-k sampling filter is forced off and top-p is allowed. The trainer rebuilds the top-p cut from its own probabilities. No vLLM sampling mask is sent anywhere.
This PR
#4818 records vLLM's K most likely candidates per token. That is data for a loss term, not a filter. It requires both filters off.
Status
Pre-existing, untouched by #4818. Replaying the filter's exact support is a separate feature, in draft #3937. #4818 neither adds nor blocks it.
Six pages on this PR, one question each โ this one: which "top-k" is which.
Background. At each generated token vLLM has a probability for every token in the vocabulary.
A sampling filter
(top_k, top_p) cuts that list before sampling; the tokens that survive are the
support. Separately, vLLM can report the probabilities of its K most likely tokens
(top_logprobs=K)
without cutting anything. #4818's "top-k" is the second kind. Dotted words have a short explanation: hover or tap them.
One generated token, three setups
Six-token vocabulary. vLLM's probabilities q and the trainer's p differ slightly, as they always do in practice.
vLLM sampled token 9. Supports were computed with NeMo-RL's own
apply_top_k_top_p, which copies vLLM's rule.
So which filter is supported where?
top_k filter
top_p filter
How the trainer gets the support
Gym/HTTP path today
forced off (-1)
allowed
rebuilt from the trainer's own probabilities (row 2)
#4818 score centering
rejected
rejected
no filter, so no support. Its "K" is top_logprobs
#3937 mask replay (draft)
required, > 0
allowed with top_k
vLLM's exact support, sent with the tokens (row 3)
The "top-p is not supported yet" you heard comes from mask replay, not from #4818. vLLM's replay
requires top_k > 0:
"pure top-p can produce vocab-sized masks". So top-p works only together with top-k, never alone.
#4818 forbids both filters for a different reason. Its loss models vLLM's probabilities outside the K recorded tokens as
a rescaled copy of the trainer's full softmax. A filter would set those probabilities to zero, which breaks that model.
So what. #4818 does not move a sampling mask, and it does not need Gym's help with one. Its K candidates
would only meet mask replay if the two were combined later, and the loss would then need rework to model the tail
inside the kept support. The real gap is row 2. Today, a sampled token that the trainer's own top-p cut excludes
is dropped from the loss; the only trace is the
policy_support_excluded_tokens count. The fix is mask replay (#3937), and the next page shows how its mask would have to
travel once token capture is on.