TL;DR
Context compression speeds up Large Language Model (LLM) inference but often causes unpredictable drops in accuracy. This paper introduces Performance-oriented Context Compression (PoC), a new paradigm where users specify a minimum performance floor instead of a rigid compression ratio. By using a lightweight, context-aware performance predictor, PoC dynamically finds the most aggressive compression ratio for each unique input, maintaining accuracy while maximizing efficiency.
What Problem Does This Paper Address?
As LLMs are increasingly deployed for long-context tasks like document question-answering and summarization, the computational overhead and inference latency have skyrocketed. Context compression techniques help mitigate this by shortening the input text before feeding it to the LLM.
However, traditional approaches rely on Budget-oriented Context Compression (BoC), where developers must pre-specify a fixed compression ratio or token length. The core flaw here is that the relationship between compression and task performance is highly input-dependent. A simple, repetitive prompt can be compressed heavily with zero quality loss, whereas an information-dense prompt might suffer catastrophic failure under the same compression budget. This unpredictability creates a deployment dilemma: set a conservative budget and waste efficiency, or set an aggressive budget and risk unacceptable performance drops.
Methods
PoC flips the script by shifting control from a token "budget" to a "task performance floor" (e.g., "ensure the model retains at least 95% of its uncompressed accuracy").
The PoC pipeline operates in three main stages:
- Performance Prediction: A lightweight, context-aware predictor estimates the performance-compression curve for a given input context. The authors build this predictor by taking a small language model (Llama-3.2-1B-Instruct) and heavily pruning it down to just its embedding layer and its first two Transformer layers. This architecture allows it to predict performance retentions across multiple candidate ratios simultaneously in a single forward pass.
- Two-Stage Search Algorithm: To find the optimal compression ratio ($r^*$) with minimal overhead, PoC uses a coarse-grained search (sampling 18 ratios uniformly across the $[0, 1]$ interval) followed by a fine-grained search within the best identified sub-interval.
- Context Compression: The selected optimal ratio is passed to an off-the-shelf hard compressor (LLMLingua2), which filters the tokens before sending the streamlined text to the reader LLM (Llama-3.1-8B-Instruct).
Datasets
The authors evaluated PoC across seven standard benchmarks featuring context lengths up to 32,768 tokens:
- Question Answering (QA): SearchQA, TriviaQA, Natural Questions, HotpotQA, and SQuAD (evaluated using F1 scores to capture partial overlaps).
- Summarization: GovReport and SummScreenFD (evaluated using the geometric mean of ROUGE-1, ROUGE-2, and ROUGE-L scores).
Key Insights and Ideas
- The "Cliff-Like" Behavior of QA: In question-answering tasks, individual sample performance doesn't degrade linearly. Instead, it exhibits a "cliff" effect: performance remains perfect until a critical piece of information is compressed away, at which point accuracy plummets to zero. Context-aware predictors are vital because they can sense these fragile, information-dense contexts, whereas context-agnostic baselines are blind to them.
- Compression as a Denoiser: On the TriviaQA dataset, the average performance actually peaked at a compression ratio of ~0.435, outperforming the uncompressed text. This reveals that context compression can act as a beneficial denoising mechanism, stripping away low-density background noise so the LLM can focus purely on relevant facts.
- Graceful Degradation in Summarization: Unlike QA, summarization tasks degrade smoothly as text is removed because summarization requires a holistic understanding of the entire document. This smoother relationship makes the performance-compression curve inherently easier to model and predict.
Key Results
- Reduced Prediction Error: The context-aware predictor consistently achieved lower Performance Prediction Error (PPE) than the baseline, showing a 12.8% error reduction on SearchQA and a 33.9% reduction on SummScreenFD.
- Superior Performance-at-Ratio (P@R): On TriviaQA, the context-aware approach dramatically boosted overall performance, raising the F1@R score from 49.2 to 67.5.
- Negligible Overhead vs. Massive Speedup: The performance predictor adds a fixed latency of just 1.53 ms per 512-token chunk. Combined with the compressor, the total framework overhead is roughly 29 ms per chunk. However, for a 32,768-token context compressed to a 0.2 ratio, the reader LLM's latency drops from 5282 ms to 365 ms—a massive 14.5x speedup that completely eclipses the minor prediction overhead.
Limitations and Future Work
The primary limitation of the PoC framework is that it functions as a meta-framework; its ultimate performance ceiling is strictly bound by the capabilities of the underlying off-the-shelf compressor (in this case, LLMLingua2). While PoC optimizes how much to compress based on performance constraints, it cannot improve how well the compressor selects which specific tokens to keep. The authors note that future work could involve adapting this paradigm to soft compression methods or end-to-end trainable compression frameworks.
Summary updated