Skip to main content
QUICK REVIEW

[Paper Review] Improving language models by retrieving from trillions of tokens

Sebastian Borgeaud, Arthur Mensch|arXiv (Cornell University)|Dec 8, 2021
Topic ModelingComputer Science296 citations
TL;DR

Retro augments auto-regressive language models with a retrieval mechanism from a trillion-token database, achieving GPT-3/Jurassic-1-like performance with far fewer parameters and enabling knowledge-intensive downstream tasks.

ABSTRACT

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$ imes$ 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.

Motivation & Objective

  • Motivate reducing dependence on ever-larger models by leveraging a massive external memory via retrieval.
  • Develop a retrieval-enhanced autoregressive architecture that scales retrieval to trillions of tokens.
  • Demonstrate that retrieval provides consistent gains across model sizes and downstream tasks.
  • Show that Retro can be Retro-fitted to pre-trained models with minimal extra computation.
  • Address evaluation leakage concerns when retrieval systems have access to training data.

Proposed method

  • Construct a key-value database of text chunks using frozen BERT embeddings as keys and raw text chunks as values.
  • Split input sequences into chunks and augment each with k-nearest neighbour retrieved chunks from the database.
  • Integrate retrieved data using an encoder-decoder Transformer with a chunked cross-attention mechanism (Cca).
  • Use a frozen BERT-based retriever to enable retrieval at scale without retriever training.
  • Train with an autoregressive objective that conditions on retrieved neighbours from previous chunks, preserving causality.
  • Evaluate on large-scale multilingual data (MassiveText) and test datasets (C4, Wikitext103, Pile), and analyze leakage effects via evaluation-chunk overlap.

Experimental results

Research questions

  • RQ1How does retrieving from a trillions-token database affect language model performance across different model sizes?
  • RQ2Can a retrieval-augmented model match or surpass baselines like GPT-3 and Jurassic-1 on standard benchmarks with fewer parameters?
  • RQ3Does increasing database size or the number of retrieved neighbours yield consistent improvements, and what are the limits?
  • RQ4Can Retro be effectively retrofitted to pre-trained transformers with minimal additional computation?
  • RQ5How does evaluation data leakage influence performance in retrieval-augmented models?

Key findings

  • Retro with a 2 trillion token database provides comparable performance to GPT-3 and Jurassic-1 on the Pile despite using 25x fewer parameters.
  • Performance gains from retrieval remain constant as model size scales from 150M to 7B parameters.
  • Increasing the retrieval database size and the number of retrieved neighbours both improve performance, up to a point where very large neighbour sets may hurt quality.
  • Retro achieves state-of-the-art results on Wikitext103 and Pile after training, and can be fine-tuned for competitive downstream tasks like question answering.
  • Evaluation leakage-awareness methodology shows that improvements come from both explicit neighbour copying and general knowledge extraction; larger databases and more neighbours amplify gains for bigger models.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.