Abstract
Language model pre-training has been shown to capture a surprising amount of world knowledge, crucial for NLP tasks such as question answering. However, this knowledge is stored implicitly in the parameters of a neural network, requiring ever-larger networks to cover more facts. To capture knowledge in a more modular and interpretable way, we augment language model pre-training with a latent knowledge retriever, which allows the model to retrieve and attend over documents from a large corpus such as Wikipedia, used during pre-training, fine-tuning and inference. For the first time, we show how to pre-train such a knowledge retriever in an unsupervised manner, using masked language modeling as the learning signal and backpropagating through a retrieval step that considers millions of documents. We demonstrate the effectiveness of Retrieval-Augmented Language Model pre-training (REALM) by fine-tuning on the challenging task of Open-domain Question Answering (Open-QA). We compare against state-of-the-art models for both explicit and implicit knowledge storage on three popular Open-QA benchmarks, and find that we outperform all previous methods by a significant margin (4-16% absolute accuracy), while also providing qualitative benefits such as interpretability and modularity.
Introduction
Standard language models like BERT and T5 store world knowledge implicitly within their network weights. While effective, this approach leads to massive model bloat, as increasing the knowledge base requires scaling the number of parameters. Furthermore, this "black box" storage lacks provenance—it is difficult to verify why a model makes a specific prediction—and suffers from staleness, as updating the model's knowledge requires expensive retraining.
REALM (Retrieval-Augmented Language Model) addresses these issues by introducing a learned, explicit knowledge retriever. By offloading factual storage to an external corpus like Wikipedia, REALM achieves superior performance on open-domain question answering (Open-QA) while remaining significantly more efficient than massive, parameter-heavy models.
Methods
The REALM architecture consists of two primary components: a Neural Knowledge Retriever and a Knowledge-Augmented Encoder.
Retrieve-then-Predict Pre-training
During pre-training, REALM utilizes a modified Masked Language Modeling (MLM) objective. Given a masked sentence, the retriever searches a corpus of millions of documents to find relevant context. The encoder then processes both the original query and the retrieved document to predict the missing tokens. Crucially, the retriever is trained in an unsupervised manner; the MLM loss provides the signal to improve retrieval by rewarding the selection of documents that help the encoder predict masked words.
Technical Innovations
To enable training over millions of documents, REALM employs several key techniques:
- Asynchronous MIPS Refresh: Training backpropagates through the retrieval step using Maximum Inner Product Search (MIPS). Since document embeddings change as the retriever learns, REALM uses a background process to periodically re-index the corpus, preventing the training loop from stalling.
- Salient Span Masking: To ensure the model relies on world knowledge rather than local context, the authors mask named entities and dates (e.g., "United Kingdom", "1945") instead of random tokens.
Evaluation and Results
REALM was evaluated on three major Open-QA benchmarks: NaturalQuestions-Open (NQ), WebQuestions (WQ), and CuratedTrec (CT). The model was pre-trained on Wikipedia and CC-News.
Performance and Efficiency
REALM achieved state-of-the-art results across all benchmarks, outperforming previous methods by 4-16% in absolute accuracy. Notably, a REALM model with 330 million parameters outperformed the 11-billion-parameter T5 model, demonstrating a 30x improvement in parameter efficiency.
Modularity and Interpretability
Beyond raw performance, REALM offers significant qualitative advantages. Because knowledge is explicitly retrieved, the model's predictions are interpretable—users can see exactly which document provided the answer. Additionally, the knowledge base is modular; by simply swapping the 2018 Wikipedia corpus for a 2020 version, the model can update its factual knowledge without any additional training.
Conclusion
REALM demonstrates that augmenting language models with a learned retrieval mechanism is a powerful alternative to increasing parameter count. By treating world knowledge as an external, searchable resource, REALM provides a more interpretable, modular, and efficient path forward for large-scale language modeling. Future work may extend this framework to structured knowledge bases, multi-modal retrieval, and cross-lingual applications.
Summary updated