[model_free_ptq] split fused moe experts to ensure quantization#2464
[model_free_ptq] split fused moe experts to ensure quantization#2464liwei109 wants to merge 1 commit intovllm-project:mainfrom
Conversation
|
👋 Hi! Thank you for contributing to llm-compressor. Please add the ready label when the PR is ready for review. Note: This is required to complete the testing suite, please only add the label once the PR is code complete and local testing has been performed. |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the model-free post-training quantization (PTQ) capabilities by addressing a specific challenge with Mixture-of-Experts (MoE) models that have fused expert weights. By introducing a mechanism to split these fused weights into their individual components, the PR ensures that such models can be accurately and effectively quantized, expanding the range of models supported by the quantization framework. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a mechanism to split fused MoE experts, which is a necessary step for quantizing models like Qwen3.5. The approach is sound, but I've found a few critical bugs in the implementation of split_fused_moe_experts. Specifically, the logic for generating new tensor names is incorrect and will lead to invalid keys. Additionally, there's a case where a tensor could be inadvertently dropped. I've also included some suggestions to improve code clarity and logging practices. Please address the identified bugs to ensure the feature works as expected.
HDCharles
left a comment
There was a problem hiding this comment.
see comments and bot comments, did you run the test successfully, it looks like the x.weight name bug should have produced an error, no?
|
The quality checks have failed. Please run |
Yes, I have test this on Qwen3.5 and Qwen3-VL series models, and all of these works well. |
|
@HDCharles This PR is ready to review. Thanks |
brian-dellabetta
left a comment
There was a problem hiding this comment.
Thanks @liwei109 for preparing this. I agree that this logic is needed, to mimic what is done via the Qwen3.5 MoE context in llm-compressor used during oneshot. Unfortunately I don't see a super clean way to leverage that directly without having additional code like you've added here.
Will make a note to discuss internally, cc @kylesayrs
|
This pull request has merge conflicts that must be resolved before it can be |
Signed-off-by: Li Wei <[email protected]>
SUMMARY:
This PR adds a
split_fused_moe_expertsfunction for model-free quantization. This ensures that models with fused MoE layers (e.g., Qwen3.5 and Qwen3-VL) containing fusedgate_up_projanddown_projweights can be effectively quantized.TEST PLAN:
We add an example of Qwen3.5 for testing purpose.