FreqKV: Frequency Domain Key-Value Compression for Efficient Context Window Extension
Jushi Kai, Boyi Zeng, Yixuan Wang, Haoli Bai, Ziwei He, Bo Jiang, Zhouhan Lin
TL;DR
The paper tackles the challenge of limited context windows and quadratic attention costs in decoder-only LLMs by introducing FreqKV, a frequency-domain KV compression technique. KV states are transformed to the frequency domain via DCT, where low-frequency components—carrying most information—are retained and high-frequency components discarded, enabling iterative, on-the-fly context window extension without architectural changes. With minimal fine-tuning, LLMs learn to leverage the compressed KV cache, achieving competitive long-context perplexities and state-of-the-art results on long-context understanding benchmarks while maintaining low decoding overhead. This method offers a practical pathway to deploy longer-context LLMs with reduced memory and computation, improving scalability and applicability in real-world tasks.
Abstract
Frequency-domain compression has proven effective in reducing redundancies for spatial signals. In this work, we propose FreqKV, a novel frequency domain key-value (KV) compression technique that enables efficient context window extension for decoder-only large language models (LLMs). Our approach is motivated by a key observation that, in the frequency domain, the energy distribution of the KV cache is predominantly concentrated in low-frequency components. By discarding high-frequency components, we achieve efficient compression of the KV cache with minimal information loss. FreqKV iteratively compresses the increasing KV cache to a fixed size in the frequency domain, allowing models to process lengthy contexts efficiently. Introducing no additional parameters or architectural modifications, FreqKV is applicable to both fine-tuning and inference. With minimal fine-tuning, LLMs can learn to leverage the limited cache that is compressed in the frequency domain and extend the context window. Experiments on a range of long context language modeling and understanding tasks demonstrate the efficiency and effectiveness of the proposed method.
