Abstract
Retrieval-Augmented Generation (RAG) enhances Large Language Models (LLMs) by providing external context, yet performance is often limited by the "query gap"—the discrepancy between user input and optimal retrieval queries. This paper proposes Rewrite-Retrieve-Read, a framework featuring a trainable query rewriter. By using Reinforcement Learning (RL) to align a small rewriter model with a large, frozen reader, the system significantly improves retrieval quality and downstream task performance across various knowledge-intensive benchmarks.
Introduction
Large Language Models (LLMs) are powerful but prone to hallucinations and "temporal misalignment," where they lack knowledge of events occurring after their training. Retrieval-Augmented Generation (RAG) mitigates these issues by providing relevant external documents. However, most RAG systems follow a rigid Retrieve-then-Read pipeline.
The authors identify a critical bottleneck: the query gap. A user's raw question is often poorly suited for search engines. Furthermore, many state-of-the-art LLMs are "black boxes" accessible only via APIs, making it impossible to fine-tune the reader to compensate for poor retrieval. Instead, the input to the retriever must be adapted to ensure the reader receives high-quality information.
The Rewrite-Retrieve-Read Framework
The proposed framework introduces a dedicated rewriting step to bridge the query gap.
The pipeline consists of three stages:
- Rewrite: A "rewriter" model (T5-large, 770M parameters) transforms the initial user query into a more effective search query.
- Retrieve: An off-the-shelf search engine (Bing Search API) retrieves relevant web contexts.
- Read: A frozen LLM (e.g., ChatGPT or Vicuna-13B) processes the context and original question to generate an answer.
Training via Reinforcement Learning
To align the rewriter with the black-box reader, the authors employ a two-stage training process. First, a warm-up phase fine-tunes the T5 model on "pseudo-queries" generated by prompting a large LLM. Second, Reinforcement Learning (PPO) is used to optimize the rewriter. The reward signal is derived from the reader's performance (Exact Match and F1 score) and the retrieval "Hit Ratio," ensuring the rewriter learns to produce queries that specifically help the reader succeed.
Experimental Evaluation
The framework was evaluated on several knowledge-intensive benchmarks, including HotpotQA (multi-hop reasoning), AmbigNQ (ambiguous questions), and PopQA (long-tail knowledge).
Key Results
- Performance Gains: The trainable rewriter consistently outperformed standard RAG. On HotpotQA, Exact Match (EM) rose from 30.47% to 34.38%.
- Retrieval Quality: The "Hit Ratio" improved significantly, jumping from 76.4% to 82.2% on AmbigNQ.
- Model Agnostic: The method showed gains regardless of whether the reader was ChatGPT or Vicuna-13B.
Discussion and Insights
The study reveals that the query gap is a significant hurdle; on HotpotQA, standard retrieval initially hindered performance because raw multi-hop questions were too noisy. Rewriting resolved this by decomposing complex needs. Notably, a relatively small model (T5-large) can become a highly effective specialist through task-specific alignment, often outperforming few-shot prompted larger models.
Limitations
While effective, training via RL requires numerous inference calls to the reader, which can be computationally expensive. Additionally, a rewriter heavily fine-tuned on one task may lose generalizability. Future work could explore iterative, multi-turn rewriting for even more complex information needs.
Summary updated