Retrieval is Accurate Generation

Bowen Cao, Deng Cai, Leyang Cui, Xuxin Cheng, Wei Bi, Yuexian Zou, Shuming Shi

Abstract

Traditional Large Language Models (LLMs) generate text by predicting the next token from a fixed vocabulary, a process prone to hallucinations and poor attribution. This paper introduces a novel paradigm that replaces token prediction with direct phrase retrieval from massive external corpora. By treating millions of real-world phrases as an extended vocabulary, the proposed framework improves factuality and generation quality. Experimental results show significant gains on knowledge-intensive benchmarks and human-like fluency, while maintaining a low computational overhead compared to existing retrieval-augmented baselines.

Introduction

Standard Large Language Models (LLMs) operate on a small, fixed vocabulary of tokens (words or sub-words). While effective for general fluency, this "closed-book" approach struggles with specific factual recall and lacks a mechanism for direct attribution. Existing Retrieval-Augmented Generation (RAG) systems attempt to mitigate these issues by retrieving documents to inform a generator, but this two-stage process is often slow and limited by the granularity of the retrieved documents.

This research proposes a fundamental shift: skipping document retrieval in favor of retrieving the exact phrases needed directly from a massive phrase table. By treating text generation as a sequence of next-phrase retrievals, the model can leverage the entirety of human knowledge as an extended vocabulary.

Methodology

The core of the framework is the "next-phrase retrieval" mechanism. Instead of selecting a token, the model selects a phrase from a library of over 137 million entries derived from English Wikipedia.

Architecture

The system utilizes a dual-encoder setup:

  • Prefix Encoder: A Transformer-based model that represents the current context (the text written so far).
  • Phrase Encoder: A dense encoder that represents phrases within their original source documents. This ensures that the meaning of a phrase is captured in its specific context (e.g., distinguishing between a "river bank" and a "financial bank").

To find the next phrase, the model performs a Maximum Inner Product Search (MIPS) across the phrase table to find the best match for the current context.

Training via "Oracles"

A significant challenge in this paradigm is determining how to segment training text into phrases. The authors address this using a two-step "Oracle" approach:

  1. Linguistic Heuristics: Syntactic parsing is used to identify meaningful chunks (constituents), filtering out phrases that are too common or too rare.
  2. Iterative Self-Reinforcement: The model "bootstraps" its own retrieval logic. It attempts to retrieve phrases, and if it finds a high-quality match that aligns with the ground truth, it updates its training target to prefer that specific phrase.

Experimental Evaluation

The model was trained on the MiniPile dataset and utilized a March 2022 English Wikipedia dump as its phrase source. Evaluation spanned five knowledge-intensive benchmarks: OpenbookQA, ARC-Challenge, TruthfulQA, MedMCQA, and Med-USMILE.

Key Results

  • Knowledge Accuracy: On OpenbookQA, accuracy increased from 23.47% (base LM) to 36.27%. TruthfulQA scores rose from 29.73% to 34.27%.
  • Generation Quality: The model achieved a MAUVE score of 81.58% in open-ended generation, nearly doubling the base LM's 42.61%, indicating a significant leap toward human-level writing quality.
  • Efficiency: A critical advantage is speed. While previous models like CoG and kNN-LM were 4.4x to 6.29x slower than base LMs, this phrase-retrieval model only introduced a 1.29x overhead, making it significantly more viable for real-world applications.

Discussion and Insights

The results suggest that retrieval is a form of accurate generation. By expanding the vocabulary to millions of context-aware phrases, the model gains several advantages:

  • The "Plug-and-Play" Advantage: Because knowledge is stored in the phrase index rather than the model weights, the index can be swapped. For instance, switching to a medical-specific index immediately improves performance on medical queries without retraining the core model.
  • Efficiency through Granularity: Retrieving multi-word phrases allows the model to "jump" through the generation process, reducing the number of steps required compared to token-by-token generation.

Limitations and Future Work

Despite its success, the approach faces challenges in scalability, as managing a 137-million-entry index is resource-intensive. Future research will focus on index optimization through clustering or dimensionality reduction. Additionally, as a "base" model, it requires further instruction tuning (e.g., RLHF) to follow complex user prompts effectively. Finally, the authors note a need for more innovative metrics to precisely measure the truthfulness of retrieved phrases in creative writing contexts.

Summary updated

BibTeX
@inproceedings{cao2024retrieval,
  author = {Bowen Cao and Deng Cai and Leyang Cui and Xuxin Cheng and Wei Bi and Yuexian Zou and Shuming Shi},
  title = {{Retrieval is Accurate Generation}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=oXYZJXDdo7},
}
Figure