LOOKAT: 用于内存高效变换器的查找优化键注意力
LOOKAT: Lookup-Optimized Key-Attention for Memory-Efficient Transformers
AI总结:
LOOKAT通过查找优化键注意力,实现内存高效变换器的压缩,保持高保真度的同时提升计算效率。
摘要:
压缩KV缓存是将大语言模型部署到边缘设备上的必要步骤。当前的量化方法只能压缩存储,但无法减少带宽,因为注意力计算需要将INT4/INT8的键解量化为FP16后再使用。我们发现注意力评分在数学上等同于内积相似性搜索,并可以应用一些向量数据库的压缩技术来更好地压缩KV缓存。我们提出了LOOKAT,通过将键向量分解到子空间、学习代码本以及通过查找表计算注意力表,将其应用于变换器架构中。这将注意力从内存密集型转变为计算密集型。LOOKAT在GPT-2上测试时,实现95.7%的输出保真度下的64倍压缩,以及95.0%保真度下的32倍压缩。LOOKAT不需要架构更改或训练,同时保持排名相关性ρ>0.95。理论分析证实,排名相关性随着O(d_k/mK)降级,经过验证在序列长度高达1024个标记时具有保证。
英文摘要:
Compressing the KV cache is a required step to deploy large language models on edge devices. Current quantization methods compress storage but fail to reduce bandwidth as attention calculation requires dequantizing keys from INT4/INT8 to FP16 before use. We observe that attention scoring is mathematically equivalent to the inner product similarity search and we can apply some compression techniques from vector databases to compress KV-cache better. We propose LOOKAT, which applies product quantization and asymmetric distance computation, to transformer architecture by decomposing key vectors into subspaces, learning codebooks and computing attention tables via lookup tables. This transforms attention from memory-bound to compute-bound. LOOKAT achieves 64 $\times$ compression at 95.7\% output fidelity and 32 $\times$ compression at 95.0\% fidelity when tested on GPT-2. LOOKAT requires no architecture changes or training while maintaining rank correlation $ρ> 0.95$. Theoretical analysis confirms that rank correlation degrades as $O(d_k/mK)$, with guarantees validated across sequence lengths up to 1024 tokens.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。