Skip to content

[Examples] Add Qwen3.5-27B NVFP4A16 and MXFP4A16 quantization examples#2467

Merged
dsikka merged 4 commits intovllm-project:mainfrom
2imi9:add-qwen3.5-fp4-examples
Mar 18, 2026
Merged

[Examples] Add Qwen3.5-27B NVFP4A16 and MXFP4A16 quantization examples#2467
dsikka merged 4 commits intovllm-project:mainfrom
2imi9:add-qwen3.5-fp4-examples

Conversation

@2imi9
Copy link
Contributor

@2imi9 2imi9 commented Mar 12, 2026

Summary

  • Add Qwen3.5-27B example for NVFP4A16 quantization (w4a16_fp4/nvfp4)
  • Add Qwen3.5-27B example for MXFP4A16 quantization (w4a16_fp4/mxfp4)

Ignore list includes:

  • lm_head — output head
  • re:.*visual.* — vision encoder (Qwen3.5 is a VLM)
  • re:.*linear_attn.* — Gated DeltaNet fused projections incompatible with microscale formats (ref feat: add Qwen3.5 MoE calibration module #2383)
  • re:.*mtp.* — multi-token prediction modules

Note: Qwen3.5 (qwen3_5 arch) requires transformers>=5.x which is not yet compatible with llm-compressor. This PR is ready to land once the transformers version bump is completed.

Test plan

  • Verify quantization runs on Qwen3.5-27B with NVFP4A16 (blocked on transformers compat)
  • Verify quantization runs on Qwen3.5-27B with MXFP4A16 (blocked on transformers compat)
  • Confirm sample generation produces coherent output

@github-actions
Copy link

👋 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.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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 introduces new examples demonstrating how to apply two different FP4 quantization techniques, NVFP4A16 and MXFP4A16, to the Qwen3.5-27B large language model within the llmcompressor framework. These examples are designed to showcase the quantization process while explicitly ignoring specific model components that are either incompatible or not intended for quantization, such as the lm_head and visual encoder. The changes aim to expand the utility of llmcompressor by providing practical, ready-to-use scripts for a prominent model, pending an update to the transformers library for full compatibility.

Highlights

  • New Quantization Examples: Added examples for Qwen3.5-27B model using NVFP4A16 and MXFP4A16 quantization schemes.
  • Ignored Modules: Specified modules like lm_head, visual encoder, linear attention, and multi-token prediction modules are ignored during quantization.
  • Transformers Compatibility: Noted that the Qwen3.5 model requires transformers>=5.x, which is currently incompatible with llm-compressor, making these examples ready to land once compatibility is resolved.

🧠 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
  • examples/quantization_w4a16_fp4/mxfp4/qwen3.5_example.py
    • Added a new example script for MXFP4A16 quantization of Qwen3.5-27B.
  • examples/quantization_w4a16_fp4/nvfp4/qwen3.5_example.py
    • Added a new example script for NVFP4A16 quantization of Qwen3.5-27B.
Activity
  • No human activity has been recorded for this pull request yet.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@mergify mergify bot added the documentation Improvements or additions to documentation label Mar 12, 2026
@2imi9 2imi9 force-pushed the add-qwen3.5-fp4-examples branch from 04c3fd7 to 4c84571 Compare March 12, 2026 02:50
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 adds two new example scripts for quantizing the Qwen3.5-27B model using MXFP4A16 and NVFP4A16 schemes. The examples are clear and follow the existing structure. My main feedback is to address the significant code duplication between the two new files. I've suggested refactoring them into a single, parameterized script to improve maintainability. This would make the examples more concise and easier to manage in the long run.

Signed-off-by: Ziming <frankziming26@outlook.com>
@2imi9 2imi9 force-pushed the add-qwen3.5-fp4-examples branch from 4c84571 to df3ad83 Compare March 12, 2026 02:51
@2imi9
Copy link
Contributor Author

2imi9 commented Mar 16, 2026

Code Review

This pull request adds two new example scripts for quantizing the Qwen3.5-27B model using MXFP4A16 and NVFP4A16 schemes. The examples are clear and follow the existing structure. My main feedback is to address the significant code duplication between the two new files. I've suggested refactoring them into a single, parameterized script to improve maintainability. This would make the examples more concise and easier to manage in the long run.

Thanks, but this follows the existing repo convention — all examples (llama3, qwen3) are separate self-contained scripts per scheme. Keeping it consistent.

@dsikka dsikka added the ready When a PR is ready for review label Mar 17, 2026
Copy link
Collaborator

@dsikka dsikka left a comment

Choose a reason for hiding this comment

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

Hi @2imi9 this looks good to me - do you have any checkpoints that were generated from this example?

For transformers v5 support, you can look into rebasing your PR on top of; #2482

This should allow you to use qwen3.5 through transformers, once you update your version that is installed

@2imi9
Copy link
Contributor Author

2imi9 commented Mar 17, 2026

Hi @2imi9 this looks good to me - do you have any checkpoints that were generated from this example?

For transformers v5 support, you can look into rebasing your PR on top of; #2482

This should allow you to use qwen3.5 through transformers, once you update your version that is installed

Thanks @dsikka! Here are the checkpoints generated from the 9B variant (only have access to a single 5090 right now, so tested with 9B instead of 27B):

NVFP4A16: https://huggingface.co/2imi9/Qwen3.5-9B-NVFP4A16
MXFP4A16: https://huggingface.co/2imi9/Qwen3.5-9B-MXFP4A16
Quantization is working well. Already rebased on top of #2482.

@dsikka
Copy link
Collaborator

dsikka commented Mar 18, 2026

Hi @2imi9 this looks good to me - do you have any checkpoints that were generated from this example?
For transformers v5 support, you can look into rebasing your PR on top of; #2482
This should allow you to use qwen3.5 through transformers, once you update your version that is installed

Thanks @dsikka! Here are the checkpoints generated from the 9B variant (only have access to a single 5090 right now, so tested with 9B instead of 27B):

NVFP4A16: https://huggingface.co/2imi9/Qwen3.5-9B-NVFP4A16 MXFP4A16: https://huggingface.co/2imi9/Qwen3.5-9B-MXFP4A16 Quantization is working well. Already rebased on top of #2482.

Thank you! I made small updates to properly load the model and processor.
Thank you for the contribution!

@dsikka dsikka enabled auto-merge (squash) March 18, 2026 19:58
@dsikka dsikka mentioned this pull request Mar 18, 2026
25 tasks
Copy link
Collaborator

@brian-dellabetta brian-dellabetta left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution!

@dsikka dsikka merged commit eb49917 into vllm-project:main Mar 18, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation ready When a PR is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants