[sglang-miles] True on-policy training support for FSDP2 - #18639
Merged
Conversation
- parallel_state.py: add try/except to get_tensor_model_parallel_rank() (returns 0 on exception, needed for on-policy weight loading) - qwen3.py: Qwen3DecoderLayer.forward uses explicit post_residual_addition parameter instead of **kwargs for type safety - qwen3_vl.py: rewrite fast_pos_embed_interpolate to use manual bilinear interpolation (torch.compile compatible), inline deepstack_embeds computation for VLM true on-policy support Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
yueming-yuan
requested review from
AniZpZ,
BBuf,
CatherineSue,
Edwardf0t1,
FlamingoPg,
Fridge003,
HaiShaw,
JustinTong0323,
Ying1123,
ch-wan,
hnyls2002,
ispobock,
merrymercy,
slin1237 and
xiezhq-hermann
as code owners
February 11, 2026 22:30
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
yueming-yuan
added a commit
that referenced
this pull request
Feb 13, 2026
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
zianglih
pushed a commit
to zianglih/sglang
that referenced
this pull request
Feb 28, 2026
…#18639) Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
yueming-yuan
added a commit
that referenced
this pull request
Mar 5, 2026
yueming-yuan
added a commit
that referenced
this pull request
Mar 27, 2026
yueming-yuan
added a commit
that referenced
this pull request
Apr 6, 2026
5 tasks
zyzshishui
pushed a commit
to zyzshishui/sglang
that referenced
this pull request
Apr 24, 2026
…roject#18639) (cherry picked from commit 74c9eab) Co-authored-by: Zilin Zhu <zhuzilinallen@gmail.com> Co-authored-by: Nan Jiang <willjiang2018@gmail.com>
yueming-yuan
added a commit
that referenced
this pull request
May 21, 2026
JessicaJiang-123
pushed a commit
to JessicaJiang-123/sglang
that referenced
this pull request
Jun 21, 2026
nanjiangwill
pushed a commit
to nanjiangwill/sglang
that referenced
this pull request
Jul 7, 2026
XinyuJiangCMU
pushed a commit
to XinyuJiangCMU/sglang
that referenced
this pull request
Jul 17, 2026
yueming-yuan
added a commit
that referenced
this pull request
Jul 25, 2026
…ense) (#18639) Squashes the qwen_dense on-policy follow-up into the original FSDP2 commit: the follow-up rewrote the norm_kwargs / rl_on_policy_target call sites this commit introduced, so they cannot be applied independently. Rebased onto v0.5.16: rl_on_policy_target predicates now go through the sglang.srt.true_on_policy helpers, and every legacy get_global_server_args() call site uses runtime_context.get_server_args() so v0.5.16's test_legacy_global_ratchet baseline still holds. Co-authored-by: maocheng23 <35615230+maocheng23@users.noreply.github.com>
yueming-yuan
added a commit
that referenced
this pull request
Jul 25, 2026
…ense) (#18639) Squashes the qwen_dense on-policy follow-up into the original FSDP2 commit: the follow-up rewrote the norm_kwargs / rl_on_policy_target call sites this commit introduced, so they cannot be applied independently. Rebased onto v0.5.16: rl_on_policy_target predicates now go through the sglang.srt.true_on_policy helpers, and every legacy get_global_server_args() call site uses runtime_context.get_server_args() so v0.5.16's test_legacy_global_ratchet baseline still holds. Co-authored-by: maocheng23 <35615230+maocheng23@users.noreply.github.com>
yueming-yuan
added a commit
that referenced
this pull request
Jul 25, 2026
…ense) (#18639) Squashes the qwen_dense on-policy follow-up into the original FSDP2 commit: the follow-up rewrote the norm_kwargs / rl_on_policy_target call sites this commit introduced, so they cannot be applied independently. Rebased onto v0.5.16: rl_on_policy_target predicates now go through the sglang.srt.true_on_policy helpers, and every legacy get_global_server_args() call site uses runtime_context.get_server_args() so v0.5.16's test_legacy_global_ratchet baseline still holds. Co-authored-by: maocheng23 <35615230+maocheng23@users.noreply.github.com>
yueming-yuan
added a commit
that referenced
this pull request
Jul 25, 2026
…ense) (#18639) Squashes the qwen_dense on-policy follow-up into the original FSDP2 commit: the follow-up rewrote the norm_kwargs / rl_on_policy_target call sites this commit introduced, so they cannot be applied independently. Rebased onto v0.5.16: rl_on_policy_target predicates now go through the sglang.srt.true_on_policy helpers, and every legacy get_global_server_args() call site uses runtime_context.get_server_args() so v0.5.16's test_legacy_global_ratchet baseline still holds. Co-authored-by: maocheng23 <35615230+maocheng23@users.noreply.github.com>
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
Cherry-pick true on-policy training changes from
sglang-slime-trueontosglang-miles, enabling deterministic inference that exactly matches the FSDP2 training forward pass.Changes across 11 files in 3 commits:
Core layer changes:
fp32_residualdefault toTrue, removeweight_dtype/override_orig_dtypeparams, add two-branchforward_native(bf16 vs fp32 residual paths), addpost_residual_additiontoxin allreduce fusion pathpost_residual_additionparameter throughprepare_attnandprepare_attn_and_communicatetorch.compile(dynamic=True)wrapper whenrl_on_policy_targetis setlog_softmaxafter standard temperature division (instead of separate bf16 div path)torch.compileMoE sum reduce withenable_deterministic_inferencecheckModel changes:
fp32_residual=Falsein on-policy norm_kwargs, explicitpost_residual_additionin decoder forwardfp32_residual=Falsenorm_kwargsfast_pos_embed_interpolatewith pure-torch manual bilinear interpolation (torch.compile compatible), inline deepstack computationInfrastructure:
get_tensor_model_parallel_rank()when TP group not initializedOrigin
--host 0.0.0.0, but it can't be called on another server #1121)