Lexico: Extreme KV Cache Compression via Sparse Coding over Universal Dictionaries

Junhyuck Kim, Jongho Park, Jaewoong Cho, Dimitris Papailiopoulos

Introduction

As Large Language Models (LLMs) scale to handle increasingly long contexts—such as analyzing entire books or serving thousands of concurrent users—the Key-Value (KV) cache has emerged as a massive memory bottleneck. To generate text efficiently, Transformers store the "Keys" and "Values" of every previous token to avoid redundant computation. However, this cache grows linearly with both sequence length and model size, often exceeding the capacity of even high-end GPUs.

Current solutions to this memory crisis typically fall into two camps:

  1. Eviction: Discarding "unimportant" tokens, which risks breaking complex reasoning and losing critical context.
  2. Quantization: Reducing the numerical precision of the cache (e.g., to 4-bit or 2-bit). Unfortunately, extreme quantization like 2-bit often hits a "quality floor," causing the model to hallucinate or fail at basic logic.

Lexico introduces a novel third path: Sparse Coding. By representing KV vectors as sparse combinations of a small, "universal" dictionary, Lexico achieves 3–8x compression (using only 15–25% of original memory) while maintaining 90–95% of the model's original performance. Notably, it significantly outperforms 2-bit quantization in extreme low-memory scenarios.

The Lexico Methodology

The core discovery behind Lexico is that KV vectors across different prompts and tasks actually lie in similar low-dimensional subspaces. Instead of storing dense, high-precision vectors, Lexico compresses them using a three-step pipeline:

  1. Dictionary Pretraining: Lexico trains a "universal dictionary" of approximately 4,000 "atoms" (basis vectors) per transformer layer using a general dataset (WikiText-103). This dictionary is small, static, and remarkably generalizes to all future tasks.
  2. Sparse Decomposition: During inference, Lexico uses Orthogonal Matching Pursuit (OMP) to find the best $s$ atoms from the dictionary to reconstruct a given KV vector. Instead of storing a massive dense vector, the system only stores the indices and coefficients of these few selected atoms.
  3. Hybrid Storage: To maintain high accuracy, Lexico utilizes a hybrid approach. It keeps a small "full-precision buffer" for the most recent tokens, while older tokens are compressed into a Sparse Compressed Row (CSR) format. To maximize memory savings, the sparse coefficients are further quantized to 8-bit (FP8).
Overview of the Lexico pipeline, illustrating the prefilling stage with sparse approximation and the decoding stage utilizing a hybrid sparse cache and uncompressed buffer.

Key Insights

  • The "Universal" Discovery: Perhaps the most surprising finding is that a dictionary trained on a standard language modeling dataset (WikiText) generalizes perfectly to highly specialized domains, such as legal documents or complex math problems. This suggests that the "latent space" of LLM activations is far more structured and redundant than previously thought.
  • Sparsity as a Precision Slider: Unlike quantization, which forces models into rigid, fixed steps (e.g., 4-bit or 2-bit), Lexico allows for fine-grained control. Practitioners can choose exactly how many atoms ($s$) to use, enabling a highly precise trade-off between memory footprint and model accuracy.
  • Subspace Clustering: The authors observed that KV vectors from different inputs frequently cluster together in the same subspaces. Lexico exploits this inherent redundancy to represent complex vectors with just a handful of dictionary entries.

Evaluation and Results

Lexico was evaluated across several demanding benchmarks, including LongBench (long-context understanding), GSM8K (multi-step mathematical reasoning), and MMLU-Pro (professional knowledge and formula derivation).

  • Superior Low-Memory Performance: On the GSM8K reasoning task using Llama-3-8B, Lexico achieved 48.75% accuracy while consuming only ~26% of the original memory. In contrast, the 2-bit quantization baseline (KIVI-2) dropped to a mere 40.56%.
  • Extreme Compression: Lexico remains highly functional even at 12.4% memory usage—a severe regime where standard 2-bit quantization typically fails to produce coherent text.
  • Pareto Dominance: Across multiple model families (Llama 1B/3B/8B, Mistral, and Qwen), Lexico consistently sits on the "Pareto frontier." It offers the best accuracy-to-memory trade-off compared to leading eviction methods (SnapKV, PyramidKV) and quantization techniques (KIVI, ZipCache).

Limitations and Future Directions

While Lexico excels at memory reduction, its primary drawback is latency. Running the OMP algorithm to find sparse representations is computationally more expensive than a standard forward pass, adding latency primarily to the "prefilling" stage of generation.

Consequently, Lexico is currently best suited for memory-constrained environments—such as running a massive model on a single consumer GPU—rather than high-throughput data centers where raw speed is the primary metric. Future work will explore "soft-eviction" (dynamically adjusting sparsity based on token importance) and optimizing the OMP implementation for better GPU parallelization to close the latency gap.

Summary updated

BibTeX
@inproceedings{kim2025lexico,
  author = {Junhyuck Kim and Jongho Park and Jaewoong Cho and Dimitris Papailiopoulos},
  title = {{Lexico: Extreme KV Cache Compression via Sparse Coding over Universal Dictionaries}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=Yh9vxlxnjA},
}
Figure