TL;DR
COMI (Coarse-to-fine Context Compression) is a novel framework designed to slash the length of long Large Language Model (LLM) inputs by up to 32x while simultaneously improving performance. By introducing a metric called Marginal Information Gain (MIG), COMI ensures that the compressed context is not only relevant to the user's query but also diverse. This effectively eliminates the "relevant but redundant" fluff that often degrades the performance of standard models in long-context scenarios.
The Challenge of Long Contexts
As we push LLMs to handle increasingly longer documents—often through techniques like Retrieval-Augmented Generation (RAG)—we encounter two major roadblocks:
- Computational Cost: The "quadratic bottleneck" inherent in standard attention mechanisms makes processing massive contexts prohibitively slow and expensive.
- Information Redundancy: Providing more data doesn't always yield better answers. Often, an extended context contains multiple segments that are highly relevant to a query but essentially repeat the exact same information.
Existing compression methods typically fall into two categories: task-agnostic approaches (which might accidentally delete the answer because they don't factor in the specific question) and task-aware approaches (which retain everything deemed "relevant"). The authors of COMI argue that optimizing solely for "relevance" is insufficient. If a model retains ten sentences that all convey the same fact, the compression budget is wasted. COMI's primary goal is to maximize information diversity alongside relevance.
The COMI Approach: Marginal Information Gain
To solve the redundancy problem, the researchers introduce a two-stage, "coarse-to-fine" approach guided by a new metric: Marginal Information Gain (MIG).
Understanding MIG
MIG is calculated simply as: Relevance (to the query) minus Redundancy (with other units). This formula forces the system to prioritize genuinely "new" information. If a piece of text is highly relevant but semantically identical to a segment we've already selected, its MIG score drops, preventing it from consuming valuable token space.
The Two-Stage Framework
- Coarse-Grained Group Reallocation: First, the input context is partitioned into segments or groups. Instead of applying a uniform compression rate across the board, COMI calculates the inter-group MIG. High-value segments (those with high MIG) are dynamically granted a larger "token budget," while redundant or irrelevant sections are compressed much more aggressively.
- Fine-Grained Token Merging: Within each allocated segment, individual tokens are weighted by their intra-group MIG scores. These tokens are then fused into a single representative vector using a soft-merging mechanism. This ensures the most informative "essence" of the segment is preserved without accumulating redundant tokens.
To support this, the system utilizes an encoder-decoder architecture equipped with Layer Semantic Alignment (LSA). LSA helps the model bridge the semantic gap between the original raw text and the newly generated, dense compressed representations.
Datasets and Evaluation
The authors rigorously tested COMI across a variety of long-context benchmarks:
- Question Answering: NaturalQuestions (single-hop), HotpotQA, and 2WikiMQA (multi-hop).
- Long-form QA: NarrativeQA (evaluating contexts up to 64K tokens, akin to full books or movie scripts).
- Summarization: MultiNews.
- Model Backbones: The framework was evaluated using LLaMA-2-7B, Qwen2-7B, and Qwen3-4B-Instruct.
Key Insights
- The "Relevant but Redundant" Trap: The paper highlights a critical flaw in standard retrieval: top query-related tokens are often 60%–90% similar to each other. Retaining all of them wastes context space. MIG acts as a necessary "diminishing returns" filter.
- Dynamic Budgeting is Essential: Uniform compression is inherently inefficient. By dynamically reallocating the compression budget in Stage 1, COMI spends its computational "bits" precisely where the information density is highest.
- Compression as a Performance Booster: Counterintuitively, at high compression rates (e.g., 32x), COMI frequently outperforms the "Original Prompt" (no compression). This suggests that by actively filtering out noise and redundancy, the compression process actually makes it easier for the LLM to locate the correct answer.
Key Results
- Massive Accuracy Gains: Under a strict 32x compression constraint on the NaturalQuestions dataset, COMI improved the Exact Match (EM) score by an impressive 25 points over the next best baseline (using Qwen2-7B).
- Efficiency: COMI achieved over a 2x end-to-end speedup compared to processing the original, uncompressed prompt.
- Scalability: While many models degrade as context length grows, COMI maintained robust performance on NarrativeQA with 64K token contexts, effectively doubling the F1 score of the original uncompressed prompt (22.79 vs 10.69).
- Robustness: The framework consistently outperformed specialized KV-cache compression methods (like SnapKV) and other soft-prompt techniques (like ICAE or GMSA).
Limitations and Future Work
- Training Overhead: Unlike "training-free" compression methods, COMI requires a single training run to fine-tune the encoder and alignment layers for a specific LLM backbone.
- Architecture Specificity: The current implementation relies on an encoder-decoder setup. Adapting this methodology to pure decoder-only architectures (without a separate encoder) represents a key area for future research.
- Fixed Grouping: The initial partitioning of text into equal-length groups is a heuristic approach. Future iterations might benefit from more semantic-aware chunking (e.g., splitting by paragraph or sentence boundaries) prior to reallocation.
Summary updated