[RL] Enable bounded top-p sampling-support replay - #2596
Open
nanjiangwill wants to merge 1 commit into
Open
Conversation
nanjiangwill
requested review from
Rockdu,
Shi-Dong,
Zhichenzzz,
fzyzcjy,
guapisolo,
jybsuper,
maocheng23,
yueming-yuan and
yushengsu-thu
as code owners
August 18, 2026 06:09
This was referenced Aug 18, 2026
nanjiangwill
force-pushed
the
feat/top-p-sampling-mask-actor-logprobs
branch
4 times, most recently
from
August 21, 2026 01:38
7cf7dd1 to
82f7948
Compare
nanjiangwill
marked this pull request as draft
August 21, 2026 04:28
nanjiangwill
marked this pull request as ready for review
August 21, 2026 04:28
nanjiangwill
force-pushed
the
feat/top-p-sampling-mask-actor-logprobs
branch
5 times, most recently
from
August 24, 2026 04:46
4304bee to
c698b5e
Compare
nanjiangwill
force-pushed
the
feat/top-p-sampling-mask-actor-logprobs
branch
4 times, most recently
from
August 30, 2026 07:32
ee648b1 to
e69c908
Compare
nanjiangwill
force-pushed
the
feat/top-p-sampling-mask-actor-logprobs
branch
3 times, most recently
from
August 30, 2026 13:53
68920ab to
3ac3adc
Compare
nanjiangwill
force-pushed
the
feat/top-p-sampling-mask-actor-logprobs
branch
from
September 1, 2026 02:23
3ac3adc to
c9d1305
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--rollout-top-pis below 1; require a positive--rollout-top-kas the hard support bound.top_p=1on the existing path: no capture request, sampling-mask transport, reconstruction, or actor masking, including whentop_kis finite.Why
SGLang samples each token from the distribution remaining after its sampling filters. Scoring that token with a full-vocabulary actor softmax is a different policy. Correct policy ratios require both sides to use the same realized action space: SGLang returns the support and its normalized rollout log-probability, and Miles normalizes actor log-probability over that support.
SGLang remains the source of truth; Miles does not reconstruct top-p or top-k filtering. Run-level
top_konly bounds the returned support and transport size. It does not enable replay by itself. Per-request top-p may vary below 1, while request top-k must stay within the configured bound and temperature must match actor scoring.Reference, teacher, value, evaluation, and entropy paths remain unchanged. Forced tool or environment tokens use singleton support because they were not sampled by the policy.
API changes
--rollout-top-p < 1currently requires--use-miles-router; argument validation fails before startup otherwise because the model gateway does not forwardreturn_sampling_maskfor chat-completions requests.server_group.pycarriesTODO(#2596)beside the engine environment setup with the bounded SGLang metadata-buffer configuration required when Miles-router PD support is added.compute_request_payloadand the legacy rolloutgenerateaccept a keyword-onlyevaluationflag so evaluation can skip training-only capture.forward_onlyacceptsuse_rollout_sampling_maskbecause only actor scoring consumes captured support; reference, teacher, and value forwards do not.Series
Both prerequisite PRs are merged; this PR is one commit on current
main.Validation
main: live SGLang TP=2 rollout, sampling-mask transport, Megatron TP=2 actor scoring, training, and weight update. The actor/rollout log-probability absolute difference was0.00756against the0.03CI threshold.return_sampling_mask; Miles rejects that configuration during argument validation and also fails closed if required response metadata is absent.Acknowledgements
Thank you to Zilin Zhu for adding top-p masking support to slime in THUDM/slime#2102.