The Pitfalls of KV Cache Compression

Chen, Alex, Geh, Renato, Grover, Aditya, Broeck, Guy Van den, Israel, Daniel

arXiv.org Artificial Intelligence 

KV cache compression promises increased throughput and efficiency with negligible loss in performance. While the gains in throughput are indisputable and recent literature has indeed shown minimal degradation on particular benchmarks, in general the consequences of compression in realistic scenarios such as multi-instruction prompting have been insufficiently studied. In this paper, we identify several pitfalls practitioners should be aware of when deploying KV cache compressed LLMs. Importantly, we show that certain instructions degrade much more rapidly with compression, effectively causing them to be completely ignored by the LLM. As a practical example of that, we highlight system prompt leakage as a case study, empirically showing the impact of compression on leakage and general instruction following. We show several factors that play a role in prompt leakage: compression method, instruction order, and KV eviction bias. We then propose simple changes to KV cache eviction policies that can reduce the impact of these factors and improve the overall performance in multi-instruction tasks. KV cache compression offers a compelling trade-off: sacrifice a small amount of model performance for substantial gains in inference efficiency. The technique addresses the main bottleneck in serving large language models (LLMs): the memory required to store the Key-V alue (KV) cache (Pope et al., 2023). During autoregressive generation, this cache grows linearly with context length, making inference a memory-bounded operation that limits server throughput and increases latency (Y uan et al., 2024b). Recently, many compression methods have emerged, each with various KV eviction techniques (Shi et al., 2024a).