-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Model] Switch to Fused RMSNorm in GLM-4.1V model #24733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: SamitHuang <285365963@qq.com>
👋 Hi! Thank you for contributing to the vLLM project. 💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels. Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run You ask your reviewers to trigger select CI tests on top of Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging. To run CI, PR reviewers can either: Add If you have any questions, please reach out to us on Slack at https://slack.vllm.ai. 🚀 |
There was a problem hiding this comment.
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 fused RMSNorm in the GLM4.1-VL model, aiming to simplify computation and enable further optimizations. The code changes involve modifying the forward
function in glm4_1v.py
to incorporate the fused RMSNorm operation. A review comment is provided to address a potential correctness issue.
x_fused_norm, residual = self.norm2(x, residual=x_attn) | ||
x = residual + self.mlp(x_fused_norm) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original code x = residual + self.mlp(x_fused_norm)
might introduce a correctness issue. It seems that the residual x
from the input of norm2 is not considered in the calculation. It is crucial to add the initial x
before applying the MLP to maintain the residual connection properly. This could lead to incorrect results in the model's output.
Consider changing the calculation to x = x + residual + self.mlp(x_fused_norm)
to address this issue.
x = x + residual + self.mlp(x_fused_norm)
Main is broken, let me just merge this |
Signed-off-by: SamitHuang <285365963@qq.com>
Signed-off-by: SamitHuang <285365963@qq.com>
Signed-off-by: SamitHuang <285365963@qq.com> Signed-off-by: bbartels <benjamin@bartels.dev>
Signed-off-by: SamitHuang <285365963@qq.com>
Purpose
This PR supplements fused RMSNorm for GLM4.1 vision language model. As discussed in #22184, this optimization can simplify the computation trace and enable further optimizations for the vision encoder.
related to #23884
Test Plan
Test the performance change using the vllm benchmark tool on VisionArena data, with the following settings:
Test Result
before:
after
Note that the Mean TTFT is reduced by 916.27ms (66172.22 to 65255.95ms), corresponding to the gain in encode and prefill stage.
Essential Elements of an Effective PR Description Checklist
supported_models.md
andexamples
for a new model.