让1200亿参数大模型在消费级显卡上流畅运行
RotaryQuant: Fitting 120B MoE Models on Consumer Hardware via Fused Compressed-Space Attention
- 三重压缩:量化权重、动态加载专家、旋转压缩缓存
- 260亿和300亿模型在16GB内存下运行,1200亿在32GB
- 支持32K上下文,速度达9-19词/秒,几乎无性能损失
大型混合专家(MoE)语言模型参数量达26至1200亿,因权重矩阵、线性增长的键值缓存及数十个需按需调用的专家子层,超出消费设备内存容量。本文提出RotaryQuant,一种三轴压缩系统:混合精度量化按结构角色分配位宽——密集层4比特、路由专家2比特、共享专家8比特(因其激活分布峰度高,难压缩);基于LRU的专家卸载将非驻留专家页到磁盘;创新的IsoQuant方法通过沃尔什-哈达玛变换与块对角SO(4)旋转,使激活分布各向同性后进行3比特标量量化,每头仅需256个存储参数,运算量为O(d log d),远低于传统方法的O(d²)和16,384。融合四核Metal GPU流水线直接在压缩后的3比特张量上执行注意力计算,无需还原全精度缓存状态,实现全新执行模式。该系统使Gemma 4-26B-A4B和Qwen3-30B-A3B在16GB预算内运行,Nemotron-H 120B在32GB内运行,交互速度达9–19词/秒,困惑度增量≤+0.0012,32K上下文下检索准确率达100%。
原文摘要 · Abstract (English)
Large mixture-of-experts (MoE) language models with 26--120 billion parameters exceed the memory capacity of consumer devices through three simultaneous pressures: resident weight matrices, key-value (KV) cache state that grows linearly with context, and dozens of expert sublayers that must be paged on demand. We present RotaryQuant, a three-axis compression system that addresses all three. Mixed-precision weight quantization assigns bit-widths by architectural role: 4-bit for dense layers, 2-bit for routed experts, and 8-bit for the shared expert whose high activation kurtosis resists aggressive compression. LRU expert offloading pages non-resident experts to disk under genuine memory pressure. The novel axis is IsoQuant, a KV cache compression method that applies a Walsh--Hadamard transform followed by block-diagonal SO(4) rotations to isotropize activation distributions before 3-bit scalar quantization, requiring $O(d \log d)$ operations and 256 stored parameters per head versus $O(d^2)$ and 16{,}384 for dense rotation methods. A fused four-kernel Metal GPU pipeline performs attention directly on packed 3-bit tensors without materializing full-precision KV state---a different execution model, not just a quantization scheme. The combined system fits Gemma 4-26B-A4B and Qwen3-30B-A3B within a 16\,GB budget and Nemotron-H 120B within 32\,GB, running interactively at 9--19 tok/s with near-zero perplexity degradation ($Δ$PPL $\leq +0.0012$) and 100\% retrieval accuracy at 32K context.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。