paper-with-me

홈 › Papers

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

2024-09-02 · Barys Liskavets, Maxim Ushakov, Shuvendu Roy, Mark Klibanov, Ali Etemad, Shane Luke

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 sentence-level 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.93x 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.

📄 PDF Abstract BibTeX arXiv:2409.01227

Code (1)

workday/cpc 공식 구현 pytorch

Tasks

Computational EfficiencySentence

Similar Papers 제목 키워드 기반

SALT: Salience-Aware Lexical Trie for Long-Context Compression

2026-07-20 · Oteo Mamo, Hyunjin Yi, Joydhriti Choudhury, Shangqian Gao 외 arxiv

As large language models (LLMs) process increasingly longer prompts, computation and KV-cache memory costs have emerged as major bottlenecks in inference systems. Existing input-level prompt compression methods address t…

Task-agnostic Prompt Compression with Context-aware Sentence Embedding and Reward-guided Task Descriptor

2025-02-19 · Barys Liskavets, Shuvendu Roy, Maxim Ushakov, Mark Klibanov 외

The rise of Large Language Models (LLMs) has led to significant interest in prompt compression, a technique aimed at reducing the length of input prompts while preserving critical information. However, the prominent appr…

SentenceSentence EmbeddingSentence-Embedding

Lossless Prompt Compression via Dictionary-Encoding and In-Context Learning: Enabling Cost-Effective LLM Analysis of Repetitive Data

2026-03-19 · Andresa Rodrigues de Campos, David Lee, Imry Kissos, Piyush Paritosh arxiv

In-context learning has established itself as an important learning paradigm for Large Language Models (LLMs). In this paper, we demonstrate that LLMs can learn encoding keys in-context and perform analysis directly on e…

Encoding Sentence Position in Context-Aware Neural Machine Translation with Concatenation

2023-02-13 · Lorenzo Lupo, Marco Dinarelli, Laurent Besacier

Context-aware translation can be achieved by processing a concatenation of consecutive sentences with the standard Transformer architecture. This paper investigates the intuitive idea of providing the model with explicit…

Machine TranslationPositionSentenceTranslation

BEAVER: A Training-Free Hierarchical Prompt Compression Method via Structure-Aware Page Selection

2026-03-20 · Zhengpei Hu, Kai Li, Dapeng Fu, Chang Zeng 외 arxiv

The exponential expansion of context windows in LLMs has unlocked capabilities for long-document understanding but introduced severe bottlenecks in inference latency and information utilization. Existing compression meth…