A Self-Pruning Transformer: Extreme KV-Cache Compression with Universal Attention
cs.LG
Submitted: 2026-10-06
Updated: 2026-10-06
Comments: 27 pages, 3 figures, 14 tables
Code: https://github.com/NVIDIA/RULER2https:
License: http://creativecommons.org/licenses/by/4.0/
The gist: The large KV-cache size of modern LLMs creates a barrier to efficient deployment.
Terminology
Abstract
The large KV-cache size of modern LLMs creates a barrier to efficient deployment. Recent work has explored replacing attention layers' RoPE positional embeddings with alternative decay-based mechanisms, which can then be used to prune KV-cache during inference. However, these decay functions have limited expressivity, and in practice devolve into sliding-window-like eviction patterns. In this work, we propose a unifying framework for complementary and novel decay mechanisms, capturing complex key statistics and interactions while preserving expressive RoPE embeddings and Softmax attention. The resulting Universal Attention is a highly expressive and end-to-end trainable architecture, whose composite decay mechanism acts as a natural, adaptive pruning criterion, removing tokens that contribute least to attention computation. Experimentally, Universal Attention achieves state-of-the-art 10 times compression on natural language and synthetic task data, while improving downstream performance compared to both state-of-the-art baselines and unpruned oracles. It further demonstrates superior long-context generalization with unprecedented 25 times compression at length 16k.
Sources
- Longformer: The Long-Document Transformer
- Training Deep Nets with Sublinear Memory Cost
- Generating Long Sequences with Sparse Transformers
- Think you have Solved Question Answering? Try ARC, the AI2 Reasoning Challenge
- FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning
- Expected Attention: KV Cache Compression by Estimating Attention from Future Queries Distribution
- Sparse GPU Kernels for Deep Learning
- CAOTE: KV Cache Selection for LLMs via Attention Output Error-Based Token Eviction
- The Llama 3 Herd of Models
- Mamba: Linear-Time Sequence Modeling with Selective State Spaces
- RULER: What's the Real Context Size of Your Long-Context Language Models?
- Mistral 7B
- SnapKV: LLM Knows What You are Looking for Before Generation
- Jamba: A Hybrid Transformer-Mamba Language Model
- AsyncSparse: Accelerating Sparse Matrix-Matrix Multiplication on Asynchronous GPU Architectures
- Nemotron-H: A Family of Accurate and Efficient Hybrid Mamba-Transformer Models
- KeyDiff: Key Similarity-Based KV Cache Eviction for Long-Context LLM Inference in Resource-Constrained Environments
- Gated Attention for Large Language Models: Non-linearity, Sparsity, and Attention-Sink-Free
- WinoGrande: An Adversarial Winograd Schema Challenge at Scale
- FlashAttention-3: Fast and Accurate Attention with Asynchrony and Low-precision
Related papers
- Polynomial-Augmented Neural Networks (PANNs) with Weak Orthogonality Constraints for Enhanced Function and PDE Approximation
- AIRL-S: Unifying Reinforcement Learning and Search-Based Test-Time Scaling via Adversarial Inverse Reinforcement Learning
- Transformers as Bayesian In-Context Experimenters: Smoothness-Adaptive Efficient ATE Estimation
- Convergence issues in Relational Concept Analysis based on AOC-posets
- Beliefs Beyond Posteriors: The Predictive Cost of ELBO Binding
- Understanding Diffusion Models via Ratio-Based Function Approximation with SignReLU Networks