Papers · RETRO
AI PAPER

Improving Language Models by Retrieving from Trillions of Tokens

Augmented Transformer language models with a retrieval mechanism over a 2 trillion token database, improving performance with a fraction of the parameters of comparable models.

Authors
Sebastian Borgeaud, Arthur Mensch, Jordan Hoffmann +7
Institution
DeepMind
Published
February 7, 2022
Citations
1,800
Category
Architecture
Impact
major
PAPER EXPLAINED

Plain-English Summary

RETRO (Retrieval-Enhanced Transformer) enhances a language model by giving it access to an external database of text during both training and inference. For each chunk of input text, the model retrieves the most similar passages from a database of 2 trillion tokens and attends to them alongside the regular input. This allows a 7.5B parameter RETRO model to match the performance of a 25x larger model on language modeling tasks.

The approach works by encoding text chunks into embeddings, retrieving nearest neighbors from a frozen BERT-based index, and incorporating retrieved passages through cross-attention layers interleaved with the standard Transformer layers.

Key Innovation

The key insight was integrating retrieval directly into the training loop rather than treating it as an inference-time add-on. By training the model to use retrieved passages from the start, RETRO learns when and how to rely on external knowledge versus its own parameters. This is fundamentally different from bolting retrieval onto a pre-trained model at inference time.

The retrieval database can be updated without retraining the model, providing a natural mechanism for keeping knowledge current. This addresses one of the key limitations of parametric-only models, whose knowledge is frozen at training time.

Impact on the Field

RETRO formalized the idea that language models do not need to memorize all knowledge in their parameters. External memory can substitute for parameters, enabling smaller, faster models that maintain access to vast knowledge. This principle influenced both the academic retrieval-augmented generation (RAG) ecosystem and industrial retrieval systems.

The paper also demonstrated that retrieval augmentation is complementary to scaling. Larger retrieval-augmented models still outperform smaller ones, but the retrieval component provides a multiplicative efficiency gain at every scale.

Models That Built on This

While RETRO itself was not widely deployed as a product, its principles deeply influenced the RAG architectures that have become standard in enterprise AI deployment. Google’s Gemini models incorporate retrieval mechanisms that build on RETRO’s approach. The broader movement toward grounding language models in external knowledge owes significant intellectual debt to this work.