Reading + AI

Improving language models by retrieving from trillions of tokens

Sebastian Borgeaud, Arthur Mensch, Jordan Hoffmann, Trevor Cai, Eliza Rutherford, Katie Millican, George van den Driessche, Jean-Baptiste Lespiau
and 20 more authorsBogdan Damoc, Aidan Clark, Diego de Las Casas, Aurelia Guy, Jacob Menick, Roman Ring, Tom Hennigan, Saffron Huang, Loren Maggiore, Chris Jones, Albin Cassirer, Andy Brock, Michela Paganini, Geoffrey Irving, Oriol Vinyals, Simon Osindero, Karen Simonyan, Jack W. Rae, Erich Elsen, Laurent Sifre

arXiv:2112.04426v3 · This workspace stays on this version. Check arXiv for newer versions

Affiliations and author notes
  • All authors from DeepMind
  • Equal contributions
  • Equal senior authorship
Some source details need review 2 to check

Original formulas, table values and figures are preserved. Comparison can miss differences; use the original PDF to check details.

Reading view checked: 600 math expressions, 90 rendering failures; 33 of 33 images available.

Compared 131 of 145 source passages against 37 of 43 PDF pages.

The HTML source contains failed formatting commands; these were omitted from the reading view. The original sources are retained. (2)

  • Some formulas could not be rendered; their original TeX is shown. Check the original PDF. (90)
  • This long paper was only partially compared; the original sources remain available.

33 of 33 figure, table and graphic images captured. Open original PDF

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×\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.

Language modelling (LM) is an unsupervised task that consists of modelling the probability of text, usually by factorising it into conditional next-token predictions p(x1,…,xn)=∏ip(xi∣x<i)p(x_{1},\dotsc,x_{n})=\prod_{i}p(x_{i}|x_{<i}). Neural networks have proven to be powerful language models, first in the form of recurrent architectures (Mikolov et al., 2010; Graves, 2013; Jozefowicz et al., 2016) and more recently in the form of Transformers (Vaswani et al., 2017), that use attention to contextualise the past. Large performance improvements have come from increasing the amount of data, training compute, or model parameters. Transformers have been scaled from 100100 million parameter models in seminal work to over hundred billion parameters (Radford et al., 2019; Brown et al., 2020) in the last two years which has led to models that do very well on a wide array of tasks in a zero or few-shot formulation. Increasing model size predictably improves performance on a wide range of downstream tasks (Kaplan et al., 2020). The benefits of increasing the number of parameters come from two factors: additional computations at training and inference time, and increased memorization of the training data.

In this work, we endeavor to decouple these, by exploring efficient means of augmenting language models with a massive-scale memory without significantly increasing computations. Specifically, we suggest retrieval from a large text database as a complementary path to scaling language models. Instead of increasing the size of the model and training on more data, we equip models with the ability to directly access a large database to perform predictions—a semi-parametric approach. At a high level, our Retrieval Transformer (Retro) model splits the input sequence into chunks and retrieves text similar to the previous chunk to improve the predictions in the current chunk. Existing retrieval for language modelling work only considers small transformers (100100 millions parameters) and databases of limited size (up to billions of tokens) (Khandelwal et al., 2020; Yogatama et al., 2021; Guu et al., 2020; Lewis et al., 2020). To our knowledge, our work is the first to show the benefits of scaling the retrieval database to trillions of tokens for large parametric language models. Our main contributions are the following.

  • •

    We introduce Retro, a retrieval-enhanced autoregressive language model (§2.2). We use a chunked cross-attention module to incorporate the retrieved text (§2.4), with time complexity linear in the amount of retrieved data. We show that retrieving based on a pre-trained frozen Bert model (§2.3) works at scale, removing the need for training and updating a retriever network.

  • •

    We show that our method scales well with model size and database size (Fig. 1): Retro provides a constant gain for models ranging from 150M to 7B parameters, and Retro can be improved at evaluation time by increasing the database size and the number of retrieved neighbours. Our largest model obtains state-of-the-art results on a range of downstream evaluation datasets including Wikitext103 (Merity et al., 2017) and the Pile (Gao et al., 2020) (§4). We show that Retro can be fine-tuned to achieve competitive performance on downstream tasks such as question answering (§4.3).

  • •

    We propose an evaluation aware of proximity of test documents with the training set (§2.6), addressing the problem of test set leakage (Lee et al., 2021). This is relevant for all language models, and especially for retrieval-enhanced models since they have direct access to the training dataset during evaluation. Using this methodology, we show that the performance of Retro comes from both explicit neighbour copying and general knowledge extraction (§4.4).

Figure 1
Figure 1: Scaling of Retro. The performance gain of our retrieval models remains constant with model scale (left), and is comparable to multiplying the parameteric model size by ∼10×\sim 10\times. The gain increases with the size of the retrieval database (middle) and the number of retrieved neighbours (right) on the C4 validation set, when using up to 40 neighbours. Past this, performance begins to degrade, perhaps due to the reduced quality. At evaluation Retro can be used without retrieval data (Retro[OFF]), bringing limited performance degradation compared to baseline transformers.

We design our retrieval-enhanced architecture to be capable of retrieving from a database with trillions of tokens. For this purpose, we retrieve at the level of contiguous token chunks instead of individual tokens which reduces storage and computation requirements by a large linear factor. Our method first constructs a key-value database, where values store raw chunks of text tokens and keys are frozen Bert embedddings (Devlin et al., 2019). We use a frozen model to avoid having to periodically re-compute embeddings over the entire database during training. Each training sequence is then split into chunks, which are augmented with their kk-nearest neighbour retrieved from the database. An encoder-decoder architecture integrates retrieval chunks into the model’s predictions. We summarize the Retro architecture in Fig. 2, and detail it in this section. We end the section by introducing a new methodology to evaluate language models when an evaluation set is partially present in the training set.

Figure 2
Figure 2: Retro architecture. Left: simplified version where a sequence of length n=12n=12 is split into l=3l=3 chunks of size m=4m=4. For each chunk, we retrieve k=2k=2 neighbours of r=5r=5 tokens each. The retrieval pathway is shown on top. Right: Details of the interactions in the Cca operator. Causality is maintained as neighbours of the first chunk only affect the last token of the first chunk and tokens from the second chunk.

We use a multi-lingual version of MassiveText (Rae et al., 2021) for both training and retrieval data. The dataset consists of text documents from multiple sources and multiple languages totalling over 5 trillion tokens (detailed in Table 1). Sequences are sampled from subsets of the training data, with sampling weights given in the right-most column of Table 1. We tokenize the dataset using SentencePiece (Kudo and Richardson, 2018) with a vocabulary of 128,000 tokens. During training (unless otherwise specified), we retrieve from 600B tokens from the training data. The training retrieval database is made of the same subsets as the training data, in proportion that matches the training sampling frequencies. During evaluation the retrieval database consists in the full union of these datasets, with the exception of books for which we use a sub-sample of 4%. The evaluation retrieval database thus contains 1.75T tokens. To limit test set leakage, we compute the 1313-gram Jaccard similarity between train and test documents using the MinHash scheme and remove all training documents with high similarity (0.8 or higher) to a validation or test set document. Additionally, we remove all validation and test articles from Wikitext103 (Merity et al., 2017) from our Wikipedia training data.

Table 1
SourceToken count (M)Documents (M)MultilingualSampling frequency
Web977,5631,208Yes55%
Books3,423,74020No25%
News236,918398No10%
Wikipedia13,28823Yes5%
GitHub374,952143No5%
Table 1: MassiveText. The last column indicates the sampling weight during training. The multilingual subsets include documents in 10 languages. The full breakdown is given in §A.1.
View original tableOriginal Table 1

Our approach uses retrieval as a way to augment input examples at the granularity of small chunks of tokens. Formally, we consider sequences of integer tokens in V=[1,v]\mathbb{V}=[1,v], obtained using a text tokenizer1^{1}. We split each nn-token-long example X=(x1,…,xn)X=(x_{1},\dots,x_{n}) into a sequence of ll chunks (C1,…,Cl)(C_{1},\dots,C_{l}) of size m=nlm=\frac{n}{l}, i.e. C1≜(x1,…,xm), …, Cl≜(xn−m+1,…,xn)∈VmC_{1}\triangleq{(x_{1},\dots,x_{m}),\,\dots,\,C_{l}\triangleq}(x_{n-m+1},\dots,x_{n})\in\mathbb{V}^{m}. We use n=2048n=2048 and m=64m=64. We augment each chunk CuC_{u} with a set RetD(Cu)\textsc{Ret}_{\mathcal{D}}(C_{u}) of kk neighbours from the database D\mathcal{D}. RetD\textsc{Ret}_{\mathcal{D}} (or Ret for brevity) is a non-trainable operator specified in §2.3. Token likelihoods are provided by a model, parameterized by θ\theta, that takes as input both previous tokens and their retrieved neighbours. This defines the following retrieval-enhanced sequence log-likelihood:

L(X∣θ,D)≜∑u=1l∑i=1mℓθ(x(u−1) m+i∣(xj)j<(u−1) m+i, (RetD(Cu′))u′<u).L\left(X|\theta,\mathcal{D}\right)\triangleq\sum_{u=1}^{l}\sum_{i=1}^{m}\ell_{\theta}\left(x_{(u-1)\,m+i}|(x_{j})_{j<(u-1)\,m+i},\ (\textsc{Ret}_{\mathcal{D}}(C_{u^{\prime}}))_{u^{\prime}<u}\right).
(1)

We set Ret(C1)=∅\textsc{Ret}(C_{1})=\emptyset, namely the likelihood of tokens from the first chunk does not depend on any retrieval data. This likelihood definition preserves autoregressivity: the probability of the ii-th token of the uu-th chunk, x(u−1)m+ix_{(u-1)m+i}, only depends on previously seen tokens (xj)1⩽j<(u−1)m+i(x_{j})_{1\leqslant j<(u-1)m+i} and on the data retrieved from the previous chunks (Ret(Cu′))u′<u(\textsc{Ret}(C_{u^{\prime}}))_{u^{\prime}<u}. We can therefore directly sample with log-probability ℓ\ell, where sampling within the chunk CuC_{u} is conditioned on the neighbours (Ret(Cu′))u′<u(\textsc{Ret}(C_{u^{\prime}}))_{u^{\prime}<u}. This makes retrieval-enhanced models directly comparable with the largest language models that are evaluated by sampling.

Our database consists of a key-value memory. Each value consists of two contiguous chunks of tokens which we denote [N,F][N,F] where NN is the neighbour chunk which is used to compute the key, and FF is its continuation in the original document. The corresponding key is the Bert embedding of NN, averaged over time, that we denote Bert(N)\textsc{Bert}(N). For each chunk CC, we retrieve its approximate kk-nearest neighbours from our key-value database using the L2L_{2} distance on BERT embeddings d(C,N)=∣∣Bert(C)−Bert(N)∣∣22d(C,N)=||\textsc{Bert}(C)-\textsc{Bert}(N)||_{2}^{2}. The model receives the corresponding values Ret(C)≜([N1,F1],…,[Nk,Fk])\textsc{Ret}(C)\triangleq([N^{1},F^{1}],\dots,[N^{k},F^{k}]). Both neighbour chunks and their continuations provide meaningful improvements, as illustrated in our ablation study (Appendix D). We use a length 6464 for both NjN^{j} and FjF^{j}, thus Ret(C)\textsc{Ret}(C) has a shape of k×rk\times r with r=128r=128. To avoid retrieving the chunk Cu+1C_{u+1} in the retrieval set Ret(Cu)\textsc{Ret}(C_{u}), which would break causality during training, we filter out neighbours originating from the same document as the training sequence XX.

For a database of TT elements, we can query the approximate nearest neighbours in O(log⁡T)\mathcal{O}(\log T) time. We use the SCaNN library (Guo et al., 2020) to achieve this. This means that we can query our 22 trillion token database in 10 ms10\,\textrm{ms} whilst evaluating or sampling from the model; this expense is amortized over a chunk length. Performing retrieval on-the-fly is too slow to keep up with the training calculations—we leverage the frozen aspect of the embedding operator Bert to precompute all approximate nearest neighbours and save the results as part of the data. In Fig. 9 in the Appendix, we show results where we only retrieve neighbours within Wikipedia. We find that neighbours tend to come from 2-3 links away from a given article whereas random articles are more than 5 links apart.

Our model relies on an encoder-decoder transformer architecture, integrating the retrieved data through a cross-attention mechanism as introduced in Vaswani et al. (2017). First, the retrieved tokens Ret(C)\textsc{Ret}(C) are fed into an encoder Transformer, which computes the encoded neighbours set EE. Denoting the intermediate activations by HH, our transformer decoder then interleaves Retro-blocks Retro(H,E)\textsc{Retro}(H,E) and standard Transformer blocks LM(H)\textsc{LM}(H) (the hyperparameter P⊆[1,L]P\subseteq[1,L] determines at which layers we use a Retro-block). These blocks are built from three different residual operators with signature Rn×d→Rn×d\mathbb{R}^{n\times d}\to\mathbb{R}^{n\times d}: a fully-connected layer Ffw, the standard sequence-level self-attention layer Attn, and a chunked cross-attention layer Cca(⋅,E)\textsc{Cca}(\cdot,E) that incorporates information from the retrieval encoder:

Retro(H,E)≜Ffw(Cca(Attn(H),E)),andLm(H)≜Ffw(Attn(H))\textsc{Retro}\left(H,E\right)\triangleq\textsc{Ffw}\left(\textsc{Cca}\left(\textsc{Attn}\left(H\right),E\right)\right),\quad\text{and}\quad\textsc{Lm}(H)\triangleq\textsc{Ffw}(\textsc{Attn}(H))
(2)

Since Ffw, Attn and Cca are all autoregressive operators whose output at position ii only depends on (hj)j⩽i(h_{j})_{j\leqslant i}, any succession of Retro and lm layers, followed by a token classification head defines an autoregressive log-likelihood (1). An overview of the model architecture is given in Algorithm 1 and in Fig. 2. We next describe the retrieval encoder and the chunked cross-attention layer in more detail, and explain how to sample from Retro.

Algorithm 1 Overview of Retro model architecture.
Hyperparam: PP and PencP_{\textrm{enc}}, indices of layers with cross-attention in the decoder and encoder respectively
Hyperparam: LL and LencL_{\textrm{enc}}, number of decoder layers and number of encoder layers.
Input: X∈VnX\in\mathbb{V}^{n}: sequence of tokens. (Ret(Cu))1⩽u⩽l{(\textsc{Ret}(C_{u}))}_{1\leqslant u\leqslant l}: the retrieved neighbours
Output: O∈Rn×∣V∣O\in\mathbb{R}^{n\times|\mathbb{V}|}: the output logits
def Encoder(Ret(Cu)1⩽u⩽l,H)\textsc{Encoder}(\textsc{Ret}(C_{u})_{1\leqslant u\leqslant l},H):
(Hu)u∈[1,l]←Split(H){(H_{u})}_{u\in[1,l]}\leftarrow\textsc{Split}(H)
for j∈[1,k],u∈[1,l]j\in[1,k],u\in[1,l] do // Encoder shared across neighbours and chunks
Euj=Embenc(Ret(Cu)j)E_{u}^{j}=\textsc{Emb}_{\textrm{enc}}(\textsc{Ret}(C_{u})^{j}) // May be shared with the decoder Emb
for p′∈[1,Lenc]p^{\prime}\in[1,L_{\textrm{enc}}] do
Euj←Attnenc(Euj)E_{u}^{j}\leftarrow\textsc{Attn}_{\textrm{enc}}(E_{u}^{j}) // Bi-directional attention
if p′∈Pencp^{\prime}\in P_{\textrm{enc}} then
Euj←Caenc(Euj,Hu)E_{u}^{j}\leftarrow\textsc{Ca}_{\textrm{enc}}(E_{u}^{j},H_{u})
Euj←Ffwenc(Euj)E_{u}^{j}\leftarrow\textsc{Ffw}_{\textrm{enc}}(E_{u}^{j})
return EE
H←Emb(X)H\leftarrow\textsc{Emb}(X)
for p∈[1,L]p\in[1,L] do
H←Attn(H)H\leftarrow\textsc{Attn}(H) // Causal attention
if p=min⁡(P)p=\min(P) then
// The neighbour Encoder is conditioned with the decoder activations of the last layer before the first cross-attention
EE = Encoder(Ret(Cu)1⩽u⩽l,H)\textsc{Encoder}(\textsc{Ret}(C_{u})_{1\leqslant u\leqslant l},H)
if p∈Pp\in P then
H←Cca(H,E)H\leftarrow\textsc{Cca}(H,E)
H←Ffw(H)H\leftarrow\textsc{Ffw}(H)
O←Read(H)O\leftarrow\textsc{Read}(H)

For each chunk CuC_{u}, the kk retrieval neighbours Ret(Cu)\textsc{Ret}(C_{u}) are fed into a bi-directional transformer Encoder, yielding the outputs Euj≜Encoder(Ret(Cu)j,Hu)∈Rr×d′E_{u}^{j}\triangleq\textsc{Encoder}(\textsc{Ret}(C_{u})^{j},H_{u})\in\mathbb{R}^{r\times d^{\prime}}, where j∈[1,k]j\in[1,k] indexes each neighbour. The retrieval encoder is a non-causal transformer. It is conditioned on HuH_{u}, the activations of chunk CuC_{u}, through cross-attention layers; this allows the representations of the retrieval encoder to be modulated by the retrieving chunk in a differentiable way. More precisely, the encoding of the j\textsuperscript{th} neighbour of the u\textsuperscript{th} chunk, Ret(Cu)j\textsc{Ret}(C_{u})^{j}, depends on the attended activation Hu≜(h(u−1)m+i)i∈[1,m]∈Rm×dH_{u}\triangleq{(h_{(u-1)m+i})}_{i\in[1,m]}\in\mathbb{R}^{m\times d} of chunk CuC_{u} at layer min⁡(P)\min(P). All neighbours for all chunks are encoded in parallel, yielding a full encoded set E≜(Euj)u∈[1,l],j∈[1,k]∈Rl×k×r×d′E\triangleq{(E_{u}^{j})}_{u\in[1,l],j\in[1,k]}\in\mathbb{R}^{l\times k\times r\times d^{\prime}}. We denote Eu∈Rk×r×d′E_{u}\in\mathbb{R}^{k\times r\times d^{\prime}} as the encoded neighbours for chunk u∈[1,l]u\in[1,l].

To perform the Cca operation, we first split a given intermediate activation H∈Rn×dH\in\mathbb{R}^{n\times d} into l−1l{-}1 attending chunks (Hu+≜(hu m+i−1)i∈[1,m]∈Rm×d)u∈[1,l−1]{\left(H_{u}^{+}\triangleq{(h_{u\,m+i-1})}_{i\in[1,m]}\in\mathbb{R}^{m\times d}\right)}_{u\in[1,l-1]}, as depicted on the right of Fig. 2. Hu+H_{u}^{+} holds the intermediary embeddings of the last token in chunk CuC_{u} and of the first m−1m-1 tokens in Cu+1C_{u+1} 2^{2}. We compute the cross-attention between Hu+H_{u}^{+} and EuE_{u}—the encoded retrieval set obtained from chunk CuC_{u}. Attention is computed across time and across neighbours simultaneously, as we merge the neighbour and time dimensions of EuE_{u} before applying cross-attention. Since there is a notion of alignment between data chunks and retrieval neighbours, we use relative positional encodings as described in §B.1.2.

We concatenate the l−1l{-}1 outputs of the per-chunk cross-attentions (each of shape m×dm\times d) across time, and properly pad the result; we thus form the output activation Cca(H,E)∈Rn×d\textsc{Cca}(H,E)\in\mathbb{R}^{n\times d}. Formally, for each chunk CuC_{u} and for each token i∈[1,m]i\in[1,m] we set

Cca(H,E)u m+i−1≜Ca(hu m+i−1,Eu),\textsc{Cca}(H,E)_{u\,m+i-1}\triangleq\textsc{Ca}(h_{u\,m+i-1},E_{u}),
(3)

where Ca is the cross-attention residual operator over time-concatenated encoded neighbours. We recall that this operator is defined in its simplest version by three parameter matrices K∈Rd×c,Q∈Rd×cK\in\mathbb{R}^{d\times c},Q\in\mathbb{R}^{d\times c} and V∈Rd×dV\in\mathbb{R}^{d\times d}. For all h∈Rdh\in\mathbb{R}^{d} and Y∈RT×dY\in\mathbb{R}^{T\times d}, we define

Ca(h,Y)≜softmax(YKQTh)YV,\textsc{Ca}(h,Y)\triangleq\textrm{softmax}(YKQ^{T}h)YV,
(4)

where the softmax is performed on the second dimension and all products are matrix products. We use multi-head cross-attention, and add positional encodings to the softmax(see §B.1.2).

The first m−1m-1 tokens cannot attend to any neighbour of a previous chunk; at these positions, we define Cca as the identity, setting Cca(H,E)j≜hj{\textsc{Cca}(H,E)}_{j}\triangleq h_{j} for all tokens j∈[1,m−1]j\in[1,m-1]. Finally, the last token hlmh_{lm} attends to the last retrieval set ElE_{l} and we set hl m≜Ca(hl m,El)h_{l\,m}\triangleq\textsc{Ca}(h_{l\,m},E_{l}) (not shown in Fig. 2). 1 contains a simplified implementation of Cca. Note that chunked cross-attention is autoregressive: the output of Cca at position ii depends on the sequence from tokens from 00 to ii that is input to Cca.

With Retro models, even though each Cca cross-attention attends only to the neighbours of the preceding chunk Ret(Cu−1)\textsc{Ret}(C_{u-1}), the dependencies over previous neighbours are propagated via the self-attention operations. The activations of the ii th^{th} token in the uu th^{th} chunk therefore potentially depend upon the set of all previous neighbours Ret(Cu′)u′<u\textsc{Ret}(C_{u^{\prime}})_{u^{\prime}<u}, without incurring the quadratic cost of cross attending to that set.

When sampling, at the end of a chunk CuC_{u}, we use SCaNN to retrieve neighbours Ret(Cu)\textsc{Ret}(C_{u}), based on the embedding Bert(Cu)\textsc{Bert}(C_{u}). The encoded neighbours Eu=Encoder(Ret(Cu))E_{u}=\textsc{Encoder}(\textsc{Ret}(C_{u})) are then used to condition the generation of the next chunk Cu+1C_{u+1}, which we do incrementally: overall the cost of sampling is thus quadratic in the size of the sampled sequence, as when sampling from regular Transformers; the added cost of retrieval is linear in the number of chunks ll, and is negligible compared to the token sampling cost in practice.

We use a transformer (Vaswani et al., 2017) similar to the one described in (Radford et al., 2019), with some minimal changes: we replace LayerNorm with RMSNorm (Zhang and Sennrich, 2019) and use relative position encodings (Dai et al., 2019). As baselines, we train retrieval-free transformers with 132M, 368M, 1.3B and 7.0B parameters (embedding matrices are excluded from parameter counts). The hyperparameters we used are detailed in Table 2. All retrieval models use the same size encoder for the retrieval data, with d′=896d^{\prime}=896 and 2 layers, which roughly adds 19M19M parameters. The encoder uses relative positional encodings. The retrieval models contain one Retro-block every 3 blocks, starting from layer 6. For our smallest model, Cca is applied in layers 6, 9 and 12 of the main pathway and also once for query conditioning in the encoder, which adds an additional 12M12M parameters. The relative number of extra parameters reduces as we increase the baseline model size. All models are implemented using JAX (Bradbury et al., 2018) and Haiku (Hennigan et al., 2020).

Table 2
Baseline parametersRetrodddffwd_{\textrm{ffw}}# headsHead size# layers
132M172M (+30%)8963,584166412
368M425M (+15%)1,5366,1441212812
1,309M1,451M (+11%)2,0488,1921612824
6,982M7,532M   (+8%)4,09616,3843212832
Table 2: Number of parameters for our baseline and Retro models, excluding embeddings, along with the corresponding hyperparameters.
View original tableOriginal Table 2

Retro models may arguably benefit more easily from evaluation dataset leakage, i.e. the fact that we evaluate on data that were also present in the training set. To better understand how retrieval improves language modelling performance, we therefore quantify evaluation likelihood as a function of the overlap between the evaluation and training datasets.

The following approach can be used with any language model, and depends only on the frozen retriever system presented in §2.3. We split the evaluation sequences (Xi)i{(X_{i})}_{i} into chunks of length m≤64m\leq 64, and we see the training data as a set of chunks C\mathcal{C}. For each evaluation chunk C∈CC\in\mathcal{C}, we retrieve the 10 closest neighbours (of length up to 128) in the training data. We then compute the longest token substring common to both the evaluation chunk and its neighbours. This gives a number s∈[0,m]s\in[0,m]. The value r(C)=smr(C)=\frac{s}{m}, ranging from 00 (chunk never seen) to 11 (chunk entirely seen), gives a reliable indication of how much overlap there is between the evaluation chunk and the training data. For a given model, we then obtain the log-likelihood ℓ(C)\ell(C) of each chunk CC, and the number of bytes N(C)N(C) it encodes. We then consider the filtered bits-per-bytes of the model:

∀ α∈[0,1],Cα≜{C∈C,r(C)⩽α},bpb(α)≜∑C∈Cαℓ(C)∑C∈CαN(C),\forall\,\alpha\in[0,1],\quad\mathcal{C}_{\alpha}\triangleq\{C\in\mathcal{C},r(C)\leqslant\alpha\},\quad\textrm{bpb}(\alpha)\triangleq\frac{\sum_{C\in\mathcal{C}_{\alpha}}\ell(C)}{\sum_{C\in\mathcal{C}_{\alpha}}N(C)},
(5)

which correspond to the bits-per-bytes on the set of chunks that overlap less than α %\alpha\>\% with the training chunks. Note that the full evaluation bit-per-bytes performance is recovered by bpb(1)\mathrm{bpb}(1). The function bpb(⋅)\textrm{bpb}(\cdot) allows us to evaluate the impact of evaluation leakage over predictive performance: for low α\alpha, bpb(α)\textrm{bpb}(\alpha) gives an indication on how the model performs on chunks that are entirely new; the slope of bpb(⋅)\textrm{bpb}(\cdot) shows how much the model exploits evaluation leakage.

We first review existing work on using retrieval for language modelling, and compare Retro to these works (see Table 3). As we train Retro models on a large dataset containing a substantial section of the internet, our work raises potential privacy, safety, and fairness issues that we then review.

Table 3
# Retrieval tokensGranularityRetriever trainingRetrieval integration
Continuous CacheO(103)\mathcal{O}\left(10^{3}\right)TokenFrozen (LSTM)Add to probs
kNN-LMk\textrm{NN-LM}O(109)\mathcal{O}\left(10^{9}\right)TokenFrozen (Transformer)Add to probs
SpalmO(109)\mathcal{O}\left(10^{9}\right)TokenFrozen (Transformer)Gated logits
DprO(109)\mathcal{O}\left(10^{9}\right)PromptContrastive proxyExtractive QA
RealmO(109)\mathcal{O}\left(10^{9}\right)PromptEnd-to-EndPrepend to prompt
RAGO(109)\mathcal{O}\left(10^{9}\right)PromptFine-tuned DprCross-attention
FiDO(109)\mathcal{O}\left(10^{9}\right)PromptFrozen DprCross-attention
Emdr2\textsc{Emdr}^{2}O(109)\mathcal{O}\left(10^{9}\right)PromptEnd-to-End (EM)Cross-attention
Retro (ours)O(1012)\mathbf{\mathcal{O}\left({10^{12}}\right)}ChunkFrozen (Bert)Chunked cross-attention
Table 3: Comparison of Retro with existing retrieval approaches.
View original tableOriginal Table 3

Brants et al. (2007) show that scaling the training data to trillions of tokens improves the machine translation performance of nn-gram models. More recently, GPT-2 (Radford et al., 2019), GPT-3 (Brown et al., 2020), and Jurassic-1 (Lieber et al., 2021) show that scaling up language models leads to massive improvements on many downstream tasks. At the same time, Carlini et al. (2021) demonstrate that large-scale language models can perfectly memorise parts of their training data, suggesting that enhancing models with retrieval may lead to further improvements. However, significant leakage between train and test datasets (Lee et al., 2021; Lewis et al., 2021) makes comparing and evaluating large models trained on large datasets difficult, especially once retrieval capabilities over the training dataset are added.

Historically, information retrieval for text relies on inverted index matching such as TF-IDF and BM25 (Robertson and Zaragoza, 2009). Foundational work use latent topic modelling approaches like LDA (Blei et al., 2003) to identify relevant neighbours (Wei and Croft, 2006). Work in machine translation such as Zhang et al. (2018) and Gu et al. (2018) retrieve translation pairs based on edit distance between source sentences and guide the translation output using the closest retrieved target sentences. The retrieval database may also be structured — for example, Ahn et al. (2016) use a symbolic knowledge graph to improve an RNN language model.

With the success of deep learning, retrieving systems have partly switched to dense learned representations based on a neural network’s activations. Continuous cache (Grave et al., 2017) adds probability mass to tokens for which previous activations resemble the current activation vector, extending the model’s context to the local history. kNN-LMk\textrm{NN-LM} (Khandelwal et al., 2020) applies this idea to transformers and extends the retrieval database to English Wikipedia, resulting in substantial improvements on Wikitext103 evaluation. Continuous cache and kNN-LMk\textrm{NN-LM} do not modify the underlying neural-network models, but interpolate at inference between the language model’s output and distributions computed from retrieved tokens. These methods can therefore be plugged into any model without additional training, although this limits the model’s ability to reason about the retrieved text. Spalm (Yogatama et al., 2021) addresses this limitation by adding an extra gating network to post-process the retrieved data; yet most of the network is unaffected by the retrieval during inference.

The retrieval representations may be trained directly instead of relying on a pre-trained model—retriever systems have been developed for this purpose, primarily on open-domain question answering. For example, Dpr (Karpukhin et al., 2020) trains two Bert models (for queries and keys respectively) using a contrastive loss to align the representations of a question and of its answers. Lee et al. (2019) use an inverse cloze task to find semantic representations of passages for retrieval. These works differs from continuous cache and kNN-LMk\textrm{NN-LM} in that they embeds passages (or chunks) of text together, as opposed to each token individually. The retriever network is trained in isolation of the downstream task that uses the retrieval data. This potential issue is specifically addressed by Realm (Guu et al., 2020), which trains the retrieval system end-to-end to maximize the final training cross-entropy. This comes with the extra complexity of searching the database during training and periodically updating the embedding table, severely limiting the scale at which it can operate. RAG (Lewis et al., 2020) and FiD (Izacard and Grave, 2021) build upon Dpr to set the state of the art on question answering benchmarks by training encoder-decoder transformer models. More recently, Emdr2\textsc{Emdr}^{2} (Sachan et al., 2021) extends FiD by using an expectation-maximization algorithm to train the retriever end-to-end and achieves state of the art results compared to similarly sized models.

In the open-domain dialogue setting, BlenderBot 2.0 (Komeili et al., 2021) learns to issue textual internet queries, outperforming dense retrieval methods when evaluated on a task measuring how close model responses are to those of humans. This involves collecting a dataset of human dialogues with associated search queries, which limits the scalability of this approach. Hashemi et al. (2020) introduce the Guided Transformer, a modified Transformer similar to Retro, for document retrieval and clarifying question selection. Although effective on question answering and other tasks with strong conditioning, none of these methods are designed to model arbitrary text sequences, in contrast with Retro.

Retro shares components with kNN-LMk\textrm{NN-LM} and Dpr in that it uses frozen retrieval representations. Retro models longer sequences than QA examples; this requires to reason at a sub-sequence level, and to retrieve different documents for the different chunks of a sequence. Similar to FiD, Retro processes the retrieved neighbours separately in the encoder, and assemble them in the chunked cross-attention. This differs from e.g. Realm, that prepends retrieved documents to the prompt. Using chunks allows for repeated retrieval whilst generating a sequence as opposed to retrieving only once based on the prompt alone. Furthermore, retrieval is done during the whole pre-training process in Retro, and is not simply plugged-in to solve a certain downstream task. Finally, previous methods based on dense query vectors use small models and retrieval datasets with less than 3B tokens (English Wikipedia). Table 3 summarizes the difference of Retro with existing approaches.

Bender et al. (2021); Weidinger et al. (2021) highlight several dangers of large language models. Those stem from their ability to memorise training data, their high training cost, the static nature of their training data (Lazaridou et al., 2021), their tendency of amplifying inherent biases in the training data, and their ability to generate toxic language (Gehman et al., 2020). In this section we inspect these dangers, focusing on how retrieval augmented language models may exacerbate or mitigate them.

Large language models can perfectly memorise parts of their training data (Carlini et al., 2021). When coupled with large training datasets gathered from the web or other sources, this has clear privacy and safety implications. Retrieval models such as Retro that have access to the entire training dataset during inference exacerbate these privacy issues by being able to directly copy training data. However, retrieval systems offer a path towards mitigating these concerns via obliteration of the retrievable data at inference time. In addition, differential privacy training (Abadi et al., 2016) of retrieval models could guarantee that no private information is stored in the model weights, while individualisation on private data could be made by updating the retrieval database at inference time.

Due to their high training cost, re-training large language model regularly to incorporate new data, languages, and norms is prohibitively expensive. To keep retrieval models up-to-date, it may be sufficient to update the retrieval database, which is orders of magnitude cheaper than re-training a model from scratch. In addition to the benefits of updating models in terms of fairness and bias, simply training large language models has a significant energy cost (Strubell et al., 2019; Schwartz et al., 2020). Retrieval mechanisms offer a path to reducing the compute requirements needed to train and update language models that reach a certain performance.

Large language models are prone to generating toxic outputs, as shown in Gehman et al. (2020). Bender et al. (2021); Jo and Gebru (2020) advocate for the importance of better training data curation and documentation. Additionally, if portions of the training data are found to be eliciting biased or toxic outputs after training, retrieval allows for some correction, as the offending retrieval data can be retroactively filtered. However, it is also the case that without careful analysis and intervention, retrieval models may exacerbate biases that are present in the training data. Retrieval models can also add a further source of bias through the selection mechanism for retrieval documents. Further work in this area is required to better understand how retrieval affects the bias and toxicity of the model outputs.

Finally, samples from large models are difficult to interpret, making mitigating these issues all the more challenging (Belinkov et al., 2020; Jain and Wallace, 2019). Retrieval provides more insights in to the outputs of a model, as one can directly visualise or modify the neighbours that are being used. The examples in Table 6, 7, 20 and 21 illustrate how retrieval makes language models more factual and interpretable by providing more transparent outputs.

We first report results on language modelling benchmarks. Second, we show how to Retrofit pre-trained Transformer language models into retrieval models with few additional FLOPs. Next, we report Retro results on question answering. Finally, we report evaluation metrics with leakage filtering, to better understand the source of the gains with retrieval.

We evaluate our models on C4 (Raffel et al., 2020), Wikitext103 (Merity et al., 2017), Curation Corpus (Curation, 2020), Lambada (Paperno et al., 2016) and the Pile (Gao et al., 2020). We also evaluate on a set of manually selected Wikipedia articles that were added or heavily edited in September 2021, months after our pre-training and retrieval dataset was collected (details are given in §A.2). We construct the dataset with articles from the “future” and manually remove new articles that strongly overlap documents in our training data. This guarantees that the evaluation documents are not leaked in our training data.

For C4, Wikitext103, the Pile, and our Wikipedia dataset we evaluate the language modelling performance on entire documents and measure the bits-per-byte (bpb). We favour bits-per-byte over loss as it is tokenizer agnostic. We evaluate with a sequence length of 2048 tokens but use a stride of 1024 within documents to mitigate boundary effects. On Curation Corpus we concatenate the article, the “TL;DR:” string, and the summary, but only evaluate the bpb on the summary. For Lambada we evaluate the accuracy on the last word, using greedy generation.

In Fig. 1(left) and Fig. 3 we show the language modelling performance as we scale models from 150 million to 7 billion (non-embedding) parameters. We see that on all datasets, Retro outperforms the baseline at all model sizes. Furthermore, we observe that improvements do not diminish as we scale the models. The performance is dataset dependent, with the largest gains on Wikitext103 and C4. Wikipedia articles and other web pages are similar to Wikitext103 documents, even if not exact copies (§4.4), we thus obtain dramatic improvements on Wikitext103 as our retrieval model is able to directly exploit these overlaps. The smallest gains are for Curation Corpus, where Retro only slightly outperforms the baseline. This is expected as Curation Corpus summaries are designed to only contain information from the source article and are not included in our retrieval database. On our “future” Wikipedia September 2021 dataset, we also observe consistent gains for all model sizes.

Figure 3
Figure 3: Scaling with respect to model size. (a) LAMBADA top-1 accuracy. (b) Evaluation loss on curation corpus. (c) Perplexity on Wikitext103 valid. (d) Bits-per-byte on selected Wikipedia articles from September 2021.

Fig. 1 (middle) shows how scaling the retrieval database at evaluation improves the language modelling performance. We observe dramatic gains as the retrieval data is increased from Wikipedia (4 billion tokens) to all of Massive text (1.7T tokens). Fig. 1(right) shows how performance scales as we increase the number of retrieved chunks. Despite being only trained with 2 neighbours, we see consistent improvements for all models when the number of neighbours is increased from 1 to 10. Furthermore, we observe that larger models are able to better utilise more neighbours: the 172M model improves with up to 10 neighbours, whereas the 7B model improves with up to 40 neighbours.

We evaluate our 7B models on the Pile test sets3^{3} and compare against the 178B parameter Jurrasic-1 (Lieber et al., 2021) model and the 280B parameter Gopher (Rae et al., 2021) model. We do not compare against GPT-3 as it is outperformed by Jurassic-1 and Gopher on almost all subsets. Fig. 4 shows the relative improvements in bits-per-byte over our 7B transformer baseline for our 7.5B Retro model, Jurassic-1 and Gopher. Jurassic-1 outperforms the baseline on all datasets except for books, likely due to the inclusion of books in our training data. Gopher and Retro outperform the baseline on all test sets. Overall, Retro 7.5B outperforms Jurassic-1 and Gopher on a majority of the test sets. On the dm_mathematics and ubuntu_irc subsets, our Retro model does not outperform our 7B baseline and underperforms Jurassic-1. We hypothesise that the retrieved neighbours on these datasets are not helpful, due to a combination of what is in our retrieval dataset and the efficacy of the nearest-neighbour search.

Figure 4
Figure 4: The Pile: Comparison of our 7B baseline against Jurassic-1, Gopher, and Retro. We observe that the retrieval model outperforms the baseline on all test sets and outperforms Jurassic-1 on a majority of them, despite being over an order of magnitude smaller.
Table 4
ModelRetrieval Set#Database tokens#Database keysValidTest
Adaptive Inputs (Baevski and Auli, 2019)---17.9618.65
Spalm (Yogatama et al., 2021)Wikipedia3B3B17.2017.60
kNN-LMk\textrm{NN-LM} (Khandelwal et al., 2020)Wikipedia3B3B16.0616.12
Megatron (Shoeybi et al., 2019)----10.81
Baseline transformer (ours)---21.5322.96
kNN-LMk\textrm{NN-LM} (ours)Wikipedia4B4B18.5219.54
RetroWikipedia4B0.06B18.4618.97
RetroC4174B2.9B12.8710.23
RetroMassiveText (1%)18B0.8B18.9220.33
RetroMassiveText (10%)179B4B13.5414.95
RetroMassiveText (100%)1792B28B3.213.92
Table 4: Perplexities on Wikitext103. When using the Wikpedia dataset for retrieval, Retro performs similarly to our implementation of kNN-LMk\textrm{NN-LM}. As we scale the retrieval dataset, Retro performs much better. The perplexities for retrieving from full MassiveText are quite low, which is partly due to partial overlap with Wikitext103 not caught by our deduplication.
View original tableOriginal Table 4

To validate our approach in a controlled setting, we compare our method with kNN-LMk\textrm{NN-LM} (Khandelwal et al., 2020) on the Wikitext103 dataset in Table 4. We train a baseline transformer on the training set of Wikitext103. This transformer has 24 layers, 1024 hidden units, 16 heads and a key size of 64, as in Baevski and Auli (2019). Our baseline does not have adaptive input, and our tokenizer has an open vocabulary, unlike Baevski and Auli (2019), which makes our baseline perplexities a bit higher. The full experiment details and hyperparameters are given in §C.2 and Table 11.

We re-implement kNN-LMk\textrm{NN-LM} with our tokenizer and baseline transformer to produce embeddings of size 1024 for every token in Wikitext103. kNN-LMk\textrm{NN-LM} has probabilities pkNN-LM=λpkNN+(1−λ)pLmp_{k\textrm{NN-LM}}=\lambda p_{k\textrm{NN}}+(1-\lambda)p_{\textsc{Lm}} with pkNN(nk)∝exp⁡(−αdk)p_{k\textrm{NN}}\left(n_{k}\right)\propto\exp\left(-\alpha d_{k}\right). We tune λ=0.118\lambda=0.118 and α=0.00785\alpha=0.00785 on the validation set (Fig. 7) and report performance for these hyperparameters on both the validation and test set.

We fine-tune our baseline transformer into a Retro model (Fig. 7), using the Wikitext103 training data and retrieving from Wikipedia with 2 neighbours. We only train the new weights, as explained in §4.2, and share the embedding weights between the encoder and the main pathway. This is necessary for Wikitext103 which is quite small, as training Retro from scratch in this setting leads to over-fitting.

We evaluate the fine-tuned Retro model with different retrieval sets. We use 10 neighbours at evaluation for both Retro and kNN-LMk\textrm{NN-LM}. When retrieving from Wikipedia, we obtain results comparable to our kNN-LMk\textrm{NN-LM} implementation. Furthermore, scaling the retrieval database to MassiveText yields dramatic improvements, though this is partly due to leakage (see §4.4). For reproducibility, we also include results when retrieving from C4, which are close to previous state-of-the-art and comparable to using 10 % of MassiveText.

It is worth noting that kNN-LMk\textrm{NN-LM} requires 1024 floats for every token in the retrieval dataset, totalling 15 terabytes (Tb) for the 4 billion tokens in Wikipedia. kNN-LMk\textrm{NN-LM} and other token-level retrieval approaches therefore don’t scale to retrieval databases with trillions of tokens such as MassiveText. In comparison, Retro only requires 215Gb to index our Wikipedia dataset, and 93Tb for MassiveText. Inspecting the number of retrieval database entries in Table 4 makes it clear why retrieving at the chunk level is necessary when scaling to datasets with trillions of tokens.

We extend baseline models into Retro models by freezing the pre-trained weights and training only chunked cross-attention and neighbour encoder parameters (less than 10% of weights for the 7B model) in Fig. 5. This offers an efficient alternative path to enhance transformers with retrieval, requiring only 6 million sequences (3% of the pre-training sequences that we used). Additionally, by only training the new weights we ensure that when evaluated without retrieval, the original model performance is exactly maintained. Retrofitting models quickly surpasses the performance of baseline models and even achieves performance close to that of Retro models trained from scratch. The experiment hyperparameters are given in §C.3.

Figure 5
Figure 5: Retro-fitting a baseline transformer. Any transformer can be fine-tuned into a retrieval-enhanced transformer by randomly initializing and training only the chunked cross-attention and retrieval encoder weights. Fine-tuning in this way quickly recovers and surpasses the non-retrieval performance, and almost achieves the same performance as training a retrieval model from scratch (shown by the arrow on the right hand side of each plot). We find good performance Retro-fitting our models training on only 3% the number of tokens seen during pre-training.

We fine-tune our retrieval models on the Natural Questions (Kwiatkowski et al., 2019) dataset to demonstrate that our retrieval pathway can be used to inject information from arbitrary data sources. We use the version4^{4} provided by Izacard and Grave (2021) which is augmented with the retrieved passages from Dpr (Karpukhin et al., 2020). We fine-tune all the weights of our 7.5B pre-trained Retro model for 25,000 steps using the top 20 retrieved passages. We format the data as “question: {question} \n answer: {answer}” and left pad the data such that “answer:” coincides with the end of the first chunk of 64 tokens and thus aligns with the first retrieving chunk. The model has access to the question via the previous tokens in the sequence as well as the top 20 DPR Wikipedia passages and their titles via the chunked cross-attention mechanism. The exact match scores are shown in Table 5 and the full fine-tuning details are given in §C.4. Our method is competitive with previous approaches such as Realm, RAG and Dpr, but underperforms the more recent FiD. In contrast with this work, we find that increasing the number of neighbours past 20 does not improve Retro performance on this task. We hypothesise that the encoder-decoder structure of T5—the base model in FiD— and the T5 pre-training objective leads to a model that relies more on the encoder output than Retro, which is important in the QA setting. To compete with T5-finetuned models, future work should consider ways of forcing Retro to rely further on the retrieval encoder output when producing tokens.

Table 5
ModelTest Accuracy
Realm (Guu et al., 2020)40.4
Dpr (Karpukhin et al., 2020)41.5
RAG (Lewis et al., 2020)44.5
Emdr2\textsc{Emdr}^{2} (Sachan et al., 2021)52.5
FiD (Izacard and Grave, 2021)51.4
FiD + Distill. (Izacard et al., 2020)54.7
Baseline 7B (closed book)30.4
Retro 7.5B (DPR retrieval)45.5
Table 5: Question answering results. Exact match accuracy on Natural Questions.
View original tableOriginal Table 5

We report the filtered eval losses as detailed in §2.6 on C4, Curation Corpus and Wikitext103 in Fig. 6. On C4 and Wikitext103, for which there is leakage into the training set, the slope is negative for both baseline models and Retro models. Retro models exploit leakage more strongly than baseline models, as indicated by the more negative slope. This is due to its explicit ability to copy-paste existing training chunks to predict leaked evaluation chunks (see a qualitative example of this model behavior on a Wikitext103 article in Table 19). On Curation Corpus, retrieval provides a constant offset, which is expected as there is by design no leakage between Curation Corpus and the training dataset.

On the other hand, Retro outperforms baseline models at all leakage levels, down to α=12.5%\alpha=12.5\%. At this level, the loss is computed on chunks with less than 88 contiguous tokens shared with the closest matching chunk in the training dataset—this is a reasonable level of overlap at which we consider that there is no local leakage. Retrieval thus improves predictions on both chunks that are syntactically similar to chunks in the training set, and on chunks that are syntactically different from all training chunks. This points toward a non trivial Retro capacity of generalizing based on both model parameters and retrieval database. Similar results are found on the Pile dataset (see Fig. 12, §F.3).

We show examples of samples obtained using the 7.5B Retro model in Table 6, Table 7 and Appendix E. For each chunk (the first one being the prompt), we juxtapose sampled chunks CuC_{u} with retrieved neighbours Ret(Cu)\textsc{Ret}(C_{u}). To give an indication of local overlap, we colour each sampled token in chunk CuC_{u} based on the length of the longest common prefix (LCP) found in the retrieved chunks Ret(Cu−1)\textsc{Ret}(C_{u-1}). Similarly, we colour the retrieved chunks based on the LCP in the sampled chunk. For the sample in Table 6, for which we chose the prompt, we observe that the retrieved chunks influence the sample as there are overlaps between the sampled tokens and neighbour tokens. Overall, retrieval reduces hallucinations (in line with the findings of Shuster et al. (2021)) and makes the model more knowledgeable, when comparing with samples produced with retrieval disabled. In the sample in Table 7, the model recognises that the prompt is the beginning of the first scene of Hamlet and leverages retrieval data to continue it with only a few mistakes. We provide further examples in Appendix E, including examples from the evaluation sets, as well as the detailed procedure used for colouring the tables.

Figure 6
Figure 6: Performance vs. longest common retrieval substring. Evaluation loss as a function of allowed longest common substring between evaluation data chunks and their nearest neighbours. Retrieval still helps when considering chunks with no more than 8 contiguous tokens overlapping with training dataset chunks.

We present Retrieval-Enhanced Transformers (Retro), a method for modelling arbitrary text sequences whilst retrieving from databases with trillions of tokens—scaling the data available to models by an order of magnitude compared to what is typically consumed during training. Retro models gains do not diminish for models with up to at least 7B parameters, and correspond to non-retrieval models with 10×\times more parameters on certain datasets. On Wikitext103 and the Pile, Retro outperforms previous models trained on large scale datasets. We also show that Retro is competitive on retrieval-intensive downstream tasks such as question answering.

Retro models are flexible and can be used without retrieval at evaluation and still achieve comparable performance to baseline models. Conversely, baseline models can be rapidly fine-tuned into Retro models to obtain nearly the same performance as if trained from scratch. Careful analysis shows that only a modest fraction of the gains obtained by Retro are due to test set leakage. In general, we caution for such leakage in large-scale language datasets and suggest further work in better understanding the role of test set leakage in the performance of large-scale language models.

Overall, our work demonstrates at an unprecedented scale that semi-parametric approaches can provide an orthogonal, more efficient approach than raw parameter scaling as we seek to build more powerful language models.

We would like to thank Nikolai Grigorev, Marc’aurelio Ranzato, Cyprien de Masson d’Autume, Po-Sen Huang, Johannes Welbl, Lisa Anne Hendricks, Ethan Perez, Jeff Stanway, Eric Noland, Gregory Wayne, John Jumper, Julian Schrittwieser, Lorrayne Bennett, Devang Agrawal, Dani Yogatama, Susannah Young, Nando de Freitas, Demis Hassabis, and Koray Kavukcuoglu for their help, advice and reviews. Additionally, we would like to thank Zonglin Li, David Simcha, and the ScaNN developers for their help.

Table 6
Prompt and sample of Retro[Off]Prompt and sample of Retro[On][Nu1,Fu1][N_{u}^{1},F_{u}^{1}] colored by LCP with Cu+1C_{u+1}[Nu2,Fu2][N_{u}^{2},F_{u}^{2}] colored by LCP with Cu+1C_{u+1}
colored by LCP with Ret(Cu−1)\textsc{Ret}(C_{u}{-1})
LCP=\textrm{LCP}= 00, 11, 22, 33,44,⩾5\geqslant 5LCP=\textrm{LCP}= 00, 11, 22, 33,44,⩾5\geqslant 5LCP=\textrm{LCP}= 00, 11, 22, 33,44,⩾5\geqslant 5
Beavers are interesting animals thatBeavers are interesting animals that.Beavers build their lodges in ponnaw them into smaller sections and d
live near rivers. They buildlive near rivers. They buildds they have created in wooded areasrag them into the water.Engineers
.Like many things in nature, thereof the Pond Beavers are interesting
is a connection between creatures ianimals because they change the hab
n the wild.Beaver ponds cause treeitat in which they live. Beavers do
s to drown, but the dead trees attrathis by blocking up streams to creat
ct the great blue heron, which oftene ponds. Then they build their homes
return year after year. Over time,, called lodges, in these ponds. Bea
a beaver pond can attract more thanvers’ bodies make them well-suited f
50 nests in a colony, called a rookeor underwater building Special muscl
ry.An example of this can be foundes close off their noses, ears, and
in the large pond off Bradford Roadthroats to keep the water out. Beave
at Carter Fields near the Boxford lrs’ broad tails act like rudders for
ine.Chris Leahy, an expert with thsteering. Their two very large, ora
e Massachusetts Audubon Society whonge front teeth are used to gnaw dow
wroten trees. They begin building their d
am
dams to create ponds. Frogs are amtheir houses called beaver dams in, then they mean that you are very bar-like tail, and two protruding tee
phibians, so they can live in both lthe riverbeds. They also live on lanusy. Beavers swim easily in streams,th that are strong enough to gnaw do
and and water. They have great camoud.Beavers use their strong teeth anpicking up rocks and sticks to builwn trees. The beaver uses trees, bra
flage to hide from predators. The Gd strong jaws to cut down trees andd their dams. They gnaw at trees witnches, and mud to build dams across
olden Retriever, or Golden, is a verbranches to build their homes. Theyh their big front teeth to cut themrivers and streams. These dams creat
y big dog. They are very strong, andalso use their teeth and jaws to chedown. Then they use parts of the tree a deep pool of water in which the
have a thick coat to help them livew up food. Beavers use their big, fles to build their houses.Beavers arbeaver builds its home. A beaver hom
inat tails to swim. They usee clever builders. They know exactlye is called a lodge. A baby beaver o
what they need to build their beaver “kit” remains in the family lodge
r dams. They use mud from the streamuntil the age of two.Beaver fur, kn
to make their dams stay together. Town as pelt, was once highly popular
hey use their tails to pat down theas a trim for hats and coats. How m
mud.Beavers put a snug room at theight the popularity of beaver fur co
top of their dams for their babies.ntributed to the colonization of New
They store their food underwater. BeYork?wwwWw
avers eat the bark from the
cold areas. A kangaroo is an animatheir sharp teeth to gnaw at rocks, then they mean that you are very bw at trees with their big front teet
l that is very large. It can jump veand cut trees. They use their flat tusy. Beavers swim easily in streams,h to cut them down. Then they use pa
ry high. They can run very fast. Aails to steer when they are swimmingpicking up rocks and sticks to builrts of the trees to build their hous
meerkat is a small animal that lives.In the winter, beavers have to buid their dams. They gnaw at trees wites.Beavers are clever builders. The
in Africa. They live in colonies ofld a house called a beaver lodge. Thh their big front teeth to cut themy know exactly what they need to bui
up to a hundred of them. They can cey build a house that is very strongdown. Then they use parts of the treld their beaver dams. They use mud f
limb trees very easily.. The walls are made of twigs. The res to build their houses.Beavers arrom the stream to make their dams st
oof is madee clever builders. They know exactlyay together. They use their tails to
what they need to build their beavepat down the mud.Beavers put a snu
r dams. They use mud from the streamg room at the top of their dams for
to make their dams stay together. Ttheir babies. They store their food
hey use their tails to pat down theunderwater. Beavers eat the bark fro
mud.Beavers put a snug room at them the trees that they cut down!1. W
top of their dams for their babies.hat is the main idea of the first pa
They store their food underwater. Beragraph?.2. What is the main idea o
avers eat the bark from thef the second paragraph?
A mouse is a small mammal that livesof branches and other tree parts. T
on land. It is a very good climberhey also use their strong jaws to cu
and it can run very fast. Penguinst trees. They bring them to their ho
are birds that live on Antarctica. Tuse. They also use their sharp teeth
hey have a thick coat to keep them wto chew up the tree parts. They use
arm. Rabbits are small animals thattheir flat tails to swim to the top
live in the ground. Theyof their house. Then they use their
teeth and jaws to chew up the tree
Table 6: Sample - Beavers are interesting animals. The Retro[Off] sample quickly diverges to other animals while the Retro[On] sample tends to stay focused on the beaver topic due to neighbour conditioning.
View original tableOriginal Table 6
Table 7
Prompt and sample of Retro[Off]Prompt and sample of Retro[On][Nu1,Fu1][N_{u}^{1},F_{u}^{1}] colored by LCP with Cu+1C_{u+1}[Nu2,Fu2][N_{u}^{2},F_{u}^{2}] colored by LCP with Cu+1C_{u+1}
colored by LCP with Ret(Cu−1)\textsc{Ret}(C_{u}{-1})
LCP=\textrm{LCP}= 00, 11, 22, 33,44,⩾5\geqslant 5LCP=\textrm{LCP}= 00, 11, 22, 33,44,⩾5\geqslant 5LCP=\textrm{LCP}= 00, 11, 22, 33,44,⩾5\geqslant 5
ACT I SCENE I. Elsinore. A plaACT I SCENE I. Elsinore. A plaACT I SCENE I. Elsinore. A pla><TEXT>ACT I SCENE I. Elsin
tform before the castle. FRANCtform before the castle. FRANCtform before the castle. (FRANore. A platform before the cas
ISCO at his post. Enter to himISCO at his post. Enter to himCISCO at his post. Enter to hitle. FRANCISCO at his post. E
BERNARDO BERNARDO Who’s thereBERNARDO BERNARDO Who’s therem BERNARDO) BERNARDO Who’s thenter to him BERNARDO BERNARDO
? FRANCISCO Nay, answer me: st? FRANCISCO Nay, answer me: stre? FRANCISCO Nay, answer me:Who’s there? FRANCISCO Nay, an
and, and unfold yourself. BERNand, and unfold yourself. BERNstand, and unfold yourself. BEswer me: stand, and unfold you
ARDOARDORNARDO Long live the king! FRArself. BERNARDO Long live the
NCISCO Bernardo? BERNARDO He.king! FRANCISCO Bernardo? BERN
FRANCISCO You come most carefuARDO He. FRANCISCO You come mo
lly upon your hour. BERNARDO ’st carefully upon your hour. B
Tis now struck twelve; get theERNARDO ’Tis now struck twelve
e to bed, Francisco. FRANCISCO; get thee to bed, Francisco.
For this relief much thanks:FRANCISCO For this relief much
’tis bitter cold, And I am sicthanks: ’tis bitter cold, And
k at heart. BERNARDO Have youI am sick at heart.
Who calls ? FRANCISCO I am thLong live the king! FRANCISCOLong live the king! FRANCISCOlive the king! FRANCISCO Bern
e lord here; I, Francisco, thaBernardo? BERNARDO He. FRANCIBernardo? BERNARDO He. FRANCIardo? BERNARDO He. FRANCISCO Y
t am sick of grief. [ Aside. BSCO You come most carefully upSCO You come most carefully upou come most carefully upon yo
ERNARDO The king ! FRANCISCO Ion your hour. BERNARDO ’Tis noon your hour. BERNARDO ’Tis nour hour. BERNARDO ’Tis now str
am sick of that also. BERNARDw struck twelve; get thee to bw struck twelve; get thee to buck twelve: get thee to bed, F
O My lord ? FRANCISCO Do not aed, Francisco. FRANCISCO For ted, Francisco. FRANCISCO For trancisco. FRANCISCO For this r
pproach me. BERNARDOhis relief much thanks: ’tis bhis relief much thanks: ’tis belief much thanks: ’tis bitter
itter cold, And I am sick at hitter cold, And I am sick at hcold, And I am sick at heart.
eart. Beart.</TEXT></DOC><DOC><DOBERNARDO Have you had quiet g
CNO>romeo</DOCNO><TEXT>ACT Iuard? FRANCISCO Not a mouse st
PROLOGUE Two households, boirring. BERNARDO Well, good ni
th alike in dignity, In fair Vght. Ifyou do meet Horatio and
erona, where we lay our scene,Marcellus, The rivals2 of my
From ancient grudge break towatch, bid them make haste. FR
new mutiny,ANCISCO I think I hear them.—
Stand, ho! who is there? EN
Francisco, I would speak withERNARDO Have you had quiet guahad quiet guard? FRANCISCO NoARDO Have you had quiet guard?
you. FRANCISCO Approach me notrd? FRANCISCO Not a mouse stirt a mouse stirring. BERNARDO WFRANCISCO Not a mouse stirrin
, but speak. BERNARDO Your hanring. BERNARDO Well, good nighell, good night. If you do meeg. BERNARDO Well, good night.
d, your voice FRANCISCO I willt. If you do meet Horatio andt Horatio and Marcellus, The rIfyou do meet Horatio and Marc
not hear thee speak. BERNARDOMarcellus, The rivals of my waivals of my watch, bid them maellus, The rivals2 of my watch
Francisco, your hand, I entretch, bid them make haste. FRANke haste. FRANCISCO I think I, bid them make haste. FRANCIS
at thee. FRANCISCO Approach meCISCO I think I hear them. Stahear them. Stand, ho! Who’s thCO I think I hear them.— Stand
not. BERNARDO Francisco FRANCnd, ho! who is there? Enterere? (Enter HORATIO and MARCEL, ho! who is there? ENTER HORA
LUS) HORATIO Friends to this gTIO AND MARCELLUS. HORATIO Fri
round. MARCELLUS And liegemenends to this ground. MARCELLUS
to the Dane. FRANCISCO Give yoAnd liegemen to the Dane.3 FR
u good night. MARCELLUS O, farANCISCO Give you good night. M
ewell, honest soldier: Who hatARCELLUS O, farewell, honest s
h relieved you? FRANCISCO Bernoldier: Who hath relieved you?
ardo has my place. Give you goFRANCISCO Bernardo hath my pl
od night. (Exitace. Give you good night
ISCO Approach me not. BERNARDOHORATIO and MARCELLUS HORATIO
I have a letter FRANCISCO AppFriends to this ground. MARCE
roach me not. BERNARDO For theLLUS And liegemen to the Dane.
king. FRANCISCO Approach me nFRANCISCO Give you good night
ot. BERNARDO There’s no treaso. MARCELLUS O, farewell, hones
n in’t. FRANCISCO Approach met soldier: Who hath relieved y
not. BERNARDO I willou? FRANCISCO Bernardo hath my
place. Give you good night.
Table 7: Sample - Hamlet, Act 1, Scene 1. The Retro[Off] sample has correct syntax but is hallucinated, and ends with repetition of one character (FRANCISCO Approach me not). The Retro[On] sample is the correct continuation of the original text, and is robust to formatting differences between our prompt and the retrieved data.
View original tableOriginal Table 7

References

  1. Abadi et al. (2016) M. Abadi, A. Chu, I. Goodfellow, H. B. McMahan, I. Mironov, K. Talwar, and L. Zhang. Deep learning with differential privacy. In ACM SIGSAC Conference on Computer and Communications Security, 2016.
  2. Ahn et al. (2016) S. Ahn, H. Choi, T. Pärnamaa, and Y. Bengio. A neural knowledge language model. arXiv preprint arXiv:1608.00318, 2016.
  3. Baevski and Auli (2019) A. Baevski and M. Auli. Adaptive input representations for neural language modeling. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id=ByxZX20qFQ.Source
  4. Belinkov et al. (2020) Y. Belinkov, S. Gehrmann, and E. Pavlick. Interpretability and analysis in neural NLP. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics: Tutorial Abstracts, pages 1–5, Online, July 2020. Association for Computational Linguistics. 10.18653/v1/2020.acl-tutorials.1. URL https://aclanthology.org/2020.acl-tutorials.1.SourceSource
  5. Bender et al. (2021) E. M. Bender, T. Gebru, A. McMillan-Major, and S. Shmitchell. On the dangers of stochastic parrots: Can language models be too big? In ACM Conference on Fairness, Accountability, and Transparency, 2021.
  6. Blei et al. (2003) D. M. Blei, A. Y. Ng, and M. I. Jordan. Latent Dirichlet Allocation. Journal of Machine Learning Research, 3(Jan):993–1022, 2003. URL https://jmlr.csail.mit.edu/papers/v3/blei03a.html.Source
  7. Bradbury et al. (2018) J. Bradbury, R. Frostig, P. Hawkins, M. J. Johnson, C. Leary, D. Maclaurin, G. Necula, A. Paszke, J. V. der Plas, S. Wanderman-Milne, and Q. Zhang. JAX: composable transformations of Python+NumPy programs, 2018. URL http://github.com/google/jax.Source
  8. Brants et al. (2007) T. Brants, A. C. Popat, P. Xu, F. J. Och, and J. Dean. Large Language models in machine translation. In Joint Conference on Empirical Methods in Natural Language Processing and Computational Natural Language Learning, pages 858–867, 2007.
  9. Brown et al. (2020) T. Brown, B. Mann, N. Ryder, M. Subbiah, J. D. Kaplan, P. Dhariwal, A. Neelakantan, P. Shyam, G. Sastry, A. Askell, S. Agarwal, A. Herbert-Voss, G. Krueger, T. Henighan, R. Child, A. Ramesh, D. Ziegler, J. Wu, C. Winter, C. Hesse, M. Chen, E. Sigler, M. Litwin, S. Gray, B. Chess, J. Clark, C. Berner, S. McCandlish, A. Radford, I. Sutskever, and D. Amodei. Language models are few-shot learners. In Advances in Neural Information Processing Systems, 2020. URL https://proceedings.neurips.cc/paper/2020/file/1457c0d6bfcb4967418bfb8ac142f64a-Paper.pdf.Source
  10. Carlini et al. (2021) N. Carlini, F. Tramer, E. Wallace, M. Jagielski, A. Herbert-Voss, K. Lee, A. Roberts, T. Brown, D. Song, U. Erlingsson, A. Oprea, and C. Raffel. Extracting training data from large language models. Preprint, 2021.
  11. Consonni et al. (2019) C. Consonni, D. Laniado, and A. Montresor. Wikilinkgraphs: a complete, longitudinal and multi-language dataset of the wikipedia link networks. In AAAI International Conference on Web and Social Media, volume 13, 2019.
  12. Curation (2020) Curation. Curation corpus base, 2020.
  13. Dai et al. (2019) Z. Dai, Z. Yang, Y. Yang, J. Carbonell, Q. Le, and R. Salakhutdinov. Transformer-XL: Attentive language models beyond a fixed-length context. In Annual Meeting of the Association for Computational Linguistics, July 2019. URL https://aclanthology.org/P19-1285.Source
  14. Devlin et al. (2019) J. Devlin, M.-W. Chang, K. Lee, and K. Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Conference of the North American Chapter of the Association for Computational Linguistics, June 2019. URL https://aclanthology.org/N19-1423.Source
  15. Gao et al. (2020) L. Gao, S. Biderman, S. Black, L. Golding, T. Hoppe, C. Foster, J. Phang, H. He, A. Thite, N. Nabeshima, S. Presser, and C. Leahy. The Pile: An 800GB dataset of diverse text for language modeling. arXiv preprint arXiv:2101.00027, 2020.
  16. Gehman et al. (2020) S. Gehman, S. Gururangan, M. Sap, Y. Choi, and N. A. Smith. RealToxicityPrompts: Evaluating neural toxic degeneration in language models. In Conference on Empirical Methods in Natural Language Processing, Nov. 2020. URL https://aclanthology.org/2020.findings-emnlp.301.Source
  17. Grave et al. (2017) E. Grave, A. Joulin, and N. Usunier. Improving neural language models with a continuous cache. In International Conference on Learning Representations, 2017. URL https://openreview.net/forum?id=B184E5qee.Source
  18. Graves (2013) A. Graves. Generating sequences with recurrent neural networks. arXiv preprint arXiv:1308.0850, 2013.
  19. Gu et al. (2018) J. Gu, Y. Wang, K. Cho, and V. O. Li. Search engine guided neural machine translation. In AAAI Conference on Artificial Intelligence, 2018.
  20. Guo et al. (2020) R. Guo, P. Sun, E. Lindgren, Q. Geng, D. Simcha, F. Chern, and S. Kumar. Accelerating large-scale inference with anisotropic vector quantization. In International Conference on Machine Learning, 2020. URL https://arxiv.org/abs/1908.10396.Source
  21. Guu et al. (2020) K. Guu, K. Lee, Z. Tung, P. Pasupat, and M. Chang. Retrieval augmented language model pre-training. In International Conference on Machine Learning, 2020.
  22. Hashemi et al. (2020) H. Hashemi, H. Zamani, and W. B. Croft. Guided transformer: Leveraging multiple external sources for representation learning in conversational search. In Proceedings of the 43rd International ACM SIGIR Conference on Research and Development in Information Retrieval, pages 1131–1140, 2020.
  23. Hennigan et al. (2020) T. Hennigan, T. Cai, T. Norman, and I. Babuschkin. Haiku: Sonnet for JAX, 2020. URL http://github.com/deepmind/dm-haiku.Source
  24. Izacard and Grave (2021) G. Izacard and E. Grave. Leveraging passage retrieval with generative models for open domain question answering. In Conference of the European Chapter of the Association for Computational Linguistics, Apr. 2021. URL https://aclanthology.org/2021.eacl-main.74.Source
  25. Izacard et al. (2020) G. Izacard, F. Petroni, L. Hosseini, N. De Cao, S. Riedel, and E. Grave. A memory efficient baseline for open domain question answering. arXiv preprint arXiv:2012.15156, 2020.
  26. Jain and Wallace (2019) S. Jain and B. C. Wallace. Attention is not Explanation. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 3543–3556, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. 10.18653/v1/N19-1357. URL https://aclanthology.org/N19-1357.SourceSource
  27. Jo and Gebru (2020) E. S. Jo and T. Gebru. Lessons from archives: Strategies for collecting sociocultural data in machine learning. In Proceedings of the 2020 Conference on Fairness, Accountability, and Transparency, pages 306–316, 2020.
  28. Jozefowicz et al. (2016) R. Jozefowicz, O. Vinyals, M. Schuster, N. Shazeer, and Y. Wu. Exploring the limits of language modeling. arXiv preprint arXiv:1602.02410, 2016.
  29. Kaplan et al. (2020) J. Kaplan, S. McCandlish, T. Henighan, T. B. Brown, B. Chess, R. Child, S. Gray, A. Radford, J. Wu, and D. Amodei. Scaling laws for neural language models. CoRR, 2020. URL https://arxiv.org/abs/2001.08361.Source
  30. Karpukhin et al. (2020) V. Karpukhin, B. Oguz, S. Min, P. Lewis, L. Wu, S. Edunov, D. Chen, and W.-t. Yih. Dense passage retrieval for open-domain question answering. In Conference on Empirical Methods in Natural Language Processing, Nov. 2020. URL https://aclanthology.org/2020.emnlp-main.550.Source
  31. Khandelwal et al. (2020) U. Khandelwal, O. Levy, D. Jurafsky, L. Zettlemoyer, and M. Lewis. Generalization through memorization: Nearest neighbor language models. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id=HklBjCEKvH.Source
  32. Komeili et al. (2021) M. Komeili, K. Shuster, and J. Weston. Internet-augmented dialogue generation. arXiv preprint arXiv:2107.07566, 2021.
  33. Kudo and Richardson (2018) T. Kudo and J. Richardson. Sentencepiece: A simple and language independent subword tokenizer and detokenizer for neural text processing. arXiv preprint arXiv:1808.06226, 2018.
  34. Kwiatkowski et al. (2019) T. Kwiatkowski, J. Palomaki, O. Redfield, M. Collins, A. Parikh, C. Alberti, D. Epstein, I. Polosukhin, M. Kelcey, J. Devlin, K. Lee, K. N. Toutanova, L. Jones, M.-W. Chang, A. Dai, J. Uszkoreit, Q. Le, and S. Petrov. Natural Questions: a benchmark for question answering research. Transactions of the Association of Computational Linguistics, 7:452–466, Mar. 2019. URL https://aclanthology.org/Q19-1026.Source
  35. Lazaridou et al. (2021) A. Lazaridou, A. Kuncoro, E. Gribovskaya, D. Agrawal, A. Liska, T. Terzi, M. Gimenez, C. de Masson d’Autume, S. Ruder, D. Yogatama, K. Cao, T. Kociský, S. Young, and P. Blunsom. Pitfalls of static language modelling. CoRR, 2021. URL https://arxiv.org/abs/2102.01951.Source
  36. Lee et al. (2019) K. Lee, M.-W. Chang, and K. Toutanova. Latent Retrieval for Weakly Supervised Open Domain Question Answering. In Annual Meeting of the Association for Computational Linguistic, June 2019. URL http://arxiv.org/abs/1906.00300.Source
  37. Lee et al. (2021) K. Lee, D. Ippolito, A. Nystrom, C. Zhang, D. Eck, C. Callison-Burch, and N. Carlini. Deduplicating training data makes language models better. arXiv preprint arXiv:2107.06499, 2021.
  38. Lewis et al. (2020) P. Lewis, E. Perez, A. Piktus, F. Petroni, V. Karpukhin, N. Goyal, H. Küttler, M. Lewis, W.-t. Yih, T. Rocktäschel, S. Riedel, and D. Kiela. Retrieval-augmented generation for knowledge-intensive NLP tasks. In Advances in Neural Information Processing Systems, 2020. URL https://proceedings.neurips.cc/paper/2020/file/6b493230205f780e1bc26945df7481e5-Paper.pdf.Source
  39. Lewis et al. (2021) P. Lewis, P. Stenetorp, and S. Riedel. Question and answer test-train overlap in open-domain question answering datasets. In Conference of the European Chapter of the Association for Computational Linguistics, Apr. 2021. URL https://aclanthology.org/2021.eacl-main.86.Source
  40. Lieber et al. (2021) O. Lieber, O. Sharir, B. Lenz, and Y. Shoham. Jurassic-1: Technical details and evaluation. White Paper. AI21 Labs, 2021.
  41. Loshchilov and Hutter (2019) I. Loshchilov and F. Hutter. Decoupled weight decay regularization. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id=Bkg6RiCqY7.Source
  42. Merity et al. (2017) S. Merity, C. Xiong, J. Bradbury, and R. Socher. Pointer sentinel mixture models. In International Conference on Learning Representations, 2017. URL https://openreview.net/forum?id=Byj72udxe.Source
  43. Mikolov et al. (2010) T. Mikolov, M. Karafiát, L. Burget, J. Cernockỳ, and S. Khudanpur. Recurrent neural network based language model. Interspeech, 2(3):1045–1048, 2010.
  44. Paperno et al. (2016) D. Paperno, G. Kruszewski, A. Lazaridou, N. Q. Pham, R. Bernardi, S. Pezzelle, M. Baroni, G. Boleda, and R. Fernández. The LAMBADA dataset: Word prediction requiring a broad discourse context. In Annual Meeting of the Association for Computational Linguistics, Aug. 2016. URL https://aclanthology.org/P16-1144.Source
  45. Radford et al. (2019) A. Radford, J. Wu, R. Child, D. Luan, D. Amodei, and I. Sutskever. Language models are unsupervised multitask learners. Preprint, 2019.
  46. Rae et al. (2021) J. Rae, S. Borgeaud, T. Cai, K. Millican, J. Hoffmann, F. Song, J. Aslanides, S. Henderson, R. Ring, S. Young, E. Rutherford, T. Hennigan, J. Menick, A. Cassirer, R. Powell, G. van den Driessche, L. A. Hendricks, M. Rauh, P.-S. Huang, A. Glaese, J. Welbl, S. Dathathri, S. Huang, J. Uesato, J. Mellor, I. Higgins, A. Creswell, N. McAleese, A. Wu, E. Elsen, S. Jayakumar, E. Buchatskaya, D. Budden, E. Sutherland, K. Simonyan, M. Paganini, L. Sifre, L. Martens, X. L. Li, A. Kuncoro, A. Nematzadeh, E. Gribovskaya, D. Donato, A. Lazaridou, A. Mensch, J.-B. Lespiau, M. Tsimpoukelli, N. Grigorev, D. Fritz, T. Sottiaux, M. Pajarskas, T. Pohlen, Z. Gong, D. Toyama, C. de Masson d’Autume, Y. Li, T. Terzi, V. Mikulik, I. Babuschkin, A. Clark, D. de Las Casas, A. Guy, J. Bradbury, M. Johnson, B. Hechtman, L. Weidinger, I. Gabriel, W. Isaac, E. Lockhart, S. Osindero, L. Rimell, C. Dyer, O. Vinyals, K. Ayoub, J. Stanway, L. Bennett, D. Hassabis, K. Kavukcuoglu, and G. Irving. Scaling language models: Methods, analysis & insights from training Gopher. arXiv submission, 2021.
  47. Raffel et al. (2020) C. Raffel, N. Shazeer, A. Roberts, K. Lee, S. Narang, M. Matena, Y. Zhou, W. Li, and P. J. Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of Machine Learning Research, 21(140):1–67, 2020. URL http://jmlr.org/papers/v21/20-074.html.Source
  48. Rajbhandari et al. (2020) S. Rajbhandari, J. Rasley, O. Ruwase, and Y. He. Zero: Memory optimizations toward training trillion parameter models. In IEEE International Conference for High Performance Computing, Networking, Storage and Analysis, 2020.
  49. Robertson and Zaragoza (2009) S. Robertson and H. Zaragoza. The probabilistic relevance framework: BM25 and beyond. Foundations and Trends in Information Retrieval, 3:333–389, Jan 2009.
  50. Sachan et al. (2021) D. S. Sachan, S. Reddy, W. Hamilton, C. Dyer, and D. Yogatama. End-to-end training of multi-document reader and retriever for open-domain question answering. arXiv preprint arXiv:2106.05346, 2021.
  51. Schwartz et al. (2020) R. Schwartz, J. Dodge, N. A. Smith, and O. Etzioni. Green AI. Communications of the Association for Computing Machinery, 63(12):54–63, Nov. 2020.
  52. Shoeybi et al. (2019) M. Shoeybi, M. Patwary, R. Puri, P. LeGresley, J. Casper, and B. Catanzaro. Megatron-LM: Training multi-billion parameter language models using model parallelism. CoRR, 2019. URL http://arxiv.org/abs/1909.08053.Source
  53. Shuster et al. (2021) K. Shuster, S. Poff, M. Chen, D. Kiela, and J. Weston. Retrieval augmentation reduces hallucination in conversation. arXiv:2104.07567 [cs], Apr. 2021. URL http://arxiv.org/abs/2104.07567.Source
  54. Strubell et al. (2019) E. Strubell, A. Ganesh, and A. McCallum. Energy and policy considerations for deep learning in NLP. In Association for Computational Linguistics, July 2019. URL https://aclanthology.org/P19-1355.Source
  55. Vaswani et al. (2017) A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, L. u. Kaiser, and I. Polosukhin. Attention is all you need. In Advances in Neural Information Processing Systems, 2017. URL https://proceedings.neurips.cc/paper/2017/file/3f5ee243547dee91fbd053c1c4a845aa-Paper.pdf.Source
  56. Wei and Croft (2006) X. Wei and W. B. Croft. LDA-based document models for ad-hoc retrieval. In ACM SIGIR International Conference on Research and Development in Information Retrieval, 2006. URL http://portal.acm.org/citation.cfm?doid=1148170.1148204.Source
  57. Weidinger et al. (2021) L. Weidinger, I. Gabriel, C. Griffin, M. Rauh, J. Uesato, J. Mellor, W. Isaac, P.-S. Huang, L. A. Hendricks, M. Cheng, B. Balle, J. Haas, C. Biles, L. Rimell, W. Hawkins, M. Glaese, A. Kasirzadeh, Z. Kenton, S. Brown, A. Birhane, T. Stepleton, G. Irving, and S. Legassick. Ethical and social risks of harm from language models. arXiv submission, 2021.
  58. Yogatama et al. (2021) D. Yogatama, C. de Masson d’Autume, and L. Kong. Adaptive semiparametric language models. Transactions of the Association for Computational Linguistics, 9:362–373, 2021.
  59. Zhang and Sennrich (2019) B. Zhang and R. Sennrich. Root mean square layer normalization. In Advances in Neural Information Processing Systems, 2019. URL https://proceedings.neurips.cc/paper/2019/file/1e8a19426224ca89e83cef47f1e7f53b-Paper.pdf.Source
  60. Zhang et al. (2018) J. Zhang, M. Utiyama, E. Sumita, G. Neubig, and S. Nakamura. Guiding neural machine translation with retrieved translation pieces. In Conference of the North American Chapter of the Association for Computational Linguistics, 2018.

We provide a full description of MassiveText and of our extract of recent Wikipedia articles.

The full break down of MassiveText by source and languages is given in Table 8. For a full description and analysis of MassiveText, see Rae et al. (2021).

Table 8
SourceLanguageToken count (M)DocumentsSampling weight
WebEn483,002604,938,8160.314
Ru103,95493,004,8820.033
Es95,762126,893,2860.033
Zh95,152121,813,4510.033
Fr59,45076,612,2050.033
De57,54677,242,6400.033
Pt44,56162,524,3620.033
It35,25542,565,0930.033
Sw2,2461,971,2340.0044
Ur631455,4290.0011
BooksEn3,423,74020,472,6320.25
NewsEn236,918397,852,7130.1
WikipediaEn3,9776,267,2140.0285
De2,1553,307,8180.003
Fr1,7832,310,0400.003
Ru1,4112,767,0390.003
Es1,2702,885,0130.003
It1,0712,014,2910.003
Zh9271,654,7720.003
Pt6141,423,3350.003
Ur61344,8110.0001
Sw1558,0900.0004
Github-374,952142,881,8320.05
Total-5,026,4631,792,260,9981
Table 8: MassiveText dataset. The final column indicates the sampling weight for each dataset during training. For the retrieval database, the entire dataset is used, with the exception of books for which we use a sub-sample of 4%.
View original tableOriginal Table 8

Table 9
Megan RohrerAakashavaani
Emma RaducanuJunior Eurovision Song Contest 2021
Ambra SabatiniPavilion Bukit Jalil
WhyDonateBlake Desjarlais
The Juggernaut (company)2021 All-Ireland Senior Football Championship Final
Angela DiazDrift-barrier hypothesis
2020 Summer ParalympicsVenomics
2021 Afghan protestsGreat Circle (novel)
Rexh XhakliHurricane Ida
Julia Laskin2021 Montenegrin episcopal enthronement protests
CuijkAt War With the Silverfish
Ghoubet Wind Power Station
Table 9: Full set of articles included in our Wikipedia Sept. 2021 evaluation dataset.
View original tableOriginal Table 9

We create an evaluation dataset consisting of 23 Wikipedia articles that were added or heavily edited in September 2021, after we collected our training dataset. In addition, we filter out articles that rely too heavily on templated content, using the method detailed in §2.6 to identify articles with chunks that have a high overlap with their neighbours. Fig. 10 show that little overlap remains between our test dataset and the retrieved neighbours from the training dataset. The full list of included articles is given in Table 9.

We first parse articles using mwparserfromhell5^{5}. We then remove sections with the following titles: “references”, “external links”, “sources”, “further reading”, “see also”, “citations”, and “note”. In the remaining sections, we remove Wikilinks and remove the following templates: “reflist”, “notelist”, “notelist-ua”, “notelist-lr”, “notelist-ur”, and “notelist-lg”. We also exclude objects with the “ref” or “table” tag and clean the remaining text with the strip_code function. Finally, we concatenate the title and all the sections and use \n\n to delimitate them.

We give details on the Retro architecture, and on the fine-tuning procedure we use for Retrofitting existing language models.

As mentioned in the main text, the overall encoder-decoder architecture is fully feed-forward. We start with a sequence X∈Vn=(Cu)1⩽u⩽lX\in\mathbb{V}^{n}={(C_{u})}_{1\leqslant u\leqslant l}, and its pre-computed neighbours (Ret(Cu))1⩽u⩽l{(\textsc{Ret}(C_{u}))}_{1\leqslant u\leqslant l} and returns logits in Rn×∣V∣\mathbb{R}^{n\times|\mathbb{V}|}. Along with Attn, Ffw, Cca and Ca operators introduced in the main text, we define the decoder embedding layer Emb:Vn→Rn×d\textsc{Emb}:\mathbb{V}^{n}\to\mathbb{R}^{n\times d}, the Split operator that extracts chunked intermediary embeddings Split(H)≜(Hu)1⩽u⩽l∈Rl×m×d\textsc{Split}(H)\triangleq{(H_{u})}_{1\leqslant u\leqslant l}\in\mathbb{R}^{l\times m\times d} and the read-out layer Read:Rn×d→Rn×∣V∣\textsc{Read}:\mathbb{R}^{n\times d}\to\mathbb{R}^{n\times|\mathbb{V}|}. We then describe the forward pass in Algorithm 1. In addition to the usual Transformer ones, Retro architecture hyperparameters involves the layer indices PencP_{\textrm{enc}} and PP, at which the encoder and the decoder perform cross-attention.

The Ca operator uses relative positional logits, that are computed from a specific relative distance separating data tokens from retrieval tokens. Indeed, we expect any retrieval neighbour Ret(Cu)j\textsc{Ret}(C_{u})^{j} and the chunk CuC_{u} to be relatively well aligned, and assume that they start at the same position. Therefore, when computing Ca(Hu+,Eu)\textsc{Ca}(H_{u}^{+},E_{u}), we set the distance between the data token i∈[1,l]i\in[1,l] of chunk Cu+C_{u}^{+} and the retrieval token i′∈[1,2l]i^{\prime}\in[1,2l] of Ret(Cu)j\textsc{Ret}(C_{u})^{j} to be

d(i,i′)≜i−i′+l−1.d(i,i^{\prime})\triangleq i-i^{\prime}+l-1.
(6)

When computing the encoder cross-attentions Ca(Ret(Cu)j,Hu)\textsc{Ca}(\textsc{Ret}(C_{u})^{j},H_{u}), we set the distance between the retrieval token i′∈[1,2l]i^{\prime}\in[1,2l] and the data token i∈[1,l]i\in[1,l] to be

denc(i′,i)≜i′−i.d_{\textrm{enc}}(i^{\prime},i)\triangleq i^{\prime}-i.
(7)

Positional logits are obtained as a linear transform of a cosine vector computed from (d(i,i′))i,i′(d(i,i^{\prime}))_{i,i^{\prime}}, and are added to content logits, as in a regular self-attention block.

Our implementation of the Cca operator, shown in 1, is based on a vectorized application of a cross-attention layer. For simplicity, we omit the multi-head attention logic and use the simplest Q,K,V attention. We omit relative positional logits computation, described above.

Listing 1 Jax implementation of the chunked cross attention, simplified.
n = 128 # Sequence length
m = 16 # Chunk length
r = 32 # Retrieval length
k = 4 # Number of neighbours
d = 16 # Embedding size
l = n // m # Number of chunks
# Parameters
Q = jnp.zeros((d, d))
K = jnp.zeros((d, d))
V = jnp.zeros((d, d))
def relative_positional_encodings(attending_length, attended_length):
# Classical relative positional encodings
...
def cross_attention(chunk, neighbour):
m, d = chunk.shape
r, d = neighbour.shape
queries = chunk @ Q
keys = neighbour @ K
logits = queries @ keys.T
values = neighbour @ V
return logits, values
def multi_neighbour_cross_attention(chunk, neighbours):
m, d = chunk.shape
k, r, d = neighbours.shape
logits, values = jnp.vectorize(cross_attention,
signature=’(m,d),(r,d)->(m,r),(r,d)’)(
chunk, neighbours)
assert logits.shape == (k, m, r)
assert values.shape == (k, r, d)
logits += relative_positional_encodings(m, r)[None, :, :]
logits = jnp.moveaxis(logits, 0, -1).reshape((m, r * k))
values = jnp.moveaxis(values, 0, 1).reshape((r * k, d))
return jax.nn.softmax(logits) @ values
def multi_chunk_cross_attention(observation, neighbours):
attending_chunks = jnp.pad(observation[m-1:],
((0, m - 1), (0, 0)),
mode=’constant’).reshape(l, m, d)
chunked_output = jnp.vectorize(multi_neighbour_cross_attention,
signature=’(m,d),(k,r,d)->(m,d)’)(
attending_chunks, neighbours)
assert chunked_output.shape == (l, m, d)
output = jnp.pad(chunked_output.reshape(n, d),
((m - 1, 0), (0, 0)),
mode=’constant’)[:n]
return output
observation = jnp.zeros((n, d)) # Input
neighbours = jnp.zeros((l, k, r, d))
h = multi_chunk_cross_attention(observation, neighbours)
assert h.shape == (n, d) # Output

We use disjoint embeddings for the encoder and decoder by default, which allows us to use a different dimensionality for the encoder (typically kept at dEnc=896)d_{\textsc{Enc}}=896) and for the decoder (that we scale up to d=8192d=8192). It is possible to share the embeddings, with little difference in training, as we show in the ablation section.

As shown in Fig. 5, we found that we were able to take a pre-trained baseline transformer and add Retro through fine-tuning. In all cases, we froze all weights from pre-training and freshly initialised the retrieval encoder and cross-attention weights. In all cases, the cross-attention is added every third layer starting at layer six. The learning rate for the three smaller models was set to 2×10−42\times 10^{-4} and half that for the larger model. We experimented with allowing the entire model to resume training during fine-tuning but consistently found that the best approach was to freeze the pre-trained model. This kept the retrieval-off performance frozen whereas when all weights were tuned the retrieval off performance would degrade.

We provide the hyperparameters used in the various experiments of §4.

In Table 10, we show the hyperparameters of the different models we train. In all cases, we train for 419,430,400,000 training tokens. The three smaller models are trained with a batch size of 256 and the largest model is trained with a batch size of 1024. The minimum learning rate is set to 0.1 times the maximum learning rate, which is shown in Table 10. The learning rate is decayed using a cosine cycle length that matches the total number of training tokens. All models are trained using AdamW (Loshchilov and Hutter, 2019) with a weight decay parameter of 0.1. The learning rate linearly increases from 10−710^{-7} to the maximum learning rate over the first 750 steps of training.

Table 10
Baselinedmodeld_{model}dffwd_{ffw}#\# headsHead size#\# layersPPPEncP_{\textsc{Enc}}Max LR
247M8963584166412[6,9,12][6,9,12][1][1]2×10−4\times 10^{-4}
564M153661441212812[6,9,12][6,9,12][1][1]2×10−4\times 10^{-4}
1,574M204881921612824[9,12,…,24][9,12,\dots,24][1][1]2×10−4\times 10^{-4}
7,505M4096163843212832[9,12,…,32][9,12,\dots,32][1][1]1×10−4\times 10^{-4}
Table 10: Retro model hyperparameters, along with the size of the decoder.
View original tableOriginal Table 10

All models use ZeRO to shard the optimiser state (Rajbhandari et al., 2020). Additional infrastructure details can be found in Rae et al. (2021).

Table 11
ModelNumber of layers18
dd1024
dFfwd_{\textsc{Ffw}}4096
Key size64
Value size64
Number of heads16
Training dataDatasetWikitext103train
Sequence length3072
Batch size128
Tokenizer vocabulary size128,000
OptimisationoptimiserAdam
Adam’s β1\beta_{1}0.9
Adam’s β2\beta_{2}0.95
Adam’s ε\varepsilon1e-8
Dropout rate0.25
ScheduleLearning rate start1e-7
Learning rate max2.5e-4
Learning rate min2e-5
Warmup steps4,000
Cosine cycle steps100,000
EvaluationOverlapping proportion87.5 %
Table 11: Hyperparameters for the Wikitext103 experiments presented in Table 4. We use the same learning rate schedule for the baseline and the Retro-fitting. For Retro-fitting, we reset the schedule i.e. the schedule starts from step 0, not from step 35,000.
View original tableOriginal Table 11

We provide more details on our Wikitext103 results presented in §4.1 and Table 4. We train a baseline transformer on the Wikitext103 training set with the hyperparameters presented in Table 11. The learning rate ramps linearly from 1×10−71\times 10^{-7} to 2.5×10−42.5\times 10^{-4} in the first 4,000 steps, then decays to 2×10−52\times 10^{-5} at 100,000 steps using a cosine schedule. The baseline checkpoint at step 35,000 has the lowest perplexity on Wikitext103 valid, of 21.5821.58, for overlapping proportion of 75% (sliding window evaluation that only uses probabilities for tokens that have at least 75% of the sequence length of context, when available). We use this checkpoint for all our baseline and kNN-LMk\textrm{NN-LM} numbers reported in Table 4, except that Table 4 reports for an overlapping proportion of 87.5 %, which slightly lowers the perplexity of our baseline to 21.53 on Wikitext103 valid.

We also use the 35,000 step baseline checkpoint as initialization for a Retrofit, which otherwise uses the same optimiser and schedule hyperparameters but only trains the new retrieval weights, as explained in §4.2. Our best Retrofit checkpoint has a Wikitext103 valid perplexity 18.4618.46, when retrieving from Wikipedia. We use this Retro checkpoint in Table 4 for all other retrieval sets. The evaluation curves for our baseline and Retrofit is shown if Fig. 7 (left). In this particular case, because Wikitext103 is quite small, training a Retro model from scratch led to weaker results than the baseline, at least when retrieving from Wikipedia, as we couldn’t find an effective way to mitigate the increased over-fitting due to the additional weights of Retro.

We also re-implement kNN-LMk\textrm{NN-LM} using the same tokenizer and dataset that we use for our baseline and Retrofitting experiments. kNN-LMk\textrm{NN-LM} has probabilities pkNN-LM=λpLM+(1−λ)pkNNp_{k\textrm{NN-LM}}=\lambda p_{LM}+(1-\lambda)p_{kNN} with pkNN(nk)∝exp⁡(−αdk)p_{kNN}(n_{k})\propto\exp(-\alpha d_{k}). To tune λ\lambda and α\alpha, we begin with α=0.0012\alpha=0.0012, which corresponds to the inverse of the standard deviation of the norm of the embeddings that we use as keys and queries for kNN-LMk\textrm{NN-LM}. We find the best λ=0.118\lambda=0.118. We then find the best α=0.00785\alpha=0.00785 for that value of λ\lambda. Fig. 7 center and right respectively show the perplexity of kNN-LMk\textrm{NN-LM} as a function of λ\lambda and α\alpha.

Figure 7
Figure 7: Wikitext103valid perplexities. Left: Baseline and Retrofit (initialized from baseline’s checkpoint at 35,000 steps) perplexities as a function of training steps. Center and right: kNN-LMk\textrm{NN-LM} perplexity as a function of λ\lambda (for α=0.0012\alpha=0.0012) and α\alpha (for λ=0.12\lambda=0.12) respectively.

In Table 12, we give the hyperparameters used for Retrofitting the models on Massive Text.

Table 12
ModelLayers with Retro-block (PP)Learning rateBatch size
172MEvery 3rd^{rd} from 62×10−4→2×10−52\times 10^{-4}\rightarrow 2\times 10^{-5}256
425MEvery 3rd^{rd} from 62×10−4→2×10−52\times 10^{-4}\rightarrow 2\times 10^{-5}256
1.5BEvery 3rd^{rd} from 62×10−4→2×10−52\times 10^{-4}\rightarrow 2\times 10^{-5}256
7.5BEvery 3rd^{rd} from 61×10−4→1×10−51\times 10^{-4}\rightarrow 1\times 10^{-5}256
Table 12: Hyperparameters for the Retrofitting experiments
View original tableOriginal Table 12

We fine-tune our 7.5B Retro model for 25,000 steps, using a batch size of 128, a learning rate cosine scheduled from 10−610^{-6} to 10−710^{-7}, with a linear ramp of 750 steps. We use dropout in the decoder only, as it performs better than using dropout in both the encoder and the decoder. Each neighbour is formatted as title: {title}, source: {source}. We use the top 20 neighbours from Dpr when training and evaluating.

Table 13
Ablation groupAblationC4 eval bpb
ModelRetro0.822
No query conditioning0.829
No CA positional encodings0.826
Shared embeddings0.823
6-layer encoder0.821
Retrieval valuesNeighbours N0.950
Continuations F0.895
No retrieval0.987
Training neighbours1 training neighbours0.858
4 training neighbours0.847
Cross attention positionCA top layer (1/12)0.827
CA mid layer (6/12)0.823
CA top layer (12/12)0.831
CA all layers0.860
CA every 3 from 10.823
Table 13: Performance of Retro for different variants. Model performance on C4 evaluation set, measured in bytes-per-bits, for a 247M parameter model trained with a 157 billion token schedule.
View original tableOriginal Table 13

We validate important design choices by evaluating what happens when we do not include them. We use the 247M parameter model for all experiments and we train on a compressed 157 billion token schedule for all ablation experiments. We describe results relative to the default settings presented in the main text and recalled here. We report C4 evaluation loss at the end of the training process, and also compares how the evaluation loss decrease versus the training time, measured relatively to the baseline training time. Results are reported in Fig. 8 and Table 13.

Figure 8
Figure 8: Computational efficiency for different variants. We report the training curves plotting C4 evaluation bytes per bits against time, relative to the time taken to train the baseline Retro model. Overall, our design choices are optimal in term of computational efficiency.

Using relative encodings in cross-attention, as described in §B.1.2, provides a pure improvement both in the number of steps to reach a given performance and computational efficiency.

Conditioning the encoder on the previous chunk’s intermediate embeddings, as described in §B.1.1, provides a pure improvement both in term of number of steps and computational efficiency.

Sharing embeddings across the encoder and the decoder does not affect performance. This motivates us using separate embeddings, as it allows to have a narrower encoder than decoder as we scale up the decoder size.

Retro models are trained by attending, for a given chunk, to both the neighbours of the preceding chunk and their continuation in time. We measure how training and evaluating Retro models on neighbours only and their continuation only affects performance. Overall, attending to neighbours only provides 22%22\% of the performance improvement due to retrieval in Retro, while attending the future of the neighbours gives 56%56\% of the performance. Attending to both neighbours and their continuation is the most efficient choice both in term of final performance and training efficiency.

All models in the text use a relatively small Retro encoder. We experimented with a 3×3\times deeper encoder. We found that this resulted in a tiny decrease in loss– 0.15% at the cost of a larger training time (+20%+20\%). Overall, using a shallow encoder is the best choice in term of training efficiency.

We measure the effect of training on a single retrieved neighbour, as well as training on 4 neighbours (Retro uses 2 neighbours in training). Training on a single neighbour results in a large decrease in performance, while training on 4 neighbours does not give substantial performance improvement at the end of training, but induces a large computational overhead. Overall, we find that using 2 neighbours is the best choice in term of training efficiency. Furthermore, evaluation can be done with additional neighbours.

We measure how the frequency of cross-attention in the decoder affects performance. Overall, attending only once at the top or the bottom layer is a bad choice, while attending once on a mid-depth layer is relatively sound. We choose to have cross-attention every 3 layer as this provides a good trade-off between performance and run-time.

We illustrate the usage of Retro models by looking at the perplexity of evaluation samples and by producing samples autoregressively.

To build an intuition of what kind of information is leveraged by Retro models, we suggest to have a closer look at a few evaluation documents and the corresponding retrieved data in Tables 16, 17, 18 and 19. In these tables, the 4 rows corresponds to the first 4 chunks of the documents. The left-most column shows the chunk CuC_{u} from the document being evaluated, where each token is coloured by the negative cross entropy loss difference LRetro[Off]−LRetroL_{\textsc{Retro}\textsc{[Off]}}-L_{\textsc{Retro}}, a positive value, coloured in yellow, indicates that Retro performs better when it has access to neighbours data. The second columns also shows the evaluated chunk CuC_{u} but where each token ii is coloured by the length of the longest common prefix (LCP) with the preceding neighbours, i.e. the largest integer jj such that the prefix (xi−j−1,…,xi)(x_{i-j-1},\dotsc,x_{i}) also appears in Ret(Cu−1)\textsc{Ret}(C_{u-1}). Conversely, columns three and four show the first two neighbours and their continuation, respectively [Nu1,Fu1][N^{1}_{u},F^{1}_{u}] and [Nu2,Fu2][N^{2}_{u},F^{2}_{u}] coloured by LCP with subsequent chunk Cu+1C_{u+1}. LCP colouring helps to visually identify where the evaluated document overlaps the retrieved data. Note that the first chunk, C1C_{1}, in the second column is not coloured as it does not have any preceding neighbours to compute LCP with. Similarly, we do not show the neighbours of the fourth chunk, as these are not used to condition any of the first four chunks.

Our qualitative analysis exhibits two major behaviors.

Firstly, we observe that sometimes, specific facts in CuC_{u} can be extracted from the preceding neighbours Ret(Cu−1)\textsc{Ret}(C_{u-1}) and that this can correspond to significant reduction in loss from the Retro model for the corresponding tokens. Some examples of such behavior include the journal name Publishers Weekly in Table 16, the football team name Tyrone in Table 17 or the event dates 25 August to 6 September 2020 in Table 18. In these three examples, the evaluated data consists of recent Wikipedia articles written in September 2021, after we built our retrieval dataset (see section §A.2). Yet, relevant information to predict this new data was available in the pre-existing retrieval data and the Retro model seems to be able to correctly leverage it.

On the other hand, we also observe that some of the evaluation data can partially leak in our training and retrieval data, despite the use of deduplication. Retro can dramatically exploit such leakage. Table 19 illustrates this behavior, where the chunks C2C_{2} and C3C_{3} largely overlaps Ret(C1)\textsc{Ret}(C_{1}) and Ret(C2)\textsc{Ret}(C_{2}) respectively, up to small formatting differences, which leads to much lower Retro loss for all the corresponding tokens. Fig. 6 shows that it is possible to quantify how much of the Retro loss reduction is due to each of these two behaviors, by filtering out evaluation chunks that overlaps with the retrieval set.

We can follow the same procedure as above on samples generated using Retro models, in order to better understand where retrieval data had an influence on sampling. We show examples of samples obtained using the 7.5B Retro model in Table 6, 7, 20 and 21.

Figure 9
Figure 9: Wikipedia link-distance between retrieved articles. For each sequences, chunk combination we compute the link distance between the target and the top-5 neighbours using only Wikipedia. The rank shows the relative neighbour distance, where rank-1 is the first neighbour and rank 5 is the fifth. The different colours represent link distance. Because we do not retrieve from the same document, 1 is the smallest value. We find, on average, the distance between random articles with a path between them is over 5.0

To quantify a notion of distance between the source document and the retrieved chunks, we can ask the distance between source articles when retrieving only from Wikipedia. Consonni et al. (2019) provides a Wikipedia link dataset which, for each article, contains a list of neighbouring articles. Using this, we construct a directed graph and compute the distance from one page to another. In Fig. 9 we compute the link-distance between training sequences and the retrieved neighbours. We find that retrieved documents tend to be from articles that are quite close to the article containing the target. Furthermore, we find that on average the distance increases with rank, suggesting that our neighbours are both useful and that the order is reasonable. This provides confidence for our larger-scale experiments where document distance is less well defined.

We report tables corresponding to quantitative figures of the main text, as well as further filtered language model results on the Pile.

We report the performance of Retro and baseline models, measured in bits-per-bytes on evaluation set, in Table 14.

Table 14
BaselineRetro [Off]Retro[On]
172M425M1.5B7.5B172M425M1.5B7.5B172M425M1.5B7.5B
C4 Eval bpb0.980.920.840.780.980.920.840.780.820.770.710.66
C4 Eval bpb (900B)--------0.880.830.760.71
C4 Eval bpb (360B)--------0.920.870.800.74
C4 Eval bpb (180B)--------0.940.890.810.75
C4 Eval bpb (90B)--------0.950.890.820.76
C4 Eval bpb (36B)--------0.960.900.830.77
C4 Eval bpb (18B)--------0.960.910.830.77
C4 Eval bpb (9B)--------0.960.910.830.77
C4 Eval bpb (4B)--------0.970.910.840.78
C4 Eval bpb (2B)--------0.970.910.840.78
C4 Eval bpb (k=1k={1})--------0.840.790.730.67
C4 Eval bpb (k=2k={2})--------0.830.780.720.67
C4 Eval bpb (k=3k={3})--------0.820.780.710.66
C4 Eval bpb (k=4k={4})--------0.820.770.710.66
C4 Eval bpb (k=5k={5})--------0.820.770.710.66
C4 Eval bpb (k=10k={10})--------0.820.770.710.66
C4 Eval bpb (k=20k={20})--------0.820.770.710.66
C4 Eval bpb (k=30k={30})--------0.820.770.710.65
C4 Eval bpb (k=40k={40})--------0.830.770.710.65
C4 Eval bpb (k=50k={50})--------0.830.780.710.66
C4 Eval bpb (k=60k={60})--------0.840.780.720.66
C4 Eval bpb (k=70k={70})--------0.840.790.720.66
C4 Eval bpb (k=80k={80})--------0.850.790.730.66
C4 Eval bpb (k=90k={90})--------0.850.790.730.66
C4 Eval bpb (k=100k={100})--------0.850.79-0.67
Lambada Accuracy0.420.510.610.690.470.540.630.700.520.600.670.73
Curation Corpus bpb0.690.630.560.520.680.640.570.510.660.610.550.50
Wikitext103 Perplexity25.6219.2913.9810.6525.8819.7813.8910.403.322.962.532.22
Wikipedia Sept. 2021 bpb0.850.780.710.650.860.790.710.650.790.730.660.61
Table 14: Full results for the main language modelling datasets. First three sets of rows correspond to Fig. 1, last set of rows to Fig. 3.
View original tableOriginal Table 14

In Fig. 4, we compare Retro against Jurassic-1 (Lieber et al., 2021). The full bits-per-bytes results are reported in Table 15.

Table 15
Subset7B Baseline (Ours)GPT-3Jurassic-1Gopher7.5B Retro
arxiv0.7420.8380.6800.6410.714
books30.7920.8020.8350.7060.653
dm_mathematics1.1771.3711.0371.1351.164
freelaw0.5760.6120.5140.5060.499
github0.4200.6450.3580.3670.199
gutenberg_pg_190.8031.1630.8900.6520.400
hackernews0.9710.9750.8690.8880.860
nih_exporter0.6500.6120.5900.5900.635
opensubtitles0.9740.9320.8790.8940.930
philpapers0.7600.7230.7420.6820.699
pile_cc0.7710.6980.6690.6880.626
pubmed_abstracts0.6390.6250.5870.5780.542
pubmed_central0.5880.6900.5790.5120.419
stackexchange0.7140.7730.6550.6380.624
ubuntu_irc1.2000.9460.8571.0811.178
uspto_backgrounds0.6030.5660.5370.5450.583
Table 15: Full results on The Pile, measured in bits-per-bytes. Jurassic-1 and GPT-3 numbers are taken from Lieber et al. (2021). Gopher numbers are taken from Rae et al. (2021).
View original tableOriginal Table 15

We evaluate leakage between the evaluation sets and the training set by measuring the proportion of evaluation chunks with a certain overlap r(C)r(C). We show histograms in Fig. 10. We can see that C4C4 has some slight overlaps between train and evaluation. Similarly, chunks of Wikitext103 appear in the training set despite having removed the actual Wikitext103 evaluation documents from the training set. On the other hand, our Wikipedia September 21 dataset shows almost no leakage (data being original documents that did not exist at training data creation), and neither does Curation Corpus.

We report chunk overlap distribution and filtered performance curves on the Pile in Fig. 12 and Fig. 11, respectively. The qualitative interpretation of the filtered curves is the same: Retro models exploit leakage more, but the performance improvement they provide remains significant even on original chunks that haven’t been observed in the training set.

Figure 10
Figure 10: Distribution of the overlap between evaluation and train chunks for C4, Curation Corpus, Wikitext103 and Wikipedia Sept. 2021.
Figure 11
Figure 11: Filtered evaluation losses on the Pile, with baseline Transformers and Retro.
Figure 12
Figure 12: Distribution of the overlap between evaluation and train chunks for the Pile evaluation sets.
Table 16
CuC_{u} colored by loss differenceCuC_{u} colored by LCP with Ret(Cu−1)\textsc{Ret}(C_{u}{-1})[Nu1,Fu1][N_{u}^{1},F_{u}^{1}] colored by LCP with Cu+1C_{u+1}[Nu2,Fu2][N_{u}^{2},F_{u}^{2}] colored by LCP with Cu+1C_{u+1}
L_{\textsc{{Retro[Off]} }}-L_{\textsc{Retro}}\hbox{\pagecolor{cm_0!40}\leqslant-0.5},\hbox{\pagecolor{cm_31!40}=0},\hbox{\pagecolor{cm_63!40}\geqslant 0.5}LCP=\textrm{LCP}= 00, 11, 22, 33,44,⩾5\geqslant 5LCP=\textrm{LCP}= 00, 11, 22, 33,44,⩾5\geqslant 5LCP=\textrm{LCP}= 00, 11, 22, 33,44,⩾5\geqslant 5
Great Circle (novel)Great Circle iGreat Circle (novel) Great Circle iThe Dutch House (novel)The Dutch HThe Dutch House (novel)The Dutch H
s a 2021 novel by Maggie Shipstead,s a 2021 novel by Maggie Shipstead,ouse is a 2019 novel by Ann Patchettouse is a 2019 novel by Ann Patchett
published on May 4, 2021, by Alfredpublished on May 4, 2021, by Alfred. It was published by Harper on Sept. It was published by Harper on Sept
A. Knopf.The novel has been shortlA. Knopf. The novel has been shortlember 24, 2019. It tells the story oember 24, 2019. It tells the story o
isted for the 2021 Booker Prize.Syisted for the 2021 Booker Prize. Syf a brother and sister over the courf a brother and sister over the cour
nopsis The novel consists of two panopsis The novel consists of two pase of five decades.The novel was ase of five decades.[2]The novel wa
rallel narratives about two fictionarallel narratives about two fictionafinalist for the 2020 Pulitzer Prizs a finalist for the 2020 Pulitzer P
l women. One isl women. One ise for Fiction.PlotThe Dutch Houserize for Fiction.[3]Plot[edit]Th
is a mansion located in Elkins Parke Dutch House is a mansion located i
, Pennsylvania, a suburb of Philadeln Elkins Park, Pennsylvania, a subur
phia. It was built in 1922 by the Vab of Philadelphia. It was built in 1
nHoebeek family, a husband and wife922 by the VanHoebeek family, a husb
originally from the Netherlands whoand and wife originally from the Net
made their fortune in the tobacco inherlands who made their fortune in t
dustry. Cyril Conroy, a self-made rehe tobacco industry. Cyril Conroy, a
al estate mogulself-
about the disappeared 20th-centuryabout the disappeared 20th-centuryon becoming a filmmaker. She has fobased closely on her own youthful e
aviator Marian Graves, while the othaviator Marian Graves, while the othund a subject for her film project,xperiences. (She plans the film to b
er is about the struggling 21st-center is about the struggling 21st-centan obscure African American actresse the first of two parts, the second
ury Hollywood actress Hadley Baxter,ury Hollywood actress Hadley Baxter,credited only as “the watermelon womdealing with the aftermath of the f
who is attempting to make a film abwho is attempting to make a film aban” in old Hollywood films, and theirst’s events.) Byrne plays a young
out Marian. Hadley’s narrative is toout Marian. Hadley’s narrative is tosubsequent film recounts her searchfilm student named Julie (Hogg’s ava
ld in the first-person, while Marianld in the first-person, while Marianfor this woman even as it covers, intar), who starts her artistic educat
’s sections are told in the third-pe’s sections are told in the third-pethe manner of the earlier Dunyemention with high hopes of making a movi
rsonrsonaries, Dunye’s friendships and her le about a boy named Tony, living in
ove life. InThe Watermelon Woman, Dworking-class Sunderland, who adores
unye makes the film she set out to mhis mother — “is almost obsessed wi
ake in 1990 about African American wth her,” as eager Julie tells her ad
omen artists, a film that both invenvisers. Her idealism is evident from
ts an artistic predecessor with whomthe start.The advisers are skepti
she can identify and also “finds” Ccal, and no wonder; Julie’s family i
heryl herself as the artist that shes posh, with a comfortable country e
seeks. As Dunye identifies herselfstate and
.Reception Great Circle received.Reception Great Circle receivedfirst edition hardcoverReceptionThe book also debuted at number tw
very favorable reviews, with a cumulvery favorable reviews, with a cumulThe novel debuted at number one on To on The New York Times Hardcover No
ative "Rave" rating at the review agative "Rave" rating at the review aghe New York Times fiction best-sellenfiction best-sellers list on July 2
gregator website Book Marks, based ogregator website Book Marks, based or list. As of the week ending Februa8, 2019.[5] It spent eleven weeks on
n 22 book reviews from mainstream lin 22 book reviews from mainstream liry 20, 2021, the novel has spent 38the list.[6]Reception[edit]At t
terary critics. The novel debuted atterary critics. The novel debuted atweeks on the list.At the review aghe review aggregator website Book Ma
number fourteen on The New York Timnumber fourteen on The New York Timgregator website Book Marks, which arks, which assigns individual rating
es Hardcover fiction best-seller lises Hardcover fiction best-seller lisssigns individual ratings to book res to book reviews from mainstream li
t for the week ending Mayt for the week ending Mayviews from mainstream literary crititerary critics, the book received a
cs, the novel received a cumulativecumulative "Positive" rating based o
"Rave" rating based on 38 reviews, wn 29 reviews: 12 "Rave" reviews, 6 "
ith only one "mixed" review. PublishPositive" reviews, 9 "Mixed" reviews
ers Weekly wrote, "Bennett renders h, and 2 "Pan" reviews.[7]Publisher
er characters and their struggles wis Weekly gave the book a mixed revie
th great compassion, and explores thw, writing, "Unfortunately, all thre
e complicated state of mind that Stee
lla finds herself in while passing a
s white." In its
8, 2021. Critics praised the novel8, 2021. Critics praised the novel
for sustaining its length and for Shfor sustaining its length and for Sh
ipstead’s research and intricate novipstead’s research and intricate nov
el structure for perfectly interweavel structure for perfectly interweav
ing the parallel narratives, despiteing the parallel narratives, despite
the time and circumstances separatithe time and circumstances separati
ng them.In its starred review, Pubng them.In its starred review, Pub
lishers Weekly wrote, "Shipstead manlishers Weekly wrote, "Shipstead man
ages to portray both Marian’s and Haages to portray both Marian’s and Ha
dley’sdley’s
Table 16: Great Circle (novel), from Wikipedia September 21. The article is about a recent novel and chunks C3C_{3} and C4C_{4} are specifically about its reception. The name Publishers Weekly of the journal that reviewed the novel appears both in the neighbours [N31,F31],[N32,F32][N^{1}_{3},F^{1}_{3}],[N^{2}_{3},F^{2}_{3}] of chunk C3C_{3} and in the subsequent chunk C4C_{4}, where the loss for those tokens is significantly reduced by Retro.
View original tableOriginal Table 16
Table 17
CuC_{u} colored by loss differenceCuC_{u} colored by LCP with Ret(Cu−1)\textsc{Ret}(C_{u}{-1})[Nu1,Fu1][N_{u}^{1},F_{u}^{1}] colored by LCP with Cu+1C_{u+1}[Nu2,Fu2][N_{u}^{2},F_{u}^{2}] colored by LCP with Cu+1C_{u+1}
L_{\textsc{{Retro[Off]} }}-L_{\textsc{Retro}}\hbox{\pagecolor{cm_0!40}\leqslant-0.5},\hbox{\pagecolor{cm_31!40}=0},\hbox{\pagecolor{cm_63!40}\geqslant 0.5}LCP=\textrm{LCP}= 00, 11, 22, 33,44,⩾5\geqslant 5LCP=\textrm{LCP}= 00, 11, 22, 33,44,⩾5\geqslant 5LCP=\textrm{LCP}= 00, 11, 22, 33,44,⩾5\geqslant 5
2021 All-Ireland Senior Football Cha2021 All-Ireland Senior Football Cha2018 All-Ireland Senior Football Cha2018 All-Ireland Senior Football Cha
mpionship FinalThe 2021 All-Irelanmpionship Final The 2021 All-Irelanmpionship FinalThe 2018 All-Irelanmpionship FinalThe 2018 All-Irelan
d Senior Football Championship Finald Senior Football Championship Finald Senior Football Championship Finald Senior Football Championship Final
was the 134th final of the All-Irelwas the 134th final of the All-Irelwas the 131st final of the All-Irelwas the 131st final of the All-Irel
and Senior Football Championship andand Senior Football Championship andand Senior Football Championship andand Senior Football Championship and
the culmination of the 2021 All-Irethe culmination of the 2021 All-Irethe culmination of the 2018 All-Irethe culmination of the 2018 All-Ire
land Senior Football Championship. Tland Senior Football Championship. Tland Senior Football Championship inland Senior Football Championship in
he match was played at Croke Park inhe match was played at Croke Park inGaelic football. The match was playGaelic football. The match was play
Dublin on 11 September 2021. It wasDublin on 11 September 2021. It wased at Croke Park in Dublin on 2 Septed at Croke Park in Dublin on 2 Sept
originally scheduledoriginally scheduledember 2018.[3]It was the second tiember 2018.It was the second time
me the teams had met in the final; Dthe teams had met in the final; Dubl
ublin won the first encounter in 199in won the first encounter in 1995.
5.The final was shown live in IrelIt was the third consecutive year th
and on RTÉ Two as part of The Sundayat a team qualified under the system
Game live programme, presented by Mof second chances introduced in 200
ichael Lyster from Croke Park, with1; Tyrone qualified despite defeat i
studio analysis from Joe Brolly,n its provincial championship.Dubl
in won the final by a margin of six
points
for 28 August but had to be postponfor 28 August but had to be postpongame 23–23 after extra time, howevewith a last-ditch plan of action –
ed by two weeks when the – semi-finaed by two weeks when the – semi-finar Ulster progressed under the competplay the Munster/Ulster Semi-Final o
l was postponed due to a COVID-19 oul was postponed due to a COVID-19 ouition rules as they scored three tirn March 16th, with the winners to pl
tbreak. Ulster champions Tyrone tooktbreak. Ulster champions Tyrone tookes in the match against Leinster’s tay Connacht in the following day’s F
on Connacht champions Mayo, in whaton Connacht champions Mayo, in whatwo. The semi-finals took place in miinal.On March 16th then Munster ha
was their first ever meeting in a fwas their first ever meeting in a fd November and saw both the away tead an easy win over Ulster (9-07 to 0
inal, winning their 4th title afterinal, winning their 4th title afterms win, as Ulster beat Glasgow and E-00) but thankfully for the Munster
a 2–14 to 0–15 win. Mayo losta 2–14 to 0–15 win. Mayo lostdinburgh beat Connacht. The final waplayers, the pitch cut up so badly d
s held on Saturday December 20 at Muuring the game, it was decided to po
rrayfield Stadium and saw Ulster beastpone the following day’s hurling F
t Edinburgh 21–27 to win the Celticinal (until Easter Sunday) with the
Cup.2004–05 seasonThe format offootball Final going ahead on its ow
the competition was changed for then on St. Patrick’s Day.Less than a
second edition of the competition. Tweek later, on March 23rd, seven
he competition was moved to April an
d May to run after the conclusion of
the Celtic League competition, with
only eight
their 11th consecutive final sincetheir 11th consecutive final since1-16 to 0-15 winners to qualify forwhich Dublin won by 0-12 to 0-9.D
1989, losing 6 finals in 9 years, wi1989, losing 6 finals in 9 years, witheir 10th league final in the pastublin are going for an unprecedented
th this latest defeat on an identicath this latest defeat on an identica13 years.They have won seven of tfourth successive Championship win
l scoreline to 2020, when Mayo lostl scoreline to 2020, when Mayo lostheir previous league finals under Coover Kerry. Prior to their current r
to Dublin.Background were aimingto Dublin.Background were aimingdy since 2002, losing the other twoun, which started with the 2011 All-
to win their fourth title and firstto win their fourth title and firstto Waterford (2007 ) and Dublin (201Ireland final, they had only managed
All-Ireland since 1951. Since then,All-Ireland since 1951. Since then,1 ).Despite the defeat there weretwo consecutive victories over them
they had lost ten finals (1989, 1996they had lost ten finals (1989, 1996some distinct positives from a Galwaon two separate occasions - 1909 an
, 1997, 2004, 2006,, 1997, 2004, 2006,y perspective- most notably the solid ’24, 1976 and ’77.The longest wi
d displays of Daithí Burke at centrenning sequence in the rivalry was se
-back, Joseph Cooney at wing-back ant by Kerry between 1941 and 1975, wh
d Ronan Burke at full-back. Colm Calen they won each of the six Champion
lanan continued his excellent form iship meetings. Kerry went nine games
n goal and also hit a stunning freeunbeaten between 1978 and 2009, wit
from distance.Indeed it was not thh four victories either side of a dr
e Galway defence that was the probleamatic draw at the quarter-final sta
mge in Thurles in 2001.Sunday will
mark their 11th
2012, 2013, 2016, 2017, 2020). app2012, 2013, 2016, 2017, 2020). app
eared in their seventh final, winnineared in their seventh final, winnin
g on three occasions in 2003, 2005 ag on three occasions in 2003, 2005 a
nd 2008.This final was the fifth tond 2008.This final was the fifth to
be contested by county teams from Cbe contested by county teams from C
onnacht and Ulster, the other finalsonnacht and Ulster, the other finals
were 1925 (Galway beat Cavan), 1943were 1925 (Galway beat Cavan), 1943
(Roscommon beat Cavan), 1948 (Cavan(Roscommon beat Cavan), 1948 (Cavan
beatbeat
Table 17: All-Ireland Senior Football Championship Final, from Wikipedia September 21. The name of the team Tyrone appears both in the second neighbours [N12,F12][N^{2}_{1},F^{2}_{1}] of chunk C1C_{1} and in the subsequent chunk C2C_{2}, where the loss for those tokens is significantly reduced by Retro.
View original tableOriginal Table 17
Table 18
CuC_{u} colored by loss differenceCuC_{u} colored by LCP with Ret(Cu−1)\textsc{Ret}(C_{u}{-1})[Nu1,Fu1][N_{u}^{1},F_{u}^{1}] colored by LCP with Cu+1C_{u+1}[Nu2,Fu2][N_{u}^{2},F_{u}^{2}] colored by LCP with Cu+1C_{u+1}
L_{\textsc{{Retro[Off]} }}-L_{\textsc{Retro}}\hbox{\pagecolor{cm_0!40}\leqslant-0.5},\hbox{\pagecolor{cm_31!40}=0},\hbox{\pagecolor{cm_63!40}\geqslant 0.5}LCP=\textrm{LCP}= 00, 11, 22, 33,44,⩾5\geqslant 5LCP=\textrm{LCP}= 00, 11, 22, 33,44,⩾5\geqslant 5LCP=\textrm{LCP}= 00, 11, 22, 33,44,⩾5\geqslant 5
2020 Summer ParalympicsThe , brand2020 Summer Paralympics The , brandpics Games.* The 2020 Summer Paraly2020 Summer ParalympicsThe are an
ed as the Tokyo 2020 Paralympic Gameed as the Tokyo 2020 Paralympic Gamempics are an upcoming major internatupcoming major international multi-
s, was an international multi-sports, was an international multi-sportional multi-sport event for athletessport event for athletes with disabi
parasports event held from 24 Augustparasports event held from 24 Augustwith disabilities governed by the Ilities governed by the International
to 5 September 2021 in Tokyo, Japanto 5 September 2021 in Tokyo, Japannternational Paralympic Committee. SParalympic Committee. Scheduled as
. They were the 16th Summer Paralymp. They were the 16th Summer Paralympcheduled as the 16th Summer Paralympthe 16th Summer Paralympic Games, th
ic Games as organized by the Internaic Games as organized by the Internaic Games, it is planned to be held iey are scheduled to be held in Tokyo
tional Paralympic Committee (IPC).tional Paralympic Committee (IPC).n Tokyo, Japan from 25 August to 6 S, Japan between 24 August and 5 Sept
eptember 2020.3. 2019 BWF Para-Badember 2021. Originally due to take p
minton World Championships- The 20lace between 25 August and 6 Septemb
19 BWF Para-Badminton World Championer 2020. On 24 March 2020, the IOC a
ships was held from 20 to 25 Augustnd the Tokyo Organizing Committee of
2019 in Basel, Switzerland.- Men’sficially announced that the 2020 Sum
event: Gold Medal: Pramod Bhagat inmer Olympics and 2020 Summer Paralym
Singles SL3 Event and Pramod Bhagatpics would be postponed to 2021, due
and Manojto the COVID-19 pandemic, marking t
he first time that the Paralympics h
as been postponed. They will still b
e publicly marketed as
Originally scheduled to take place fOriginally scheduled to take place fonce submitted.This process was uOlympiad, have now been postponed a
rom 25 August to 6 September 2020, irom 25 August to 6 September 2020, indertaken following the postponementnd rescheduled for 23 July to 8 Augu
n March 2020 both the 2020 Summer Oln March 2020 both the 2020 Summer Olof the Tokyo 2020 Games due to thest 2021 in Tokyo, Japan. The Games
ympics and Paralympics were postponeympics and Paralympics were postponeCOVID-19 pandemic, with both the Olywere postponed in March 2020 as a re
d by one year due to the COVID-19 pad by one year due to the COVID-19 pampics and Paralympics pushed back asult of the worldwide Covid-19 pande
ndemic, with the rescheduled Games sndemic, with the rescheduled Games syear.Now, the Tokyo 2020 Olympicsmic, although they will still keep t
till referred to as Tokyo 2020 for mtill referred to as Tokyo 2020 for mare scheduled for July 23 to Augusthe name Tokyo 2020 for marketing and
arketing and branding purposes. Asarketing and branding purposes. As8 while the Paralympics are due to fbranding purposes. This will be th
with the Olympics, the Games were lawith the Olympics, the Games were laollow from August 24 to September 5.e first time the Olympic Games have
rgely held behindrgely held behindThe refund process is separate forbeen postponed rather than cancelled
ticketholders outside of Japan, who.
purchased tickets through authorise
d ticket resellers (ATR).Each ATR
has its own individual refund proced
ure.Early figures from the refund
process for the Tokyo 2020 Olympics
stated that around 18 per cent
closed doors with no outside spectaclosed doors with no outside spectahas been rescheduled to May 1-4 becOlympic Games, when Tokyo became th
tors due to a state of emergency intors due to a state of emergency inause of travel restrictions under the first city in Asia to host the Oly
the Greater Tokyo Area and other prethe Greater Tokyo Area and other pree current state of emergency in Tokympic and Paralympic Games, but unfor
fectures. The Games were the secondfectures. The Games were the secondo and other 10 prefectures across Jatunately strong winds made it an imp
Summer Paralympics hosted by Tokyo sSummer Paralympics hosted by Tokyo span.The Tokyo 2020 organizing commossible task this time around.Memb
ince 1964, and the third Paralympicsince 1964, and the third Paralympicsittee announced that the first of 18ers of the Tokyo Organising Committe
held in Japan overall since the 199held in Japan overall since the 199test events for the Olympic and Pare of the Olympic and Paralympic Game
8 Winter Paralympics in Nagano. Th8 Winter Paralympics in Nagano. Thalympic Games will involve wheelchais (Tokyo 2020), Tokyo Metropolitan G
e Games featurede Games featuredr rugby, which will be held in Yoyogovernment officials, Tokyo 2020 Torc
i National Stadium from April 3 to 4h Relay Official Ambassadors and rep
.The FINA Diving World Cup will foresentatives from Miyagi Prefecture
llow from April 18 to 23 at the Tokyjoined the arrival ceremony.FLAME
o Aquatics Centre, which will also sOF RECOVERYThe Olympic flame will
erve as an Olympic qualifying event.now be put on display at various loc
The spread of the COVID-19 pandemiations in the Tohoku region, to high
c has slowed down in Tokyo three weelight the message of hope in the are
ks after the Japanese capital entereas worst affected by the 2011 Great
d a state of emergency onEast Japan Earthqu
539 medal events in 22 sports, with539 medal events in 22 sports, with
badminton and taekwondo both makingbadminton and taekwondo both making
their Paralympic debut to replace ftheir Paralympic debut to replace f
ootball 7-a-side and sailing. Chinaootball 7-a-side and sailing. China
topped the medal table for the fifthtopped the medal table for the fifth
consecutive Paralympics, with 96 goconsecutive Paralympics, with 96 go
lds and 207 total medals. Great Britlds and 207 total medals. Great Brit
ain finished second for the ninth tain finished second for the ninth t
ime,ime,
Table 18: 2020 Summer Paralympics, from Wikipedia September 21. The original dates of the event, 25 August to 6 September 2020, appears both in the neighbors [N11,F11],[N12,F12][N^{1}_{1},F^{1}_{1}],[N^{2}_{1},F^{2}_{1}] of chunk C1C_{1} and in the subsequent chunk C2C_{2}, where the loss for those tokens is significantly reduced by Retro. Interestingly, in this case, the neighbors were written at a time when the event hadn’t yet been postponed.
View original tableOriginal Table 18
Table 19
CuC_{u} colored by loss differenceCuC_{u} colored by LCP with Ret(Cu−1)\textsc{Ret}(C_{u}{-1})[Nu1,Fu1][N_{u}^{1},F_{u}^{1}] colored by LCP with Cu+1C_{u+1}[Nu2,Fu2][N_{u}^{2},F_{u}^{2}] colored by LCP with Cu+1C_{u+1}
L_{\textsc{{Retro[Off]} }}-L_{\textsc{Retro}}\hbox{\pagecolor{cm_0!40}\leqslant-0.5},\hbox{\pagecolor{cm_31!40}=0},\hbox{\pagecolor{cm_63!40}\geqslant 0.5}LCP=\textrm{LCP}= 00, 11, 22, 33,44,⩾5\geqslant 5LCP=\textrm{LCP}= 00, 11, 22, 33,44,⩾5\geqslant 5LCP=\textrm{LCP}= 00, 11, 22, 33,44,⩾5\geqslant 5
= Daniel Radcliffe =Daniel Jacob R= Daniel Radcliffe = Daniel Jacob RDaniel Jacob Radcliffe (born 23 JulyDaniel Jacob Radcliffe (born 23 July
adcliffe ( born 23 July 1989 ) is anadcliffe ( born 23 July 1989 ) is an1989) is an English actor who rose1989) is an English actor who rose
English actor who rose to prominencEnglish actor who rose to prominencto prominence as the title characterto prominence as the title character
e as the title character in the Harre as the title character in the Harrin the Harry Potter film series. Hein the Harry Potter film series. He
y Potter film series. He made his acy Potter film series. He made his acmade his acting debut at 10 years omade his acting debut at 10 years o
ting debut at 10 years of age in BBCting debut at 10 years of age in BBCf age in BBC One’s 1999 television ff age in BBC One’s 1999 television m
One’s 1999 television film David CoOne’s 1999 television film David Coilm David Copperfield, followed by hovie David Copperfield, followed by
pperfield, followed by his cinematicpperfield, followed by his cinematicis cinematic debut in 2001’s The Taihis film debut in 2001’s The Tailor
debutdebutlor of Panama. At age 11, he was casof Panama. At age 11, he was cast as
t as Harry Potter in the first HarryHarry Potter in the first Harry Pot
Potter film, and starred in the serter film, and starred in the series
ies for 10 years until the release ofor 10 years until the release of th
f the eighth and final film in 2011.e eighth and final film in 2011. Rad
Radcliffe began to branch out to scliffe began to branch out to stage
tage acting in 2007, starring in theacting in 2007, starring in the Lond
London and New York productions ofon and New York productions of Equus
Equus, and, and in the
in 2001’s The Tailor of Panama. Atin 2001’s The Tailor of Panama. Atin 2001’s The Tailor of Panama. Atof Panama. At age 11, he was cast a
age 11, he was cast as Harry Potterage 11, he was cast as Harry Potterage 11, he was cast as Harry Potters Harry Potter in the first Harry Po
in the first Harry Potter film, andin the first Harry Potter film, andin the first Harry Potter film, andtter film, and starred in the series
starred in the series for 10 years ustarred in the series for 10 years ustarred in the series for 10 years ufor 10 years until the release of t
ntil the release of the eighth and fntil the release of the eighth and fntil the release of the eighth and fhe eighth and final film in 2011.R
inal film in 2011.Radcliffe beganinal film in 2011.Radcliffe beganinal film in 2011.Radcliffe beganadcliffe began to branch out to stag
to branch out to stage acting in 200to branch out to stage acting in 200to branch out to stage acting in 200e acting in 2007, starring in the Lo
7, starring in the London and New7, starring in the London and New7, starring in the London and New Yondon and New York productions of Equ
rk productions of Equus, and in theus, and in the 2011 Broadway revival
2011 Broadway revival of the musicalof the musical How to Succeed in Bu
How to Succeed in Business Withoutsiness Without Really Trying. He sta
Really Trying. He starred in the 201rred in the 2012 horror film The Wom
2 horror film The Woman in Black, anan in Black, and played beat poet Al
d played beat poet Allen Ginsberg inlen Ginsberg in the 2013 independent
the 2013 independent film Kill Yourfilm Kill Your Darlings. He has con
Darlings.He has contributed to matributed to many charities, includin
ny charitiesg Demelza House Children’s
York productions of Equus, and in tYork productions of Equus, and in tYork productions of Equus, and in tin the 2011 Broadway revival of the
he 2011 Broadway revival of the musihe 2011 Broadway revival of the musihe 2011 Broadway revival of the musimusical How to Succeed in Business
cal How to Succeed in Business Withocal How to Succeed in Business Withocal How to Succeed in Business WithoWithout Really Trying. He starred in
ut Really Trying. He starred in theut Really Trying. He starred in theut Really Trying. He starred in thethe 2012 horror film The Woman in B
2012 horror film The Woman in Black,2012 horror film The Woman in Black,2012 horror film The Woman in Black,lack, and played beat poet Allen Gin
and played beat poet Allen Ginsbergand played beat poet Allen Ginsbergand played beat poet Allen Ginsbergsberg in the 2013 independent film K
in the 2013 independent film Kill Yin the 2013 independent film Kill Yin the 2013 independent film Kill Yill Your Darlings. He has contribute
our <unk>.He has contributed to maour <unk>.He has contributed to maour Darlings.He has contributed tod to many charities, including Demel
ny charities,ny charities,many charities, including Demelza Hza House Children’s Hospice and The
ouse Children’s Hospice and The TrevTrevor Project. He also made public
or Project. He also made public servservice announcements for the latter
ice announcements for the latter. In. In 2011, he was awarded the Trevor
2011, he was awarded the Trevor ProProject’s "Hero Award."
ject’s "Hero Award."Sources disagr
ee about Radcliffe’s personal wealth
; he was reported to have earned £1
million for the first Harry Potter
including <unk> Hospice Care for Chincluding <unk> Hospice Care for Ch
ildren, and The Trevor Project for sildren, and The Trevor Project for s
uicide prevention among LGBTQ youth,uicide prevention among LGBTQ youth,
which gave him its Hero Award in 20which gave him its Hero Award in 20
11.= = Early life = =Radcliffe w11.= = Early life = =Radcliffe w
as born in West London, England. Heas born in West London, England. He
is the only child of Alan George Radis the only child of Alan George Rad
cliffe, a literary agent, andcliffe, a literary agent, and
Table 19: Daniel Radcliffe, from Wikitext103Valid, retrieval data from c4. The chunks C2C_{2} and C3C_{3} are almost entirely retrieved from neighbours [N1,F1][N_{1},F_{1}] and [N2,F2][N_{2},F_{2}] respectively, up to formatting differences, which dramatically reduces the loss for these tokens. This example illustrates that when training data leaks into evaluation sets despite deduplication, our Retro model can directly exploit this leakage.
View original tableOriginal Table 19
Table 20
Prompt and sample of Retro[Off]Prompt and sample of Retro[On][Nu1,Fu1][N_{u}^{1},F_{u}^{1}] colored by LCP with Cu+1C_{u+1}[Nu2,Fu2][N_{u}^{2},F_{u}^{2}] colored by LCP with Cu+1C_{u+1}
colored by LCP with Ret(Cu−1)\textsc{Ret}(C_{u}{-1})
LCP=\textrm{LCP}= 00, 11, 22, 33,44,⩾5\geqslant 5LCP=\textrm{LCP}= 00, 11, 22, 33,44,⩾5\geqslant 5LCP=\textrm{LCP}= 00, 11, 22, 33,44,⩾5\geqslant 5
Article premier - Les hommesArticle premier - Les hommesde l’homme et du citoyen.ArLes hommes naissent et demeur
naissent et demeurent libres enaissent et demeurent libres eticle 1erLes hommes naissentent libres et égaux en droits.
t égaux en droits. Les distinct égaux en droits. Les distincet demeurent libres et égauxLes distinctions sociales ne
tions sociales ne peuvent êtretions sociales ne peuvent êtreen droits. Les distinctions sopeuvent être fondées que sur l
fondées que sur l’utilité comfondées que sur l’utilité comciales ne peuvent être fondées’utilité commune.Art. 2. -
mune. Article 2. - Le but demune. Article 2. - Le but deque sur l’utilité commune.ALe but de toute association po
toute association politique etoute association politique erticle 2Le but de toute assolitique est la conservation de
st la conservation des droitsst la conservation des droitsciation politique est la conses droits naturels et imprescri
naturels etnaturels etrvation des droits naturels etptibles de l’Homme. Ces droits
imprescriptibles de l’homme.sont la liberté, la propriété
Ces droits sont la liberté, la, la sûreté, et la résistance
propriété, la sûreté, et la rà l’oppression.Art. 3. -Le
ésistance à l’oppression.Artprincipe de toute Souverainet
icle 3Le principe de toute sé réside essentiellement dans
ouveraineté réside essentiellela Nation. Nul corps, nul indi
ment dans la nation. Nul corpsvidu ne peut exercer d’autorit
, nul individu ne peut exerceré qui n’en émane expressément.
d’autorité qui n’enArt
imprescriptibles de l’homme,imprescriptibles de l’homme.criptibles del’homme. Ces droet imprescriptibles de l’homm
et par conséquent la garantieCes droits sont la liberté, laits sont la liberté, la proprie. Ces droits sont la liberté,
à chacun des droits suivantspropriété, la sûreté et la réété, la sûretéet la résistancla propriété, la sûreté et la
: Article 3. - La propriétésistance à l’oppression.Artie à l’oppression.Article 3 -résistance à l’oppression.A
est un droit inviolable et sacle 3.- Le principe de touteLe principe de toute souverairticle 3 - Le principe de tout
cré. Toute personne a le droitsouveraineté réside essentielneté résideessentiellement dae souveraineté réside essentie
de procéder à sa propre conslement dans la nation. Nul corns la Nation. Nul corps, nul illement dans la Nation. Nul co
ervation. Article 4. - Leps, nul individu ne peut exercndividu nepeut exercer d’autorps, nul individu ne peut exer
er d’autorité qui nrité qui n’en émane expressémecer d’autorité qui n’en émane
nt.Article 4 - La liberté coexpressément.Article 4 - La
nsiste à pouvoir faire tout celiberté consiste à pouvoir fai
quine nuit pas à autrui : aire tout ce qui ne nuit pas à a
nsi, l’exercice des droits natutrui : ainsi, l’exercice des
urelsde chaque homme n’a de bdroits naturels de chaque homm
ornes que celles qui assurente n’a de bornes que celles qui
auxautres membres de la sociéassurent aux autres membres d
té la jouissance dee la société la jouissance de
ces mêmes droits. Ces bornes
but de toute association est’en émane expressément.Articmane expressément.Article 4mane expressément.Article 4
la défense des droits de l’homle 4.- La liberté consiste à- La liberté consiste à pouvoi- La liberté consiste à pouvoi
me et du citoyen. Tout citoyepouvoir faire tout ce qui ner faire tout ce qui ne nuit par faire tout ce qui ne nuit pa
n a le droit de participer à lnuit pas à autrui : ainsi, l’es à autrui : ainsi, l’exercices à autrui : ainsi, l’exercice
a direction des affaires publixercice des droits naturels dedes droits naturels de chaquedes droits naturels de chaque
ques. Article 5. - L’impunichaque homme n’a de bornes quhomme n’a de bornes que cellehomme n’a de bornes que celle
té n’a jamais été et ne sera je celles qui assurent aux autrs qui assurent aux autres membs qui assurent aux autres memb
amais une fin en elle-même. L’es membres de la société la jores de la société la jouissancres de la société la jouissanc
impuissance de ces mêmese de ces mêmes droits. Ces bore de ces mêmes droits. Ces bor
nes ne peuvent être déterminéenes ne peuvent être déterminée
s que par la loi.Article 5 -s que par la loi.Article 5 -
La loi n’a le droit de défendLa loi n’a le droit de défend
re que les actions nuisibles àre que les actions nuisibles à
la société. Tout ce qui n’estla société. Tout ce qui n’est
pas défendu par la loi ne peupas défendu par la loi ne peu
t être empêché, et nul ne peutt être empêché, et nul ne peut
être contraint à faire ce qu’être contraint à faire ce qu’
elle nelle n
unité, comme le despotisme, sdroits. Ces bornes ne peuvent
’est toujours révélée être unêtre déterminées que par la l
instrument d’oppression. La tyoi.Article 5.- La loi n’a
rannie qui s’est élue juge sule droit de défendre que les a
prême de la conscience des autctions nuisibles à la société.
res ne peut être jugée. La jusTout ce qui n’est pas défendu
tice se trouve dans la conscipar la loi ne peut être empêc
ence de chaque citoyen,hé, et nul ne peut être
Table 20: Sample - Déclaration des droits de l’homme: Article premier. The Retro[Off] sample has correct syntax and is almost plausible but is hallucinated. The Retro[On] sample is correctly copied from neighbour data, and robustly re-formated according to our prompt.
View original tableOriginal Table 20
Table 21
Prompt and sample of Retro[Off]Prompt and sample of Retro[On][Nu1,Fu1][N_{u}^{1},F_{u}^{1}] colored by LCP with Cu+1C_{u+1}[Nu2,Fu2][N_{u}^{2},F_{u}^{2}] colored by LCP with Cu+1C_{u+1}
colored by LCP with Ret(Cu−1)\textsc{Ret}(C_{u}{-1})
LCP=\textrm{LCP}= 00, 11, 22, 33,44,⩾5\geqslant 5LCP=\textrm{LCP}= 00, 11, 22, 33,44,⩾5\geqslant 5LCP=\textrm{LCP}= 00, 11, 22, 33,44,⩾5\geqslant 5
Pi = 3. 1415926535 8979323846Pi = 3. 1415926535 8979323846“1415926535 8979323846 2643346 2643383279 5028841971 69399
2643383279 5028841971 693993752643383279 5028841971 6939937583279 5028841971 69399375105837510 5820974944 592307816406
10 5820974944 5923078164 0628610 5820974944 5923078164 0628620974944 5923078164 062862089928620899 8628034825 3421170679
20899 8628034825 342117067920899 8628034825 34211706798628034825 342117067982148088214808651 3282306647 0938446
651 3282306647 0938446095 5058095 50582231725359408128 4811
223172 53594081284811174502 8174502 8410270193 8521105559 6
410270193 8521105559 644622948446229489 5493038196 442881097
9 54930381964428810975 66593356659334461 2847564823 378678
4461 2847564823 37867833165 2712019091 4564856692 346
0
8294049602 8988496069 98583498214808651 3282306647 0938446651 3282306647 0938446095 505847 0938446095 5058223172 53594
065 9873246379 9644789435 8628095 5058223172 53594081284811223172 5359408128 4811174502081284811174502 8410270193 85
730709 6540159079 5944069810 5174502 8410270193 8521105559 68410270193 8521105559 6446229421105559 6446229489 5493038196
992965913 7095378412 69378359446229489 549303819644288109789 54930381964428810975 665934428810975 6659334461 2847564
5 6659334461 28434461 2847564823 3786783165 27823 3786783165 27120190914564
12019091 4564856692 346034861856692 3460348610 4543266482 1
0 4543266482 1339360726 024914339360726 0249141273724587006
12737245870066 0631558817 4886 0631558817 4881520920 962829
1520920 9628292540 917153642540 91715364367892590360
10 6940372045 7088679512 856127564823 3786783165 271201909123 3786783165 2712019091 4564165 27120190914564856692 3460
30857 9046461290 9276642155 564564856692 3460348610 45432664856692 3460348610 4543266482 1348610 4543266482 1339360726 0
54603269 5656128798 636647570582 1339360726 024914127372458339360726 02491412737245870062491412737245870066 063155881
6294954741 5886335339 5765770066 0631558817 4881520920 966 0631558817 4881520920 9628297 4881520920 9628292540 917153
28292540 917152540 9171536436 7892590360 0164367892590360 0113305305 488
13305305 4882046652 13841469512046652 1384146951 9415116094
94151160943305727036 57595913305727036 5759591953 09218611
953 0921861173 8193261179 310573 8193261179 310511854807446
118548 0744623799 62749523799 6274956735 1885752724 89
1227
76345 5770886953 7988876910 79364367892590360 0113305305 48
66169745 6493974637 634580155082046652 1384146951 9415116094
6663542854 6333764630 63562843305727036 5759591953 0921861
271 7885339804 5672434173 8193261179 31051185480744
623799 6274
Table 21: Sample - Decimals of π\pi. The Retro[Off] sample quickly diverges two digits after the end of the prompt whereas Retro[On] correctly outputs a large number of π\pi digits, directly copied from the neighbours data.
View original tableOriginal Table 21