ImpRAG: Retrieval-Augmented Generation with Implicit Queries

Wenzheng Zhang, Xi Victoria Lin, Karl Stratos, Wen-tau Yih, Mingda Chen · DOI

Introduction

Traditional Retrieval-Augmented Generation (RAG) systems rely on a "retrieve-then-generate" pipeline that typically requires an explicit textual query. This approach creates a fundamental disconnect: the system must guess what information the generator needs and translate that need into a string. This dependency on human-written or model-generated text queries often limits a model's ability to generalize across diverse tasks where the ideal query format is unclear.

ImpRAG (Implicit Retrieval-Augmented Generation) addresses this by eliminating the need for explicit queries. Instead, it allows a Large Language Model (LLM) to express its information needs through its own internal latent representations.

The ImpRAG Architecture: Layer Slicing

The core innovation of ImpRAG is a technique called Layer Slicing. Rather than using separate models for retrieval and generation, ImpRAG partitions a single decoder-only LLM (such as Llama-3) into three functional layer groups:

  1. Retriever (Bottom Layers): These layers process the input and generate a latent query vector from the self-attention mechanism's final layer in this group.
  2. Reader (Middle Layers): These layers perform cross-attention over the retrieved passages, integrating external knowledge into the model's state.
  3. Generator (Top Layers): These layers produce the final output token based on the enriched context.
The ImpRAG architecture uses layer slicing to derive implicit queries and perform cross-attention within a single LLM.

This unified architecture ensures that the retriever and generator are tightly coupled, minimizing the disparity between retrieved content and the generator's actual requirements.

Training Strategy

ImpRAG is trained using a multi-task objective that combines standard language modeling with a specialized retrieval loss. The training process involves two key stages:

  • Warmup: The model is initially trained to mimic the behavior of a strong off-the-shelf retriever (e.g., Contriever).
  • Self-Distillation: The model refines its retrieval capabilities by evaluating its own generation performance. If a specific passage increases the likelihood of a correct answer (lowering perplexity), the retriever learns to prioritize similar information in the future.

Performance and Key Results

ImpRAG demonstrates significant performance improvements over traditional RAG baselines, particularly on "unseen" tasks that were not part of the training set.

Performance comparison of ImpRAG against various baselines across multiple knowledge-intensive benchmarks.

Key findings from the evaluation include:

  • Superior Generalization: On unseen tasks, ImpRAG achieved Exact Match (EM) score increases of 3.6 to 11.5 points compared to baselines.
  • Enhanced Retrieval Accuracy: Retrieval recall improved by 5.0 to 23.2 points.
  • Success in Specialized Tasks: In Entity Linking (AIDA), where formulating text queries is notoriously difficult, ImpRAG saw a jump of over 20 points in retrieval recall.
  • Efficiency: By sharing parameters across the entire pipeline, ImpRAG reduces the operational complexity of managing separate retrieval and generation models.

Conclusion and Future Work

ImpRAG represents a shift toward more integrated and flexible RAG systems. By leveraging the internal states of an LLM as implicit queries, it bypasses the limitations of textual templates and achieves state-of-the-art performance across a wide range of tasks.

Future research directions include extending ImpRAG to support multi-hop retrieval and exploring its application to other LLM architectures beyond the Llama family. While the current implementation relies on a "warmup" phase with existing retrievers, future iterations may seek to further reduce this dependency.

Summary updated

BibTeX
@misc{zhang2025imprag,
  author = {Wenzheng Zhang and Xi Victoria Lin and Karl Stratos and Wen-tau Yih and Mingda Chen},
  title = {{ImpRAG: Retrieval-Augmented Generation with Implicit Queries}},
  year = {2025},
  eprint = {2506.02279},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2506.02279},
}
Figure