Skip to content

[1/N][BUGFIX][Sync sglang-miles] True on-policy training support for FSDP2 - #23543

Draft
zyzshishui wants to merge 14 commits into
sgl-project:mainfrom
zyzshishui:top
Draft

[1/N][BUGFIX][Sync sglang-miles] True on-policy training support for FSDP2 #23543
zyzshishui wants to merge 14 commits into
sgl-project:mainfrom
zyzshishui:top

Conversation

@zyzshishui

Copy link
Copy Markdown
Contributor

Motivation

Synced from #18639 and add tests

Modifications

Accuracy Tests

Manually ported logprobs from FSDP2 Qwen3-0.6B https://huggingface.co/datasets/zyzshishui0627/qwen3-0.6b-fsdp2 and confirmed diff is 0.

Speed Tests and Profiling

Checklist

Review and Merge Process

  1. Ping Merge Oncalls to start the process. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments or contact authorized users to do so.
    • Common commands include /tag-and-rerun-ci, /tag-run-ci-label, /rerun-failed-ci
  4. After green CI and required approvals, ask Merge Oncalls or people with Write permission to merge the PR.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces several optimizations and fixes for RL on-policy inference across Qwen2 and Qwen3 models. Key changes include refactoring RMSNorm to handle residual additions and precision more consistently, implementing a deterministic inference path for MoE kernels, and significantly optimizing position embedding interpolation in Qwen3-VL by replacing NumPy-based CPU loops with vectorized Torch operations. Additionally, the PR refactors logit processing in the sampler and adds regression tests for on-policy logprob alignment. Review feedback highlighted a scaling bug in RMSNorm during all-reduce fusion, precision loss when maintaining FP32 residuals, and a performance bottleneck in the Qwen3-VL interpolation logic caused by data movement between GPU and CPU.

Comment thread python/sglang/srt/layers/layernorm.py Outdated
Comment thread python/sglang/srt/layers/layernorm.py Outdated
Comment thread python/sglang/srt/models/qwen3_vl.py

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 25f0eefdd3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread python/sglang/srt/layers/layernorm.py
yueming-yuan and others added 2 commits April 24, 2026 05:22
…roject#18639)

(cherry picked from commit 74c9eab)

Co-authored-by: Zilin Zhu <zhuzilinallen@gmail.com>
Co-authored-by: Nan Jiang <willjiang2018@gmail.com>
@github-actions github-actions Bot added the Multi-modal multi-modal language model label Apr 24, 2026
@zyzshishui

Copy link
Copy Markdown
Contributor Author

@codex

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b3bc14b55a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread python/sglang/srt/layers/sampler.py Outdated
Comment thread python/sglang/srt/models/qwen3_moe.py Outdated
@zyzshishui zyzshishui changed the title [1/N][Sync sglang-miles] True on-policy training support for FSDP2 [1/N][BUGFIX][Sync sglang-miles] True on-policy training support for FSDP2 Apr 24, 2026
@zyzshishui
zyzshishui marked this pull request as draft April 25, 2026 04:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Multi-modal multi-modal language model

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants