Lune

AAAI2025Top-tier venue

Leveraging Attention to Effectively Compress Prompts for Long-Context LLMs

Yunlong Zhao, Haoran Wu, Bo Xu

Abstract

Prompt compression is increasingly studied for its potential to reduce computational costs and alleviate the burden on language models when processing lengthy prompts. Prior research has assessed token retention and removal by calculating information entropy. However, prompt compression encounters two significant challenges: (1) Information entropy, while widely used, may not be the optimal compression metric; and (2) The semantic significance of tokens is context-dependent, which renders independent token retention decisions inadequate.

We posit that the solution to these challenges lies in the intrinsic mechanism of language models. Large language models (LLMs) exhibit robust contextual processing capabilities, with recent studies on their internal dynamics revealing that the attention mechanism plays a crucial role in modeling how LLMs leverage long contexts. Building on this insight, we introduce AttnComp, a novel approach that exploits the attention mechanism within language models to guide prompt compression. Our method employs causal cross-attention from the query to the context to evaluate the significance of each token, and we develop a graph-based algorithm to efficiently cluster tokens into semantic units, thus mitigating the issue of independent dependencies.

We conduct experiments on datasets for retrieval-augmented generation and multiple long tasks involving single or multi-document QA. Our proposed method, AttnComp, outperforms previous baselines and validates the contributions of our components through analytical experiments. Compared to other methods that use a causal LM for prompt compression, our approach results in shorter latency and improved performance.

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.

5 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

  • GMSA: Enhancing Context Compression via Group Merging and Layer Semantic Alignment cites Learning to Compress Prompts with Gist Tokens
  • GMSA: Enhancing Context Compression via Group Merging and Layer Semantic Alignment cites RECOMP: Improving Retrieval-Augmented LMs with Context Compression and Selective Augmentation
  • RECOMP: Improving Retrieval-Augmented LMs with Context Compression and Selective Augmentation cites Learning to Compress Prompts with Gist Tokens
  • RECOMP: Improving Retrieval-Augmented LMs with Context Compression and Selective Augmentation cites Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks
  • COMI: Coarse-to-fine Context Compression via Marginal Information Gain cites Learning to Compress Prompts with Gist Tokens
  • COMI: Coarse-to-fine Context Compression via Marginal Information Gain cites GMSA: Enhancing Context Compression via Group Merging and Layer Semantic Alignment
  • COMI: Coarse-to-fine Context Compression via Marginal Information Gain cites RECOMP: Improving Retrieval-Augmented LMs with Context Compression and Selective Augmentation
  • COMI: Coarse-to-fine Context Compression via Marginal Information Gain cites Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers5

  1. GMSA: Enhancing Context Compression via Group Merging and Layer Semantic AlignmentJiwei Tang, Zhicheng Zhang, Shunlong Wu, Jingheng Ye et al.ACL 2026 · 24 citations
  2. COMI: Coarse-to-fine Context Compression via Marginal Information GainJiwei Tang, Shilei Liu, Zhicheng Zhang, Yujin Yuan et al.ICLR 2026 · 17 citations
  3. Revitalizing Black-Box Interpretability: Actionable Interpretability for LLMs via Proxy ModelsJunhao Liu, Haonan Yu, Zhenyu Yan, Xin ZhangACL 2026 · 2 citations
  4. HiGoE: Hierarchical Graph of Evidence to Enhance Retrieval-Augmented Generation for Long-context SummarizationLong Yuan, Kaiwen Tian, Zi Chen, Bolong Zheng et al.ACL 2026
  5. CGMIS: Concept-Graph Based Multi-Hop Instructions Synthesis for Enhancing Long-Context ReasoningZechen Sun, Zecheng Tang, Juntao Li, Wenpeng Hu et al.AAAI 2026

Builds on22

  1. Retrieval-Augmented Generation for Knowledge-Intensive NLP TasksPatrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni et al.NeurIPS 2020 · 19,162 citations
  2. Generative Agents: Interactive Simulacra of Human BehaviorJoon Sung Park, Joseph C. O'Brien, Carrie Jun Cai, Meredith Ringel Morris et al.UIST 2023 · 1,882 citations
  3. Learning to Compress Prompts with Gist TokensJesse Mu, Xiang Li, Noah D. GoodmanNeurIPS 2023 · 488 citations
  4. A Survey on In-context LearningQingxiu Dong, Lei Li, Damai Dai, Ce Zheng et al.EMNLP 2024 · 479 citations
  5. RECOMP: Improving Retrieval-Augmented LMs with Context Compression and Selective AugmentationFangyuan Xu, Weijia Shi, Eunsol ChoiICLR 2024 · 260 citations

Related papers

  1. DAC: A Dynamic Attention-aware Approach for Task-Agnostic Prompt CompressionYi Zhao, Zuchao Li, Hai Zhao, Baoyuan Qi et al.ACL 2025 · 7 citations
  2. TACO-RL: Task Aware Prompt Compression Optimization with Reinforcement LearningShivam Shandilya, Menglin Xia, Supriyo Ghosh, Huiqiang Jiang et al.ACL Findings 2025 · 9 citations
  3. AttnComp: Attention-Guided Adaptive Context Compression for Retrieval-Augmented GenerationLvzhou Luo, Yixuan Cao, Ping LuoEMNLP Findings 2025 · 2 citations
  4. LLMLingua-2: Data Distillation for Efficient and Faithful Task-Agnostic Prompt CompressionZhuoshi Pan, Qianhui Wu, Huiqiang Jiang, Menglin Xia et al.ACL Findings 2024 · 58 citations
  5. Prompt Compression with Context-Aware Sentence Encoding for Fast and Improved LLM InferenceBarys Liskavets, Maxim Ushakov, Shuvendu Roy, Mark Klibanov et al.AAAI 2025 · 41 citations
Dusk over the sea between two cliffs drawn in fine vertical lines