add mxfp4 qat, mainly packing code.#2347
Merged
chensuyue merged 11 commits intointel:masterfrom Dec 5, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds support for MXFP4 (4-bit microscaling floating point) quantization-aware training (QAT), extending the existing MXFP8 support. The implementation includes packing utilities to convert FP4 values into packed uint8 format and export functionality for serialization.
Key changes:
- Added MXFP4 to QAT module mappings alongside MXFP8
- Implemented FP4 packing/unpacking utilities with bit manipulation
- Extended export logic to handle MXFP4 format with packed weight buffers
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| neural_compressor/torch/quantization/config.py | Adds MXFP4 to QAT module mappings for torch.nn.Linear |
| neural_compressor/torch/export/export_hf.py | Adds MXFP4 export path that packs weights into buffers |
| neural_compressor/torch/algorithms/qat/tensor_quantizer.py | Implements MXFP4 weight packing using new packing utilities |
| neural_compressor/torch/algorithms/qat/quant_utils.py | Adds MXFP4 detection and sets float-quantized format |
| neural_compressor/torch/algorithms/qat/mxfp4_packing.py | New file with FP4 casting and uint4-to-uint8 packing functions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
for more information, see https://pre-commit.ci
Contributor
Author
add ut |
yiliu30
reviewed
Dec 5, 2025
.../pytorch/nlp/huggingface_models/language-modeling/quantization/llm_qat/quantize_autoround.py
Show resolved
Hide resolved
yiliu30
approved these changes
Dec 5, 2025
Contributor
|
Code issue not related to this PR. |
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.
Description
add mxfp4 qat