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.
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).
Here is what is new under the hood:
- 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. - 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.
- 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