[AMD][MXFP4] Online MXFP4 quantization 1/N - dense and MOE models w. original BF16 weight (#18005)

Co-authored-by: Bowen Bao <bowenbao@amd.com>
Co-authored-by: Colin Zeng <Colin.Zeng@amd.com>
This commit is contained in:
fxmarty-amd
2026-06-03 12:55:24 -07:00
committed by GitHub
co-authored by Bowen Bao Colin Zeng
parent e0b692600f
commit 293816ab14
12 changed files with 509 additions and 26 deletions
@@ -14,7 +14,7 @@ on-the-fly to convert high-precision weights into a lower-precision format.
**Note: For better performance, usability and convenience, offline quantization is recommended over online quantization.**
If you use a pre-quantized model, do not add `--quantization` to enable online quantization at the same time.
If you use a pre-quantized model, **do not add `--quantization` to enable online quantization at the same time**.
For popular pre-quantized models, please visit [Unsloth](https://huggingface.co/unsloth), [NVIDIA ModelOpt](https://huggingface.co/collections/nvidia/inference-optimized-checkpoints-with-model-optimizer)
or [NeuralMagic](https://huggingface.co/collections/neuralmagic) collections on HF for some
popular quality validated quantized models. Quantized models must be validated via benchmarks post-quantization
@@ -804,6 +804,18 @@ SGLang running on AMD GPUs (CDNA3 or CDNA4 architecture) supports the quantizati
Other layers (e.g. projections in the attention layers) have their weights quantized online to float8 directly.
### `quark_mxfp4` online quantization method
SGLang running on AMD GPUs with hardware FP4 support (CDNA4 architecture, e.g. MI355x) supports the quantization method `--quantization quark_mxfp4`, that will quantize BF16 model weights to MXFP4 at load time, use dynamic MXFP4 quantization for activations and MXFP4 GEMMs instead of BF16 GEMMs.
Example:
```bash
sglang serve --model-path Qwen/Qwen3-30B-A3B \
--tensor-parallel-size 1 \
--quantization quark_mxfp4
```
## Reference
- [GPTQModel](https://github.com/ModelCloud/GPTQModel)