透過低秩投影壓縮大型語言模型中的鍵值快取

Compressing KV-Cache in Large Language Models with Low-Rank Projection

檔案

日期

2024

類型

語言

英文

摘要

常見的KV-Cache 壓縮方法包含對留下重要的token 或將其量化為較低的位數。然而,這些方法無法利用KV-Cache 中隱藏維度中的冗餘性。本論文主要探討利用低秩投影來壓縮隱藏維度的獨特方法,一種新穎的KV-Cache 壓縮框架。Palu 將線性層分解為低秩矩陣,並暫存經過壓縮後較小的中間表示,並在需要時重建完整的鍵和值。為了提高準確性、壓縮率和運算效率,Palu 進一步提出了(1) 一種中粒度的低秩分解方案,(2) 一種高效的秩搜尋演算法,(3) 一種低秩感知量化演算法,以及(4) 使用優化的GPU CUDA Kernel 融合矩陣運算。我們在熱門大型語言模型上的廣泛實驗表明,Palu 可以將KV-Cache 壓縮超過91.25%,並在相同甚至更高的記憶體使用量下保持更高的準確性(困惑度最多降低1.19),優於最先進的KV-Cache 量化方法。在將KV-Cache 壓縮50% 時,Palu 在注意力模塊中實現了最高達1.61 倍的端到端加速。
KV-Cache compression methods generally sample a KV-Cache of effectual tokens or quantize it into lower bits. However, these methods cannot exploit the redundancy of the hidden dimension of KV tensors. This paper investigates a unique hidden dimension approach called Palu, a novel KV-Cache compression framework that utilizes low-rank projection. Palu decomposes the linear layers into low-rank matrices, caches the smaller intermediate states, and reconstructs the full keys and values on the fly. To improve accuracy, compression rate, and efficiency, Palu further encompasses (1) a medium-grained low-rank decomposition scheme, (2) an efficient rank search algorithm, (3) a low-rank-aware quantization algorithm, and (4) matrix fusion with optimized GPU kernels. Our extensive experiments with popular LLMs show that Palu can compress KV-Cache by more than 91.25% while maintaining a significantly better accuracy (up to 1.19 lower perplexity) than state-of-the-art KV-Cache quantization methods at a similar or even higher memory usage. When compressing KV-Cache for 50%, Palu delivers up to 1.61× end-to-end speedup for the attention module.
顯示完整詮釋資料 統計資料

引用此條目

Lin, W.-C. (2024). Compressing KV-Cache in Large Language Models with Low-Rank Projection. https://thesis.lib.nycu.edu.tw/handle/20.500.14371/2191

BibTeX RIS

引用文字依 APA 第 7 版格式自動產生,使用前請再核對。

分享

永久網址:https://thesis.lib.nycu.edu.tw/handle/20.500.14371/2191