paper-with-me

홈 › Papers

A Simple and Effective $L_2$ Norm-Based Strategy for KV Cache Compression

2024-06-17 · Alessio Devoto, Yu Zhao, Simone Scardapane, Pasquale Minervini

The deployment of large language models (LLMs) is often hindered by the extensive memory requirements of the Key-Value (KV) cache, especially as context lengths increase. Existing approaches to reduce the KV cache size involve either fine-tuning the model to learn a compression strategy or leveraging attention scores to reduce the sequence length. We analyse the attention distributions in decoder-only Transformers-based models and observe that attention allocation patterns stay consistent across most layers. Surprisingly, we find a clear correlation between the $L_2$ and the attention scores over cached KV pairs, where a low $L_2$ of a key embedding usually leads to a high attention score during decoding. This finding indicates that the influence of a KV pair is potentially determined by the key embedding itself before being queried. Based on this observation, we compress the KV cache based on the $L_2$ of key embeddings. Our experimental results show that this simple strategy can reduce the KV cache size by 50% on language modelling and needle-in-a-haystack tasks and 90% on passkey retrieval tasks without losing accuracy. Moreover, without relying on the attention scores, this approach remains compatible with FlashAttention, enabling broader applicability.

📄 PDF Abstract BibTeX arXiv:2406.11430

Code (2)

alessiodevoto/l2compress 공식 구현 pytorch
answerdotai/cold-compress pytorch

Tasks

DecoderLanguage Modelling

Methods 이 논문이 사용한 방법론

Softmax The Softmax output function transforms a previous layer's output into a vector of probabilities. It is commonly used for multiclass classification. Given an input vector $x$…
Attention 설명 없음

Similar Papers 제목 키워드 기반

The Pitfalls of KV Cache Compression

2025-09-30 · Alex Chen, Renato Geh, Aditya Grover, Guy Van den Broeck 외 arxiv

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 particul…

SCOPE: Optimizing Key-Value Cache Compression in Long-context Generation

2024-12-18 · Jialong Wu, Zhenglin Wang, Linhai Zhang, Yilong Lai 외

Key-Value (KV) cache has become a bottleneck of LLMs for long-context generation. Despite the numerous efforts in this area, the optimization for the decoding phase is generally ignored. However, we believe such optimiza…

MiniCache: KV Cache Compression in Depth Dimension for Large Language Models

2024-05-23 · Akide Liu, Jing Liu, Zizheng Pan, Yefei He 외

A critical approach for efficiently deploying computationally demanding large language models (LLMs) is Key-Value (KV) caching. The KV cache stores key-value states of previously generated tokens, significantly reducing …

Quantization

GUI-KV: Efficient GUI Agents via KV Cache with Spatio-Temporal Awareness

2025-10-01 · Kung-Hsiang Huang, Haoyi Qiu, Yutong Dai, Caiming Xiong 외 arxiv

Graphical user interface (GUI) agents built on vision-language models have emerged as a promising approach to automate human-computer workflows. However, they also face the inefficiency challenge as they process long seq…

KV-CoRE: Benchmarking Data-Dependent Low-Rank Compressibility of KV-Caches in LLMs

2026-02-05 · Jian Chen, Zhuoran Wang, Jiayu Qin, Ming Li 외 arxiv

Large language models rely on kv-caches to avoid redundant computation during autoregressive decoding, but as context length grows, reading and writing the cache can quickly saturate GPU memory bandwidth. Recent work has…