arXiv:2504.13989cs.LGcs.AI2025-04被引 1

用哈达玛矩阵优化大模型量化,实现3比特高效部署

Gradual Binary Search and Dimension Expansion : A general method for activation quantization in LLMs

  • 基于渐进二分搜索与哈达玛矩阵降低激活异常值
  • 3比特量化下准确率比现有方法提升40%
  • 适配非2的幂嵌入维度,适合边缘设备部署

大语言模型(LLMs)在人工智能中至关重要,但其数十亿参数导致在边缘设备上部署困难。量化是降低内存和推理时间的有效手段,但激活中的异常值成为低比特量化的瓶颈。本文利用哈达玛矩阵相较于随机旋转矩阵在理论上更优的特性,显著减少异常值。提出渐进二分搜索方法,实现权重、激活及键值缓存的3比特量化,在多个基准测试中准确率相比当前最优方法提升40%。通过佩利算法扩展旋转矩阵支持非2的幂嵌入维度,适配Qwen架构。实验验证了该方法在Mistral、LLaMA、Qwen等模型族上的有效性,首次实现可实用的3比特量化。

原文摘要 · Abstract (English)

Large language models (LLMs) have become pivotal in artificial intelligence, demonstrating strong capabilities in reasoning, understanding, and generating data. However, their deployment on edge devices is hindered by their substantial size, often reaching several billion parameters. Quantization is a widely used method to reduce memory usage and inference time, however LLMs present unique challenges due to the prevalence of outliers in their activations. In this work, we leverage the theoretical advantages of Hadamard matrices over random rotation matrices to push the boundaries of quantization in LLMs. We demonstrate that Hadamard matrices are more effective in reducing outliers, which are a significant obstacle in achieving low-bit quantization. Our method based on a gradual binary search enables 3-bit quantization for weights, activations, and key-value (KV) caches, resulting in a 40% increase in accuracy on common benchmarks compared to SoTA methods. We extend the use of rotation matrices to support non-power-of-2 embedding dimensions, similar to the Qwen architecture, by employing the Paley algorithm. We theoretically demonstrates the superiority of Hadamard matrices in reducing outliers.We achieved 3-bit quantization for weights, activations, and KV cache, significantly enhancing model performance. Our experimental results on multiple models family like Mistral, LLaMA, and Qwen demonstrate the effectiveness of our approach, outperforming existing methods and enabling practical 3-bit quantization.

大模型量化3比特哈达玛矩阵边缘部署

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。