Share your thoughts, 1 month free Claude Pro on usSee more
WorkDL logo mark

Residual vector quantization for KV cache compression in large language model

About

KV cache compression methods have mainly relied on scalar quantization techniques to reduce the memory requirements during decoding. In this work, we apply residual vector quantization, which has been widely used for high fidelity audio compression, to compress KV cache in large language models (LLM). We adapt the standard recipe with minimal changes to compress the output of any key or value projection matrix in a pretrained LLM: we scale the vector by its standard deviation, divide channels into groups and then quantize each group with the same residual vector quantizer. We learn the codebook using exponential moving average and there are no other learnable parameters including the input and output projections normally used in a vector quantization set up. We find that a residual depth of 8 recovers most of the performance of the unquantized model. We also find that grouping non-contiguous channels together works better than grouping contiguous channels for compressing key matrix and the method further benefits from a light weight finetuning of LLM together with the quantization. Overall, the proposed technique is competitive with existing quantization methods while being much simpler and results in 5.5x compression compared to half precision.

Ankur Kumar• 2024

Related benchmarks

TaskDatasetResultRank
Language ModelingC4
Perplexity9
482
Physical Interaction Question AnsweringPIQA
Accuracy76.88
462
Language ModelingWikiText-2
Perplexity9.05
205
Long-context evaluationLongBench
Average Score38.47
96
Common Sense ReasoningHellaSwag
Accuracy75.23
85
Common Sense ReasoningWinoGrande
Accuracy69.3
67
ReasoningARC Challenge
Accuracy57.76
44
Mathematical ReasoningMATH 500
Accuracy13.4
22
Long-context performance evaluationRULER
Accuracy94
17
TruthfulnessTruthfulQA
Accuracy51.05
10
Showing 10 of 13 rows

Other info

Follow for update