Efficient Long Context Language Model Retrieval with Compression

Minju Seo, Jinheon Baek, Seongyun Lee, Sung Ju Hwang

Abstract

Long Context Language Models (LCLMs) have revolutionized information retrieval by enabling "in-context retrieval" across entire document corpora. However, the computational cost of processing massive token counts and the "lost-in-the-middle" phenomenon—where models struggle to identify relevant information buried in long prompts—remain significant hurdles. This paper introduces CoLoR (Compression for Long context Retrieval), a novel abstractive compression method designed specifically for retrieval tasks. By utilizing preference optimization with length regularization, CoLoR reduces input sizes by nearly 50% while simultaneously improving retrieval accuracy by 6% on average. Our results across nine diverse datasets demonstrate that CoLoR effectively filters irrelevant noise, enhances fact density, and mitigates architectural weaknesses in current LCLMs.

Introduction

The advent of Long Context Language Models (LCLMs) like GPT-4 and Gemini has shifted the paradigm of Information Retrieval (IR). Traditional Retrieval-Augmented Generation (RAG) systems typically retrieve a small subset of relevant snippets to present to a model. In contrast, LCLMs can ingest an entire corpus in a single prompt, allowing for more holistic reasoning and higher accuracy.

Despite these advantages, LCLMs face two primary challenges: computational overhead and the "lost-in-the-middle" effect. Processing hundreds of thousands of tokens is both slow and expensive. Furthermore, as context length increases, models often fail to retrieve information located in the center of the prompt. While text compression methods exist, they are often optimized for summarization rather than retrieval, potentially discarding the fine-grained details necessary for distinguishing between similar documents.

Comparison of retrieval methods: Dense Retrieval, standard LCLM Retrieval, and LCLM Retrieval with CoLoR.

The CoLoR Framework

To address these issues, we propose CoLoR, an abstractive compression model trained to preserve retrieval-critical information while maximizing brevity. Unlike standard summarization, which focuses on narrative coherence, retrieval-oriented compression prioritizes distinctiveness—retaining the specific keywords and facts that make a document unique relative to a potential query.

Methodology

The development of CoLoR involves a three-stage pipeline:

  1. Synthetic Data Generation: Multiple Large Language Models (LLMs) are employed to generate various compressed versions of raw passages.
  2. Preference Labeling: These compressed versions are evaluated against an LCLM. A version is labeled "chosen" if it leads to successful retrieval and is shorter than other successful candidates. Conversely, versions that lead to retrieval failure are "rejected."
  3. ORPO with Length Regularization: The model is trained using Odds Ratio Preference Optimization (ORPO). A dynamic length regularization term is added to the loss function to incentivize the model to prefer shorter outputs when multiple versions are equally effective.

We utilized the Phi-3-mini-4k-instruct model as the base for our compressor to ensure that the compression step itself remains computationally lightweight.

Experimental Evaluation

We evaluated CoLoR across nine diverse datasets categorized into single-document retrieval (e.g., FEVER, MS MARCO, SciFact) and multi-document retrieval (e.g., HotpotQA, MuSiQue). These tasks require the model to find either a single "needle" or synthesize information across multiple documents within a large "haystack."

Key Results

CoLoR consistently outperformed baseline methods across all metrics. On average, it improved retrieval performance by 6% compared to using raw, uncompressed passages. Simultaneously, it achieved a compression factor of 1.91x, effectively halving the number of tokens the LCLM needed to process.

Retrieval performance vs. compression rate across various methods. CoLoR achieves the best balance of high performance and significant compression.

As shown in the figure above, CoLoR occupies the top-left quadrant of the performance-compression trade-off, outperforming both extractive methods (like LLMLingua) and other abstractive methods (like RECOMP and COMPACT).

Analysis and Insights

Our analysis reveals several reasons for CoLoR's success:

  • Fact Density: Manual evaluation indicates that while CoLoR reduces the total number of facts, it significantly increases the density of query-supportive facts. It acts as a high-pass filter for signal over noise.
  • Mitigating "Lost-in-the-Middle": By reducing the total input length, CoLoR physically moves information originally in the "middle" closer to the query and the prompt boundaries, bypassing the architectural limitations of current LCLMs.
  • Generalization: CoLoR demonstrated strong performance on out-of-domain datasets, suggesting it has learned a generalizable strategy for identifying retrievable information.

Conclusion

CoLoR presents a significant step forward in making long-context retrieval both more efficient and more accurate. By shrinking the "haystack" through specialized compression, we can leverage the full power of LCLMs without the prohibitive costs or performance degradation associated with massive context windows. Future work will explore scaling these benefits to even larger context windows (1M+ tokens) and further optimizing the inference latency of the compression model itself.

Summary updated

BibTeX
@inproceedings{seo2025efficient,
  author = {Minju Seo and Jinheon Baek and Seongyun Lee and Sung Ju Hwang},
  title = {{Efficient Long Context Language Model Retrieval with Compression}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure