Manuscript Offprint

arXiv:2609.05152

Compression Beyond the Uncompressed: A Two-Stage Training Recipe for Soft Context Compression in RAG

Shuyu Guo, Shuo Zhang, Zhaochun Ren

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Retrieval-Augmented Generation (RAG) enhances language models with external knowledge, but the lengthy retrieved context inflates the input and degrades inference efficiency. Soft context compression encodes each document into a substantially shorter embedding sequence. However, most existing approaches are trained by distilling outputs from uncompressed RAG systems, inherently limiting their performance relative to the original model. To address this limitation, we propose DEX-Comp, a two-stage training recipe: Pure Distillation warm-starts the compression model on the uncompressed RAG's correct responses only, and Hard Exploration then runs reinforcement learning solely on queries the uncompressed RAG fails, forcing the model to explore computation patterns better suited to compressed representations. On five open-domain QA benchmarks at retrieval depths from top-5 to top-30, DEX-Comp compresses retrieved contexts by 16× and accelerates inference by 4×–24×, while achieving performance comparable to or exceeding the uncompressed RAG baseline across retrieval depths. Ablations and evaluations across diverse datasets and backbones further confirm the contribution of each stage and the generalization of our approach.

1 Introduction

Retrieval-Augmented Generation (RAG) equips parametric language models with a non-parametric datastore, granting access to up-to-date and long-tail knowledge. By retrieving and prepending relevant documents to the user query, RAG has become a default recipe for knowledge-intensive tasks such as open-domain question answering, fact verification, and domain-specific reasoning [1]. However, this convenience comes at a price. The retrieved context inflates the input length, significantly increasing inference latency [2]. It can also exceed the context window of the underlying LLM.

Context compression is a promising remedy that shortens the retrieved context while preserving the information the LLM needs. Existing methods fall into two families. Hard compression operates at the token level, extracting salient spans [3] or summarizing each document into shorter text [4]. Soft compression goes one step further by encoding each document into a much shorter sequence of continuous embeddings [5]. Freed from discrete tokens, continuous embeddings carry higher representational capacity and often achieve stronger performance than hard compression in prior work [6]. However, existing soft compression methods are typically trained by distilling responses from an uncompressed RAG model and are therefore implicitly bounded by its behavior [6, 7]. Although

*Corresponding Author.

Preprint.

recent studies suggest that continuous embeddings can encode substantially more information per slot than discrete tokens [8], the empirical gap between soft compression models and their uncompressed counterparts remains non-trivial in practice [9].

We identify that this gap is partly due to the way soft compression models are trained. Distilling the uncompressed model's responses anchors the compression model to a computation pattern shaped by reading discrete tokens, even though its own input is a much shorter, denser embedding sequence (i.e., the model may inherit token-level reasoning behaviors that are suboptimal for compressed representations). Built on this insight, we propose DEX-Comp (Distillation and Exploration for soft Compression), a two-stage training recipe. Stage I, Pure Distillation, warm-starts the compression model by imitating only the uncompressed model's correct responses, in contrast to standard knowledge distillation, which learns from all outputs regardless of correctness, yielding a competent initialization without internalizing its mistakes. Stage II, Hard Exploration, confines reinforcement learning to queries on which the uncompressed model fails, focusing learning on cases where imitation alone is insufficient and forcing the compression model to explore behaviors better suited to operating over compressed representations, potentially surpassing the uncompressed model.

To verify the effectiveness of DEX-Comp, we conduct extensive experiments and analyses on five widely used open-domain QA benchmarks. Prior soft compression work is largely evaluated at shallow retrieval depths (typically top-5), which may not reflect realistic deployment scenarios. We therefore evaluate our method across a wide range of retrieval depths from top-5 to top-30. Despite compressing the input by 16×16\times and accelerating inference by 4×−24×4\times-24\times, DEX-Comp achieves performance comparable to or exceeding the uncompressed RAG model across retrieval depths and outperforms prior soft compression methods. Ablations and evaluations across diverse datasets and backbone models further confirm the contribution of each stage and the generalization of our approach. This work provides a step toward understanding and improving soft context compression beyond its current limitations.

References (74)