fix(pcg,mm): fix zeroing of input_embeds when replay PCG#22229
Merged
Conversation
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Contributor
Author
|
@Oasis-Git @ch-wan Could you please review this? |
5 tasks
Oasis-Git
approved these changes
Apr 7, 2026
Collaborator
Oasis-Git
left a comment
There was a problem hiding this comment.
Thanks for your contribution. It is correct.
Collaborator
|
/tag-and-rerun-ci |
liuhuijiayou
pushed a commit
to liuhuijiayou/sglang
that referenced
this pull request
Apr 7, 2026
liuhuijiayou
pushed a commit
to liuhuijiayou/sglang
that referenced
this pull request
Apr 7, 2026
yhyang201
pushed a commit
to yhyang201/sglang
that referenced
this pull request
Apr 22, 2026
caitengwei
pushed a commit
to caitengwei/sglang
that referenced
this pull request
Jun 1, 2026
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.
Motivation
Before PCG replay, there was an error in the buffer clearing logic for multimodal models. The shape of
buffers.input_embedsis (num_tokens, num_dim), and existing code incorrectly cleared it using the second dimension index. In some cases (num_dim > static_num_tokens), this could causeinput_embedsto retain content from the previous inference, potentially leading to incorrect inference results. This PR uses the correct clearing logic, indexing in thetokensdimension.For maintainers: I'm unsure if this issue causes a decrease in multimodal model accuracy and is related to some issues. It seems that PCG for multimodal models is not enabled by default for all models. I tested Qwen 3.5-27B on a sglang build that fixes the graph recompile and was able to reproduce the issue mentioned in this PR. The shape of
input_embedsis (4096, 5120), andstatic_num_tokens = 4096.Modifications
The logic for clearing
inputs_embedshas been corrected before replaying the multimodal model PCG.Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ci