Lune

AAAI2025Top-tier venue

Prompt Compression with Context-Aware Sentence Encoding for Fast and Improved LLM Inference

Barys Liskavets, Maxim Ushakov, Shuvendu Roy, Mark Klibanov, Ali Etemad, Shane K. Luke

Abstract

Large language models (LLMs) have triggered a new stream of research focusing on compressing the context length to reduce the computational cost while ensuring the retention of helpful information for LLMs to answer the given question. Token-based removal methods are one of the most prominent approaches in this direction, but risk losing the semantics of the context caused by intermediate token removal, especially under high compression ratios, while also facing challenges in computational efficiency. In this work, we propose context-aware prompt compression (CPC), a sentencelevel prompt compression technique where its key innovation is a novel context-aware sentence encoder that provides a relevance score for each sentence for a given question. To train this encoder, we generate a new dataset consisting of questions, positives, and negative pairs where positives are sentences relevant to the question, while negatives are irrelevant context sentences. We train the encoder in a contrastive setup to learn context-aware sentence representations. Our method considerably outperforms prior works on prompt compression on benchmark datasets and is up to 10.93× faster at inference compared to the best token-level compression method. We also find better improvement for shorter length constraints in most benchmarks, showing the effectiveness of our proposed solution in the compression of relevant information in a shorter context. Finally, we release the code and the dataset for quick reproducibility and further development: https://github.com/Workday/cpc .

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.

14 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

  • Read As Human: Compressing Context via Parallelizable Close Reading and Skimming cites RECOMP: Improving Retrieval-Augmented LMs with Context Compression and Selective Augmentation
  • Read As Human: Compressing Context via Parallelizable Close Reading and Skimming cites Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks
  • RECOMP: Improving Retrieval-Augmented LMs with Context Compression and Selective Augmentation cites Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks
  • A Survey on In-context Learning cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • What Makes a Good Natural Language Prompt? cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • LightMem: Lightweight and Efficient Memory-Augmented Generation cites Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks
  • 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 papers14

  1. LightMem: Lightweight and Efficient Memory-Augmented GenerationJizhan Fang, Xinle Deng, Haoming Xu, Ziyan Jiang et al.ICLR 2026 · 162 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. Efficient Prompt Compression with Evaluator Heads for Long-Context Transformer InferenceWeizhi Fei, Xueyan Niu, Guoqing Xie, Yingqing Liu et al.NeurIPS 2025 · 14 citations
  4. What Makes a Good Natural Language Prompt?Do Xuan Long, Duy Dinh, Ngoc-Hai Nguyen, Kenji Kawaguchi et al.ACL 2025 · 13 citations
  5. Read As Human: Compressing Context via Parallelizable Close Reading and SkimmingJiwei Tang, Shilei Liu, Zhicheng Zhang, Qingsong Lv et al.ACL 2026 · 10 citations

Builds on17

  1. Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma et al.NeurIPS 2022 · 22,562 citations
  2. Retrieval-Augmented Generation for Knowledge-Intensive NLP TasksPatrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni et al.NeurIPS 2020 · 19,162 citations
  3. LoRA: Low-Rank Adaptation of Large Language ModelsEdward J. Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu et al.ICLR 2022 · 18,833 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. Leveraging Attention to Effectively Compress Prompts for Long-Context LLMsYunlong Zhao, Haoran Wu, Bo XuAAAI 2025 · 10 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. GMSA: Enhancing Context Compression via Group Merging and Layer Semantic AlignmentJiwei Tang, Zhicheng Zhang, Shunlong Wu, Jingheng Ye et al.ACL 2026 · 24 citations
  4. 500xCompressor: Generalized Prompt Compression for Large Language ModelsZongqian Li, Yixuan Su, Nigel CollierACL 2025 · 35 citations
  5. From Reading to Compressing: Exploring the Multi-document Reader for Prompt CompressionEunseong Choi, Sunkyung Lee, Minjin Choi, June Park et al.EMNLP Findings 2024
Dusk over the sea between two cliffs drawn in fine vertical lines