[RFC] Selected-token rollout log probabilities for the reward
Companion to #7712 (actor-side selected_token_logprobs + auxiliary objectives). This RFC covers the rollout side: letting the reward function see the policy's probability mass on specific tokens, not only the token it sampled.
Draft implementation on my fork: https://github.com/eteluna/verl/pull/2 (about 2.2k lines: ~900 source, ~1.2k tests, ~100 docs).
Motivation
A growing class of RL tasks scores the distribution rather than the sample. Generative rankers and judges emit their answer through a handful of tokens (a yes/no relevance judgement as in Qwen3-Reranker, or per-item rating digits), and the reward wants P(yes) or the expected rating at those positions: a soft, calibrated signal instead of an argmax that throws the confidence away. Today verl only exposes the sampled token's logprob (rollout_log_probs), so users either re-run a forward pass in the reward or patch the rollout adapter (we maintain such a patch).
vLLM already computes this cheaply: SamplingParams.logprob_token_ids returns the logprobs of up to 128 explicit token IDs per decode step without enabling top-k capture. The missing piece is a first-class, typed way to request it and get it to the reward.
Proposal
actor_rollout_ref:
rollout:
selected_token_logprobs:
token_ids: [9454, 2753] # e.g. "yes", "no"
positions: null # every response position, or e.g. [0, 3, 7]
max_payload_bytes_per_sample: 4194304- Dense by default.
positions: nullkeeps every response position. Many selectors are token-dependent ("the digit after each colon"), so the reward resolves them from theresponse_idscarried in the payload. A position list is an optimisation for the fixed-format case. - Mode follows the engine. Values are whatever
rollout.logprobs_modeproduces (processed_logprobsby default, i.e. after temperature and other processors) and the mode in force is recorded in the payload. The feature does not flip the engine-global mode, sorollout_log_probs, rollout correction and bypass mode are unaffected. - Typed transport.
SelectedTokenLogprobs(token_ids,response_ids,int32 positions [P],float32 logprobs [P, M],logprobs_mode, backend provenance) onTokenOutputandAgentLoopOutput. The single-turn loop re-aligns it to the truncated response (strict prefix check, missing rows are errors, short responses give a present-but-empty payload). - Reward handoff only. Copied into the streaming reward call as
extra_info["selected_token_logprobs"]; excluded fromas_dict()and rollout traces; never enters the actor batch. Actor-side needs are served by #7712, which recomputes the columns from the training forward pass and therefore does not need the rollout values. - Fail closed. Per-sample byte cap checked at config time from
response_length; hard errors for unsupported combinations (below).
Scope of the first revision
Supported: vLLM, single-turn agent loop, streaming reward workers, calculate_log_probs on or off, any logprobs_mode, rollout correction.
Rejected with explicit errors, to be lifted in follow-ups: multi-turn/tool loops, custom agent-loop registries or managers, FullyAsync partial resume, speculative decoding, prefill/decode disaggregation, structured outputs, colocated reward, the built-in discriminative reward path, SGLang.
Cost
Per decode step vLLM gathers M extra columns from the already computed logprob tensor (no top-k). The transported payload is P × M float32 plus P int32 per sample, e.g. 80 KB for a 4k response and 5 tokens; the cap makes any larger configuration an explicit decision.
PR split
- Payload type, config, vLLM adapter, single-turn alignment, reward handoff, docs, CPU tests (the draft above).
- SGLang adapter (needs its equivalent of
logprob_token_ids). - Multi-turn / tool agent loop alignment (per-turn segments).
Questions for maintainers
- Is
extra_info["selected_token_logprobs"]the right handoff key, or should rollout-produced evidence live under a reserved namespace (e.g.extra_info["verl_rollout"]) to avoid collisions with dataset fields? - Dense-by-default vs. mandatory positions: dense is simpler for users and bounded by the byte cap; is there a reason to prefer mandatory positions?
- Should the payload also be offered on the v1 (TransferQueue) path in this revision, or is v0 + streaming reward the right first target?
Source: verl-project/verl