Improving language models by retrieving from trillions of tokens
We enhance auto-regressive language models by conditioning on document chunks retrieved from a large corpus, based on local similarity with preceding tokens. With a $2$ trillion token database, our Retrieval-Enhanced Transformer (RETRO) obtains comparable performance to GPT-3 and Jurassic-1 on the Pile, despite using 25$\times$ fewer parameters. After fine-tuning, RETRO performance translates to downstream knowledge-intensive tasks such as question answering. RETRO combines a frozen Bert retriever, a differentiable encoder and a chunked cross-attention mechanism to predict tokens based on an order of magnitude more data than what is typically consumed during training. We typically train RETRO from scratch, yet can also rapidly RETROfit pre-trained transformers with retrieval and still achieve good performance. Our work opens up new avenues for improving language models through explicit memory at unprecedented scale.
We enhance auto-regressive language models by conditioning on document chunks retrieved from a large corpus, based on local similarity with preceding tokens. With a $2$ trillion token database, our Retrieval-Enhanced Transformer (RETRO) obtains comparable performance to GPT-3 and Jurassic-1 on the Pile, despite using 25$\times$ fewer parameters. After fine-tuning, RETRO performance translates to downstream knowledge-intensive tasks such as question answering. RETRO combines a frozen Bert retriever, a differentiable encoder and a chunked cross-attention mechanism to predict tokens based on an o
Explore this link on the map →related reading
- [2005.11401] Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasksarxiv.org
- Patterns for Building LLM-based Systems & Productseugeneyan.com
- Recursive Language Models | Alex L. Zhangalexzhang13.github.io
- [2605.15156] MeMo: Memory as a Modelarxiv.org
- 2025.findings-emnlp.313.pdfaclanthology.org
- Advanced Retriever Techniques to Improve Your RAGs | Towards Data Sciencetowardsdatascience.com
- Retrieval-Augmented Generation for Large Language Models: A Surveyarxiv.org
- Getting Caught Up to Modern LLM Research | Samarth Goeldev.samarthgoel.com
- Generalizing an LLM from 8k to 1M Context using Qwen-Agent | Qwenqwenlm.github.io
- LangChain ParentDocumentRetriever: Strike a Balance between large vs small chunks | ClusteredBytesclusteredbytes.pages.dev
- Extending Context is Hard | kaiokendevkaiokendev.github.io
- Large Language Models Reading List | Sebastian Raschka, PhDsebastianraschka.com