Skip to content

fix(kimi): align input norm quant with attention quant - #1409

Merged
zhuyuhua-v merged 6 commits into
mainfrom
fix_kimi
Jul 8, 2026
Merged

fix(kimi): align input norm quant with attention quant#1409
zhuyuhua-v merged 6 commits into
mainfrom
fix_kimi

Conversation

@qichu-yun

@qichu-yun qichu-yun commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Motivation

Fix input RMSNorm quant fusion gating for Kimi/DeepSeek-style attention paths. The previous logic could infer quantization from the decoder layer prefix instead of the actual attention input projection, enabling fused RMSNorm quantization even when that projection could not consume the quantized activation. The PR also keeps non-Triton FP8 support for Kimi while avoiding unsupported block/group FP8 paths such as GLM-5.1-FP8.

Technical Details

  • Resolve the real attention input projection (fused_qkv_a_proj for LoRA-Q MLA, otherwise q_proj) and use its quant config to decide whether input RMSNorm quant fusion is allowed.
  • Support online quant configs when the offline projection config does not accept quantized input.
  • Enable fusion only for real FP8/FP4 quantized attention inputs.
  • Allow non-Triton FP8 fusion only for per-token FP8, preventing unsupported FP8 block/group quant kernels from being used.
  • Preserve the existing non-Triton MXFP4 gating path.

Test Plan

1. fix the bug:
launch server:

export HIP_VISIBLE_DEVICES=0,1,2,3
export AITER_QUICK_REDUCE_QUANTIZATION=INT4
export AITER_USE_FLYDSL_MOE_SORTING=1
export AITER_AR_1STAGE_MAX_KB=512

model_path=/shared/data/amd_int/models/Kimi-K2.5-MXFP4
vllm serve $model_path \
    --host localhost \
    --port 9000 \
    --tensor-parallel-size 4 \
    --trust-remote-code \
    --async-scheduling \
    --gpu_memory_utilization 0.9 \
    --kv-cache-dtype fp8 \
    --max-num-batched-tokens 16384 \
    --max-model-len 16384 \
    --compilation-config '{"cudagraph_mode": "FULL_AND_PIECEWISE"}' \
    --profiler-config '{"profiler": "torch", "torch_profiler_dir": "kimi_k2_5_mxfp4_attnfp8_tp4_profile", "torch_profiler_record_shapes": "True"}' \
    --no-enable-prefix-caching

before:
image

after:
image

image

2.input rmsnorm and quant fused for kimi2.5
before:
image

after:
image

Test Result

accuracy:
image

Submission Checklist

@zufayu
zufayu requested a review from jiayyu July 1, 2026 01:43
@qichu-yun
qichu-yun force-pushed the fix_kimi branch 2 times, most recently from bbdf231 to 1459c68 Compare July 1, 2026 15:29
Check the attention input projection quant config before enabling input RMSNorm quant fusion, and allow FP8 projection inputs on non-Triton paths.
Keep the attention projection based gate behavior while removing redundant helper state from the input RMSNorm quant fusion path.
@qichu-yun qichu-yun changed the title [VLLM plugin] fix(kimi): align input norm quant with attention quant fix(kimi): align input norm quant with attention quant Jul 6, 2026
ZhangLirong-amd
ZhangLirong-amd previously approved these changes Jul 6, 2026
)
self.quant_dtype = None
self.input_norm_quant_type = None
if quant_config is not None:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

more clean up needed..

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Moved the definitions of self.quant_dtype and self.input_norm_quant_type into init to centralize initialization.

@zhuyuhua-v
zhuyuhua-v merged commit 7674ee8 into main Jul 8, 2026
66 of 76 checks passed
@zhuyuhua-v
zhuyuhua-v deleted the fix_kimi branch July 8, 2026 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants