[ROCm] Support MiniMax-M3 NVFP4 SwiGLU-OAI - #48939
wangjiaxin99 wants to merge 5 commits into
Conversation
|
@wangjiaxin99 please provide the vllm serve command and gsm8k numshot 20 score. numshot 20 and high concurrency is to ensure that the sparse indexer logic is correct. |
c5050d8 to
2bf1329
Compare
Signed-off-by: jiaxwang <jiaxwang@amd.com>
2bf1329 to
e15dff8
Compare
Sure, here is the command I used. @tjtanaa The vllm serve /mnt/amd/MiniMax-M3-NVFP4 \
--trust-remote-code \
--block-size 128 \
--tensor-parallel-size 4 \
--attention-backend TRITON_ATTN \
--mm-encoder-tp-mode data \
--mm-encoder-attn-backend ROCM_AITER_FA \
--tool-call-parser minimax_m3 \
--enable-auto-tool-choice \
--reasoning-parser minimax_m3The GSM8K accuracy for the regular evaluation is already reported in the model card: I also ran the requested GSM8K 20-shot evaluation with high concurrency: #!/bin/bash
MODEL=/mnt/amd/MiniMax-M3-NVFP4
NUM_FEWSHOT=${NUM_FEWSHOT:-20}
RESULT_TAG=${RESULT_TAG:-minimaxm3_numshot${NUM_FEWSHOT}_cc256}
lm_eval --model local-completions \
--model_args model=$MODEL,base_url=http://0.0.0.0:8000/v1/completions,num_concurrent=256,max_retries=10,max_gen_toks=2048,max_length=1048576,timeout=60000,trust_remote_code=True,temperature=0 \
--batch_size auto \
--tasks gsm8k \
--num_fewshot "${NUM_FEWSHOT}" \
--output_path "./results_${RESULT_TAG}" \
--log_samples \
| tee "lmeval_${RESULT_TAG}.log"Result: Please let me know if you would like me to run any additional settings. |
|
Hi @tjtanaa , thanks again for the guidance. I’ve added the requested Thanks! |
|
This pull request has merge conflicts that must be resolved before it can be |
Signed-off-by: wangjiaxin99 <jiaxwang@amd.com>
tjtanaa
left a comment
There was a problem hiding this comment.
Thank you for pinging @wangjiaxin99 . LGTM.
|
✅ @wangjiaxin99, CI is now available for this PR.
|
|
/ci run |
|
✅ Triggered Buildkite CI #84581 for commit |
|
Hi @wangjiaxin99, the pre-commit checks have failed. Please run: uv pip install pre-commit>=4.5.1
pre-commit install
pre-commit run --all-filesThen, commit the changes and push to your branch. For future commits, |
|
@wangjiaxin99 can you fix the pre-commit |
| gemm1_alpha=swiglu_alpha, | ||
| gemm1_beta=swiglu_beta, | ||
| gemm1_clamp_limit=swiglu_limit, | ||
| gemm1_alpha=swiglu_alpha, |
There was a problem hiding this comment.
duplicated from L503 above
BowenBao
left a comment
There was a problem hiding this comment.
maybe it's fixed in another PR? now the only thing new is unittest, the rest seems duplicated after solving merge conflict.
|
Hi @wangjiaxin99, the pre-commit checks have failed. Please run: uv pip install pre-commit>=4.5.1
pre-commit install
pre-commit run --all-filesThen, commit the changes and push to your branch. For future commits, |
|
Hi @wangjiaxin99, the pre-commit checks have failed. Please run: uv pip install pre-commit>=4.5.1
pre-commit install
pre-commit run --all-filesThen, commit the changes and push to your branch. For future commits, |
|
I will close this PR since this issue has been fixed in #47106 |
You're right, this PR ended up duplicating changes that had already been merged. I verified that there wasn't any additional functional change beyond what's already in the codebase, so I've closed the PR. Thanks for pointing it out. |
Thanks for the heads-up. I checked and found that this PR was duplicating changes that had already been merged, so I've closed it. Appreciate you taking a look! |
MiniMax-M3 NVFP4 ROCm SwiGLU-OAI Support
Summary
swiglu_limit.swiglu_alphaandswiglu_betametadata from Quark MoE layers intoFusedMoEQuantConfigasgemm1_alphaandgemm1_beta.Motivation
MiniMax-M3 uses a clamped SwiGLU-OAI activation in its MoE experts. On ROCm, Quark NVFP4 checkpoints rely on the NVFP4 emulation backend rather than native NVIDIA FP4 kernels. Before this change, models with
swiglu_limitfiltered the emulation backend out of the candidate backend list before support probing, so ROCm could not fall back to the path that can apply the activation parameters.The Quark NVFP4 path also did not pass
swiglu_limit,swiglu_alpha, orswiglu_betafrom the layer into the shared NVFP4 MoE quant config helper. As a result, the execution backend could not receive the activation metadata needed to reproduce MiniMax-M3's MoE formula.Implementation
The change updates the NVFP4 MoE backend oracle to treat
NvFp4MoeBackend.EMULATIONas clamp-capable. This lets ROCm deployments withswiglu_limitreach the emulation backend during normal backend selection.The shared
nvfp4_moe_quant_confighelper now accepts optionalgemm1_alphaandgemm1_betascalar parameters and stores them inFusedMoEQuantConfig. The EMULATION branch ofmake_nvfp4_moe_quant_configmaps layer-levelswiglu_alphaandswiglu_betato thesegemm1_*fields, matching where the activation is applied: after the first MoE GEMM and before the down projection.The Quark NVFP4 MoE method now reads
swiglu_limit,swiglu_alpha, andswiglu_betafrom the layer withgetattr(..., None)and forwards them into the shared helper. Models without those attributes continue to use the existingNonedefaults.Support Model and Accuracy
https://huggingface.co/amd/MiniMax-M3-NVFP4
Note
This is scoped to NVFP4 MoE quant config construction and Quark's NVFP4 MoE method. Existing models that do not define SwiGLU-OAI attributes continue passing
None, preserving prior behavior. The main behavioral change is thatEMULATIONcan now be selected for clamped SwiGLU NVFP4 MoE models.