Top-Theta Attention: Sparsifying Transformers by Compensated Thresholding

Konstantin Berestizshevsky, Renzo Andri, Lukas Cavigelli
2/12/2025
cs.CLcs.AI

No official code found. Best implementation: kostyanoob/top-theta-attention (5 stars, last commit 2025-05-22).

Abstract

We present Top-Theta (Top-$θ$) Attention, a training-free method for sparsifying transformer attention during inference. Our key insight is that static, per-head thresholds can be calibrated to retain the desired constant number of significant elements per attention row. This approach enables content-based sparsity without retraining, and it remains robust across data domains. We further introduce compensation techniques to preserve accuracy under aggressive sparsification, establishing attention thresholding as a practical and principled alternative to top-k attention. We provide extensive evaluation on natural language processing tasks, showing that Top-$θ$ achieves 3-10x reduction in V-cache usage and up to 10x fewer attention elements during inference while degrading no more than 1% in accuracy.

View on arXivView PDF

Code Implementations(1)

Implementation of Top-Theta Attention for efficient LLM Inference

51Shell, PythonFeb 12, 20251 years ago
aiattentionkv-cachesparsitytransformer-decoder-model

Cite this paper

@article{berestizshevsky2025toptheta,
  title  = {Top-Theta Attention: Sparsifying Transformers by Compensated Thresholding},
  author = {Konstantin Berestizshevsky and Renzo Andri and Lukas Cavigelli},
  year   = {2025},
  eprint = {2502.08363},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2502.08363v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2502.08363.svg)](https://codeofpaper.com/paper/2502.08363)

Discussion