Lune

NeurIPS2023Top-tier venue

Dynamic Context Pruning for Efficient and Interpretable Autoregressive Transformers

Sotiris Anagnostidis, Dario Pavllo, Luca Biggio, Lorenzo Noci, Aurélien Lucchi, Thomas Hofmann

Abstract

Autoregressive Transformers adopted in Large Language Models (LLMs) are hard to scale to long sequences. Despite several works trying to reduce their computational cost, most of LLMs still adopt attention layers between all pairs of tokens in the sequence, thus incurring a quadratic cost. In this study, we present a novel approach that dynamically prunes contextual information while preserving the model's expressiveness, resulting in reduced memory and computational requirements during inference. Our method employs a learnable mechanism that determines which uninformative tokens can be dropped from the context at any point across the generation process. By doing so, our approach not only addresses performance concerns but also enhances interpretability, providing valuable insight into the model's decision-making process. Our technique can be applied to existing pre-trained models through a straightforward fine-tuning process, and the pruning strength can be specified by a sparsity parameter. Notably, our empirical findings demonstrate that we can effectively prune up to 80% of the context without significant performance degradation on downstream tasks, offering a valuable tool for mitigating inference costs. Our reference implementation achieves up to 2×2\times increase in inference throughput and even greater memory savings.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

30 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Efficient Streaming Language Models with Attention Sinks cites PIQA: Reasoning about Physical Commonsense in Natural Language
  • Efficient Streaming Language Models with Attention Sinks cites Big Bird: Transformers for Longer Sequences
  • Efficient Streaming Language Models with Attention Sinks cites FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
  • Efficient Streaming Language Models with Attention Sinks cites H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models
  • H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models cites Efficient Streaming Language Models with Attention Sinks
  • Efficient Streaming Language Models with Attention Sinks cites WinoGrande: An Adversarial Winograd Schema Challenge at Scale
  • PIQA: Reasoning about Physical Commonsense in Natural Language cites WinoGrande: An Adversarial Winograd Schema Challenge at Scale
  • FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness cites Big Bird: Transformers for Longer Sequences
  • H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models cites PIQA: Reasoning about Physical Commonsense in Natural Language
  • H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models cites FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
  • H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models cites WinoGrande: An Adversarial Winograd Schema Challenge at Scale
  • Neural Attention Search cites Efficient Streaming Language Models with Attention Sinks
  • Neural Attention Search cites FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
  • Neural Attention Search cites H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models
  • Neural Attention Search cites Dynamic Memory Compression: Retrofitting LLMs for Accelerated Inference
  • Neural Attention Search cites MInference 1.0: Accelerating Pre-filling for Long-Context LLMs via Dynamic Sparse Attention
  • Dynamic Memory Compression: Retrofitting LLMs for Accelerated Inference cites PIQA: Reasoning about Physical Commonsense in Natural Language
  • Dynamic Memory Compression: Retrofitting LLMs for Accelerated Inference cites FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
  • Dynamic Memory Compression: Retrofitting LLMs for Accelerated Inference cites H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models
  • Dynamic Memory Compression: Retrofitting LLMs for Accelerated Inference cites WinoGrande: An Adversarial Winograd Schema Challenge at Scale
  • MInference 1.0: Accelerating Pre-filling for Long-Context LLMs via Dynamic Sparse Attention cites Efficient Streaming Language Models with Attention Sinks
  • MInference 1.0: Accelerating Pre-filling for Long-Context LLMs via Dynamic Sparse Attention cites Big Bird: Transformers for Longer Sequences
  • MInference 1.0: Accelerating Pre-filling for Long-Context LLMs via Dynamic Sparse Attention cites Dynamic Memory Compression: Retrofitting LLMs for Accelerated Inference
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers30

  1. Efficient Streaming Language Models with Attention SinksGuangxuan Xiao, Yuandong Tian, Beidi Chen, Song Han et al.ICLR 2024 · 1,714 citations
  2. H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language ModelsZhenyu Zhang, Ying Sheng, Tianyi Zhou, Tianlong Chen et al.NeurIPS 2023 · 1,003 citations
  3. MInference 1.0: Accelerating Pre-filling for Long-Context LLMs via Dynamic Sparse AttentionHuiqiang Jiang, Yucheng Li, Chengruidong Zhang, Qianhui Wu et al.NeurIPS 2024 · 479 citations
  4. Neural Attention SearchDifan Deng, Marius LindauerNeurIPS 2025 · 431 citations
  5. Dynamic Memory Compression: Retrofitting LLMs for Accelerated InferencePiotr Nawrot, Adrian Lancucki, Marcin Chochowski, David Tarjan et al.ICML 2024 · 106 citations

Builds on25

  1. Training language models to follow instructions with human feedbackLong Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida et al.NeurIPS 2022 · 24,707 citations
  2. FlashAttention: Fast and Memory-Efficient Exact Attention with IO-AwarenessTri Dao, Daniel Y. Fu, Stefano Ermon, Atri Rudra et al.NeurIPS 2022 · 5,493 citations
  3. Big Bird: Transformers for Longer SequencesManzil Zaheer, Guru Guruganesh, Kumar Avinava Dubey, Joshua Ainslie et al.NeurIPS 2020 · 3,159 citations
  4. WinoGrande: An Adversarial Winograd Schema Challenge at ScaleKeisuke Sakaguchi, Ronan Le Bras, Chandra Bhagavatula, Yejin ChoiAAAI 2020 · 3,037 citations
  5. PIQA: Reasoning about Physical Commonsense in Natural LanguageYonatan Bisk, Rowan Zellers, Ronan Le Bras, Jianfeng Gao et al.AAAI 2020 · 2,916 citations

Related papers

  1. Learned Token Pruning for TransformersSehoon Kim, Sheng Shen, David Thorsley, Amir Gholami et al.KDD 2022 · 97 citations
  2. SlimInfer: Accelerating Long-Context LLM Inference via Dynamic Token PruningLingkun Long, Rubing Yang, Yushi Huang, Desheng Hui et al.AAAI 2026 · 8 citations
  3. Compressing Context to Enhance Inference Efficiency of Large Language ModelsYucheng Li, Bo Dong, Frank Guerin, Chenghua LinEMNLP 2023 · 54 citations
  4. Token Sparse Attention: Efficient Long-Context Inference with Interleaved Token SelectionDongwon Jo, Beomseok Kang, Jiwon Song, jae-joon kimICML 2026 · 1 citation
  5. Selective Attention Improves TransformerYaniv Leviathan, Matan Kalman, Yossi MatiasICLR 2025
Dusk over the sea between two cliffs drawn in fine vertical lines