LatentRAG: Latent Reasoning and Retrieval for Efficient Agentic RAG

Yijia Zheng, Marcel Worring

TL;DR

Teaching Large Language Models (LLMs) to search the web step-by-step makes them great at answering complex questions, as long as you don't mind waiting while they "think out loud" in English. LatentRAG cuts out the verbal middleman, allowing the model to brainstorm and query databases directly in its native mathematical vector space. The result? Multi-step reasoning accuracy at nearly single-step speeds—slashing latency by ~90%.

What Problem Does This Paper Address?

Standard Retrieval-Augmented Generation (RAG) works like a quick database lookup: take a user’s question, fetch relevant documents once, and generate an answer. That works fine for trivia, but falls apart on multi-hop questions (e.g., "What year was the winner of the 2016 Marrakesh ePrix born?").

Enter Agentic RAG, where the LLM acts like a detective—writing out a chain-of-thought, formulating a search query, reading the results, and repeating until it cracks the case. It’s accurate, but excruciatingly slow, taking 16–22× longer than naive RAG.

Figure 1: Performance and latency comparison across multi-hop QA datasets. The parenthesized numbers indicate the latency ratio relative to Naive RAG. LatentRAG achieves performance compa- rable to competitive agentic RAG methods such as Search-R1 and AutoRefine, while maintaining latency on par with naive single-step RAG. Search-R1 incurs excessive latency from thought and subquery generation, whereas LatentRAG substantially reduces the time spent in these two stages, leading to the efficiency gains. Detailed stage-wise latency breakdowns are provided in Appendix E.3.

Why the bottleneck? Surprisingly, it’s not the database search itself. About 90% of total latency comes from the LLM autoregressively generating explicit text tokens—one word at a time—for its internal thoughts and search queries. Worse, forcing the model to output discrete words breaks gradient flow, preventing end-to-end training between the LLM and the retriever.

Methods

Instead of translating internal representations into English text just to immediately re-encode that text back into vectors for search, LatentRAG keeps the entire loop inside continuous latent space (the LLM's hidden states).

Figure 2: (1) Traditional explicit agentic RAG methods alternate between generation and retrieval, producing natural language thoughts and subqueries at each generation step to iteratively retrieve relevant documents. (2) LatentRAG only produces latent thought and subquery tokens at each generation step, and the latent subquery tokens are used for retrieval. (3) LatentRAG contains three components: Generation (Sec. 4.1), Retrieval (Sec. 4.2), and Latent Decoding (Sec. 4.3).

Here is what is new under the hood:

  1. Single-Pass Latent Generation: Rather than generating words sequentially, LatentRAG feeds sequences of special placeholder slots (<think_1>...<think_m> and <query_1>...<query_n>) into the LLM. During the parallel "prefill" stage, a single forward pass computes their final hidden states, serving as continuous thought and subquery tokens. An explicit action token (<query> or <answer>) decides whether to keep searching or wrap up.
  2. Latent Retrieval via KL Alignment: A lightweight projector maps the LLM's latent subquery tokens into a dense retriever. Because agentic RAG datasets lack ground-truth labels for intermediate searches, standard contrastive losses (like InfoNCE) struggle with noise. Instead, the authors freeze a copy of the retriever to encode reference text queries from teacher models (Search-R1 and AutoRefine), then train the latent system using Kullback–Leibler (KL) divergence to match the teacher's probability distribution over documents.
  3. Optional Parallel Decoding: Hidden vectors are notoriously opaque. To restore interpretability, separate projectors can translate latent thoughts and subqueries back into English. Because all latent steps are already computed, every thought and subquery across the entire trajectory can be decoded in parallel—and turned off completely in production when speed is paramount.

Datasets

  • Retrieval Corpus: 2018 Wikipedia dump.
  • Training: Supervised finetuning trajectories generated from a combined training set of Natural Questions (NQ) and HotpotQA (plus 5,000 synthetic Wikipedia queries for zero-real-data adaptation tests).
  • Evaluation: Seven standard QA benchmarks—three general QA datasets (NQ, TriviaQA, PopQA) and four multi-hop QA datasets (HotpotQA, 2WikiMultiHopQA, MuSiQue, Bamboogle). No new benchmarks were introduced.

Key Insights and Ideas

  • Linguistic fluency is wasted compute for machines: Much of an LLM's chain-of-thought is grammatical glue. Bypassing discrete tokens avoids sequential decoding bottlenecks and makes the search pipeline fully differentiable.
  • Don't over-imitate the teacher: In ablations, forcing latent queries to match teacher embeddings via cosine distance copied the teacher's exact document retrievals more closely (68.3% overlap vs. 59.4% for KL), yet scored worse on final answers. Matching broader similarity distributions via KL divergence gives the model room to find better retrieval paths.
  • Interpretability makes the model smarter: Even if you turn off text decoding at inference time, keeping the latent decoding loss active during training boosts final Exact Match accuracy (from 40.61% to 43.46%). Forcing hidden states to be translatable into English acts as a powerful regularizer.
  • Plug-and-play retriever swapping: Moving to a new retrieval model doesn't require retraining the LLM. Finetuning only the lightweight retrieval projector on just 5,000 synthetic queries recovers ~95% of full-data performance.

Key Results

Evaluated with Qwen2.5-7B and five dense retrievers (<1B parameters), LatentRAG matches heavyweight agentic baselines while running nearly as fast as single-step RAG:

  • Speedup: Reduces end-to-end inference latency by ~89% to 90% across retrievers (e.g., dropping Search-R1's average time from 5,372 ms down to 593 ms with Qwen3-Embedding-0.6B).
  • Accuracy: Stays within 5% relative Exact Match (EM) of explicit baselines, and frequently beats them—for example, improving over Search-R1 from 42.47% to 43.46% average EM (+2.3% relative) on Qwen3, and reaching 44.86% EM (+1.6%) over AutoRefine with Jina embeddings.
  • Transparent Mode: Turning on parallel latent decoding still cuts latency by 63.3% (1,970 ms) and 47.4% (2,540 ms) compared to Search-R1 and AutoRefine, respectively.
  • Scaling: Tested up to 14B LLMs and 8B retrievers; LatentRAG actually widens its accuracy lead over Search-R1 on smaller 3B LLMs (35.59% vs. 30.46% EM).

Limitations and Future Work

While a dedicated limitations section is omitted from the main text, the authors explicitly highlight two practical constraints in their experiments:

  • Sensitivity to Anisotropic Embedding Spaces: When paired with e5-base-v2, LatentRAG suffers a ~3.6–4.0% relative accuracy drop. Because that retriever packs all its embeddings into a narrow cone on a hypersphere (anisotropy), the LLM struggles to align with such a skewed space.
  • Parallel Decoding Bottlenecks: When optional text decoding is enabled, parallel speedup is bounded by the single longest thought sequence in the batch—meaning imbalanced reasoning lengths reduce efficiency gains.
  • Dense-Only Scope: By design, continuous vector alignment focuses on dense neural retrievers rather than exact keyword-matching (sparse) systems.

Summary updated

Abstract

Single-step retrieval-augmented generation (RAG) provides an efficient way to incorporate external information for simple question answering tasks but struggles with complex questions. Agentic RAG extends this paradigm by replacing single-step retrieval with a multi-step process, in which the large language model (LLM) acts as a search agent that generates intermediate thoughts and subqueries to iteratively interact with the retrieval system. This iterative process incurs substantial latency due to the autoregressive generation of lengthy thoughts and subqueries. To address this limitation, we propose LatentRAG, a novel framework that shifts both reasoning and retrieval from discrete language space to continuous latent space. Unlike existing explicit methods that generate natural language thoughts or subqueries token-by-token, LatentRAG produces latent tokens for thoughts and subqueries directly from the hidden states in a single forward pass. We align LLMs with dense retrieval models in the latent space, enabling retrieval over latent subquery tokens and supporting end-to-end joint optimization. To improve transparency and encourage semantically meaningful latent representations, we incorporate a parallel latent decoding mechanism that translates latent tokens back into natural language. Extensive experiments on seven benchmark datasets show that LatentRAG achieves performance comparable to explicit agentic RAG methods while reducing inference latency by approximately 90%, substantially narrowing the latency gap with traditional single-step RAG.
BibTeX
@inproceedings{zheng2026latentrag,
  author = {Yijia Zheng and Marcel Worring},
  title = {{LatentRAG: Latent Reasoning and Retrieval for Efficient Agentic RAG}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=JWv9VTeebX},
}
Figure