用不确定性检测稀疏性,实现大模型长上下文推理的高效无损压缩。
UNComp: Can Matrix Entropy Uncover Sparsity? -- A Compressor Design from an Uncertainty-Aware Perspective
- 基于截断矩阵熵衡量不确定性,动态识别可压缩区域。
- KV缓存压缩至原始大小的4.74%,预填充速度提升6%,吞吐量提高6.4倍。
- 适合关注模型压缩与长序列推理优化的研究者和工程师。
大型语言模型(LLMs)在长上下文推理中面临内存与计算开销大的挑战。尽管键值(KV)缓存压缩技术能降低内存占用,但通常忽略隐藏状态与对应KV缓存间固有的结构化稀疏性。本文探索不确定性作为稀疏性的潜在指标,提出UNComp——一种基于不确定性感知的压缩框架。该方法利用截断矩阵熵识别信息量低的区域,揭示可用于自适应压缩的稀疏模式。不同于传统均匀压缩,UNComp依据反映组件重要性的不确定性度量动态调整压缩策略。分析表明,由不确定性估计导出的稀疏模式可揭示特殊长程依赖,如检索头和检索层。该视角不仅优化了压缩效率,还深化了对长上下文推理中模型内在稀疏性的理解。通过聚焦不确定性分析稀疏模式,UNComp将KV缓存大小降至原始的4.74%,实现6%的预填充加速,并带来6.4倍的吞吐提升,既实现强无损压缩性能,也验证了底层理论工具的有效性。代码已开源:https://github.com/menik1126/UNComp。
原文摘要 · Abstract (English)
Deploying large language models (LLMs) for long-context inference remains challenging due to their substantial memory and computational demands. While techniques such as Key-Value (KV) cache compression are designed to reduce memory usage, they often neglect the structured sparsity inherent in the relationship between hidden states and their corresponding KV cache. In this work, we explore the role of uncertainty as a potential indicator of sparsity within LLMs. We propose UNComp, an uncertainty-aware framework that leverages truncated matrix entropy to identify areas of low information content, thereby revealing sparsity patterns that can be used for adaptive compression. Unlike traditional methods that apply uniform compression, UNComp dynamically adjusts its approach to compression, guided by uncertainty measures that reflect the importance of various model components. Our analysis shows that sparsity patterns, when derived from uncertainty estimates, can be exploited to reveal special long-range dependencies, such as retrieval heads and retrieval layers. This perspective not only enhances our understanding of how compression can be optimized but also provides new insights into the inherent sparsity of LLMs during long-context inference. By focusing on uncertainty to analyze the sparsity pattern in detail, UNComp reduces the KV cache size to 4.74% of the original, achieves a 6% prefill speedup, and improves throughput by 6.4x - not only delivering strong lossless compression performance, but also validating the effectiveness of the underlying theoretical tool. We release the code at https://github.com/menik1126/UNComp.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。