arXiv:2412.08585cs.LGcs.AI2024-12被引 6

提出高效量化注意力机制,显著提升大模型推理速度与内存效率。

TurboAttention: Efficient Attention Approximation For High Throughputs LLMs

  • 采用分头量化技术压缩键值缓存并实现激活乘法的量化执行
  • 通过稀疏软最大化避免注意力计算中的浮点反量化,提速1.2-1.8倍
  • 适合追求高吞吐、低内存占用的大模型部署场景

大语言模型(LLM)推理对计算和内存需求巨大,尤其在注意力机制方面。尽管量化和加速算法如FlashAttention提升了整体效率,但它们解决的是不同问题:量化关注权重与激活操作,而FlashAttention提升执行效率但需高精度格式。近期的键值(KV)缓存量化虽减少内存带宽,仍需浮点反量化进行注意力运算。本文提出TurboAttention,一种全面支持注意力量化执行的方法,同时优化内存与计算效率。其核心创新包括:FlashQ——一种分头注意力量化技术,实现KV缓存压缩与量化激活乘法;以及基于稀疏性的软最大化近似(SAS),消除注意力指数运算中对FP32反量化的需求。实验表明,TurboAttention在注意力部分实现1.2-1.8倍加速,KV缓存大小减少超4.4倍,最大吞吐比FP16基线提升2.37倍,并在多种数据集与模型上超越现有最先进量化与压缩技术。

原文摘要 · Abstract (English)

Large language model (LLM) inference demands significant amount of computation and memory, especially in the key attention mechanism. While techniques, such as quantization and acceleration algorithms, like FlashAttention, have improved efficiency of the overall inference, they address different aspects of the problem: quantization focuses on weight-activation operations, while FlashAttention improves execution but requires high-precision formats. Recent Key-value (KV) cache quantization reduces memory bandwidth but still needs floating-point dequantization for attention operation. We present TurboAttention, a comprehensive approach to enable quantized execution of attention that simultaneously addresses both memory and computational efficiency. Our solution introduces two key innovations: FlashQ, a headwise attention quantization technique that enables both compression of KV cache and quantized execution of activation-activation multiplication, and Sparsity-based Softmax Approximation (SAS), which eliminates the need for dequantization to FP32 during exponentiation operation in attention. Experimental results demonstrate that TurboAttention achieves 1.2-1.8x speedup in attention, reduces the KV cache size by over 4.4x, and enables up to 2.37x maximum throughput over the FP16 baseline while outperforming state-of-the-art quantization and compression techniques across various datasets and models.

大模型推理注意力机制量化高效计算

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