为何Gated DeltaNet能在4位量化中存活:混合27B大语言模型中循环半部分的NVFP4 W4A4

·

研究论文 · 2026/09/04

混合大语言模型将 softmax 注意力与线性注意力层(如 Gated DeltaNet, GDN)配对,其循环状态以固定大小总结上下文。早期社区对 Qwen3.8-27B 的 4 位量化(48 个 GDN 层,16 个注意力层)将 GDN 块保留在 8 位或 16 位精度,尤其是其衰减和写入强度门,直觉认为循环中的误差会在长上下文中累积。我们通过构建 Minima 来测试这一直觉:对所有 496 个线性层(包括 GDN)采用 NVFP4 W4A4。在 4K/32K 困惑度、MMLU-Pro、GSM8K、AIME'25、GPQA-Diamond、LiveCodeBench 和 RULER 检索(至 64K)中,Minima 在种子噪声内与 BF16 匹配(5 任务平均 -0.52),同时是最小(17.5 GiB)和最快预填充(+14-19%)的配方,其 32K 困惑度差距随位置缩小。四部分机制研究解释了原因:(i)NVFP4 的 16 元素块缩放局部化残差流的极端异常值,均衡各层角色的激活误差;(ii)据称脆弱的门投影最不敏感——softplus/指数和 sigmoid 参数化将约 11% 的 GEMM 误差压缩到约 2% 的输出误差;(iii)delta 规则循环在 32K 令牌上保持注入噪声的平坦平台,并在数百步内遗忘状态脉冲,因为每次写入沿当前键方向覆盖状态;(iv)每令牌量化成本随上下文抵消而非复合。我们还修复了当按模块校准的 NVFP4 检查点由融合这些模块为单个 GEMM 的内核服务时出现的全局尺度不匹配,并显示校准的 FP8 KV 缓存尺度无性能损失。结果:一个实用配方——量化一切,携带 KV 尺度——以及为什么混合 LLM 的循环一半是容易量化的一半的机制解释。检查点:https://huggingface.co/minima-ai/mnma_qwen3.8_27b_nvfp4

该文挑战了混合 LLM 中循环层难以量化的普遍假设,通过系统实验和机制分析证明 4 位量化可行,提供了实用配方和深刻见解,对高效部署 LLM 有重要价值。

Hybrid LLMs pair softmax attention with linear-attention layers such as Gated DeltaNet (GDN), whose recurrent state summarizes the context in fixed size. Early community 4-bit quantizations of Qwen3.8-27B (48 GDN layers, 16 attention layers) left the GDN block in 8- or 16-bit precision -- especially its decay and write-strength gates -- on the intuition that errors in a recurrence accumulate over long contexts. We test that intuition by building Minima: NVFP4 W4A4 on all 496 linear layers, GDN included. Across perplexity at 4K/32K, MMLU-Pro, GSM8K, AIME'25, GPQA-Diamond, LiveCodeBench, and RULER retrieval to 64K, Minima matches BF16 within seed noise (5-task average -0.52) while being the smallest (17.5 GiB) and fastest-prefill (+14-19%) recipe we compare, and its 32K perplexity gap shrinks with position. A four-part mechanism study explains why: (i) NVFP4's 16-element block scaling localizes the residual stream's extreme outliers, equalizing activation error across layer roles; (ii) the supposedly fragile gate projections are the least sensitive -- softplus/exponential and sigmoid parameterizations compress ~11% GEMM error to ~2% output error; (iii) the delta-rule recurrence holds injected noise at a flat plateau over 32K tokens and forgets a state impulse within hundreds of steps, because each write overwrites the state along the current key direction; (iv) the per-token quantization cost washes out with context instead of compounding. We also repair a global-scale mismatch that arises when per-module-calibrated NVFP4 checkpoints are served by kernels that fuse those modules into one GEMM, and show calibrated FP8 KV-cache scales are performance-free. The result: a practical recipe -- quantize everything, ship KV scales -- and a mechanistic account of why the recurrent half of a hybrid LLM is the easy half to quantize. Checkpoint: https://huggingface.co/minima-ai/mnma_qwen3.8_27b_nvfp4

阅读原文

参与讨论