Training Transformers for KV-Cache Compressibility
Yoav Gelberg, Yam Eitan, Michael Bronstein, Yarin Gal, Haggai Maron
NeurIPS page · OpenReview · alphaXiv · Open on the map
Category: Efficient LLM Inference & Training › Sparse Long-Context Attention · Type: new method · Keywords: KV cache compressibility, transformer training, post-hoc compression, long-context language modeling, representation learning
Areas: Long Context › Long-context mechanisms › Context compression
Summary
KV-CAT is a continued pretraining procedure that encourages transformers to learn compressible representations by masking KV slots during training, improving the quality-budget tradeoff of downstream compression methods.
Explained to a 5-year-old
A computer that reads long stories needs to remember what came before. It stores this memory in a special place. When the story is very long, this special place becomes huge and slow. We help the computer by pretending some memory slots are missing while it learns. This makes the computer learn to keep only the most important parts. Later, the computer can read faster and use less memory.
Explained to a 5-year-old, longer
Computers that read long texts need to remember what came before. They store this memory in a special place. When the text is very long, this special place becomes huge and slow. Existing tricks try to shrink the memory after the computer is already trained. But those tricks cannot change how the computer thinks about the text. The researchers noticed that some computers can remember things in a way that is easy to shrink. They proved that any computer can be made to remember either in an easy or a hard way. To help computers remember easily, they train the computer while pretending some memory slots are missing. This makes the computer learn to use only the most important parts of the memory. As a result, the computer can later read faster and use less memory. The new training method works for many tasks like finding information, answering questions, and guessing the next words. Overall, the approach makes long-text computers more efficient and easier to run.
For a technical reader
The paper addresses the memory bottleneck of the KV cache in long-context language models. It shows that compressibility depends on the model’s internal representations, not just the context. By masking KV slots during continued pretraining, the method forces the model to learn more compressible embeddings. Empirically, this leads to better quality-for-budget tradeoffs for downstream compression tasks such as retrieval and question answering.
Problem
Long-context language models suffer from memory and decode-time costs due to the Key-Value cache, which scales linearly with prefix length. Existing compression methods operate on fixed pretrained models and cannot alter the internal representations to be more compressible, limiting their effectiveness.
Method
The approach continues pretraining the model while applying a KV sparsification policy that masks KV slots during training, forcing the model to rely on fewer slots and learn representations that are amenable to compression. This encourages the emergence of compressible internal representations. The resulting models improve the tradeoff between compression quality and memory budget for downstream compression methods.
Results
The approach improves the quality-budget tradeoff of downstream compression methods across retrieval, long-context question answering, and perplexity-based evaluation of compressed-prefix continuation.
Contributions
We formalize KV compressibility as a property of learned representations and prove that any sequence-to-vector function can have both highly compressible and non-compressible implementations. We also propose a training procedure that incentivizes compressible representations, leading to better compression efficiency.
Research questions this paper is counted under
This page was written by language models from the title and abstract of each paper, and the answers were checked by two other models. It can be wrong: check the paper itself. Suggest a correction