How Much Knowledge Can You Pack Into the Parameters of a Language Model? (2020)

Abstract: It has recently been observed that neural language models trained on unstructured text can implicitly store and retrieve knowledge using natural language queries. In this short paper, we measure the practical utility of this approach by fine-tuning pre-trained models to answer questions without access to any external context or knowledge. We show that this approach scales with model size and performs competitively with open-domain systems that explicitly retrieve answers from an external knowledge source when answering questions. To facilitate reproducibility and future work, we release our code and trained models.

## introduction big, deep neural language models that have been pre-trained on unlabeled text have proven to be extremely performant when fine-tuned on downstream natural language processing (nlp) tasks @xcite @xcite @xcite . interestingly, it has also recently been observed that these models can internalize a sort of implicit "knowledge base" after pre-training @xcite @xcite . this behavior is potentially useful because 1) the knowledge is built up by pre-training on unstructured and unlabeled text data, which is freely available in huge quantities on the internet @xcite , and 2) it is possible to retrieve information using informal natural language queries since these pre-trained language models excel when fine-tuned on natural language understanding tasks. t5 d. roosevelt @xmath0. roosevelt born? t5 1882 president franklin d. roosevelt was born in january 1882. ## background question answering the task of training a model to either select or output the correct answer to a given question is referred to as "question answering". the most popular variant of this task feeds the model some "context" containing the answer (for example, a paragraph from an encyclopedia article) alongside the question @xcite @xcite . models can be trained either to indicate the span of the context that contains the answer or output the text of the answer itself. since this format can be seen as reading some text and answering a question about it, it has been referred to as "reading comprehension". a more difficult variant is "open-domain question answering" @xcite , where the model can be asked arbitrary context-independent questions (e.g. well-known facts or historical details). it is typically assumed that the model can access an external collection of knowledge when answering questions (e.g. a structured knowledge base or unstructured text corpus), but the model is not given any information about where in the collection the answer appears. the reading comprehension task can be considered a simplified version of open-domain question answering where the model is provided with the oracle context to answer a given question. as an analogy, the open-domain question answering system acts as if it is taking an open-book exam where it can find and use infor-mation in an external source of knowledge. 2 in this work, we consider open-domain question answering with the additional constraint that the model is not allowed to access any external knowledge whatsoever when answering questions. instead, the model itself must be pre-trained to store knowledge in its parameters before being fine-tuned to answer questions. in one view, this can be seen as an alternative way to approach open-domain question answering where instead of learning to access external knowledge the model needs to have "memorized" it in order to answer questions; in another view, this constraint creates a third and potentially more ambitious variant of the question answering task. a model that answers questions in this way is metaphorically similar to a student taking a closed-book exam, where the student must study and memorize all pertinent information before taking the test. transfer learning with language models in the past few years, it has become increasingly common to pre-train a language model using an unsupervised objective on a large, unstructured text corpus before fine-tuning it on a downstream task of interest @xcite @xcite . the popularity of this form of "transfer learning" is attributable to its empirical success on many nlp tasks @xcite @xcite @xcite . loosely speaking, the pre-training step may provide the model with some generally-useful awareness of meaning, syntax, and "world knowledge". in question answering in particular, most state-ofthe-art systems use some form of transfer learning. currently, the most popular model architectures used in transfer learning for nlp are transformerbased @xcite "encoder-only" models like bert @xcite . these models can produce a single prediction for each input token and have been applied to reading comprehension-style question answering by predicting which tokens of the context contain the answer. encoder-only models are not applicable to closed-book question answering because no context is provided to extract the answer span from. an alternative to encoder-only models, recently advocated by @xcite , is to treat ev-ery nlp task as a text-to-text problem using an encoder-decoder transformer. when this framework is applied to question answering, the model is trained to generate the literal text of the answer in a free-form fashion. despite the potential difficulty of generating rather than extracting the answer, @xcite demonstrated state-ofthe-art results on the squad @xcite , multirc @xcite , boolq @xcite , and record @xcite reading comprehension tasks. the text-to-text framework is directly applicable to closed-book question answering since the model can be trained to generate an answer with or without any additional information in its input. crucially, fine-tuning a text-to-text model to answer questions without any context requires that the model retrieve information from its parameters that it learned during pre-training. @xcite considered a similar task to evaluate the zero-shot question answering capabilities of a language model. the concurrent "relic" and "eae" models of @xcite and févry et al. (2020) learn representations for an explicitly predefined set of entities and are evaluated on the same closed-book variant of triviaqa that we consider. relatedly, @xcite show that it is possible to manually convert some questions to a fill-in-the-blank format amenable to an encoder-only model (e.g. "who developed the theory of relativity?" gets mapped to "the theory of relativity was developed by "). in this work, we only make use of the questions from each dataset -we completely ignore the matching documents supplied for each question. for webquestions and triviaqa we follow the standard evaluation procedures where each pre-dicted answer is compared to the ground-truth after both are lowercased and stripped of articles, punctuation, and duplicate whitespace @xcite . for natural questions, we evaluate using both 1) the standard "opendomain" version as used e.g. by @xcite @xcite where the model is only required to produce a single normalized answer and 2) the standard multi-answer variant used with reading comprehension systems @xcite . we review the details of natural questions evaluation in appendix a. note that natural questions and triviaqa have private test sets, so standard practice on their opendomain variants is to report performance on the development sets. however, we also include our results on the official triviaqa test set by finetuning on the unfiltered training set and submitting our test set predictions to the leaderboard for the wikipedia domain. we urge future work to adopt this approach to help ensure the validity of results and avoid potentially overfitting to a public set. training we leverage the pre-trained models provided by @xcite , referred to as the "text-to-text transfer transformer" (t5). the original t5 models were pre-trained on a multitask mixture including an unsupervised "span corruption" task on the c4 dataset as well as supervised translation, summarization, classification, and reading comprehension tasks. note that none of the reading comprehension datasets used for pre-training t5 overlap with the question answering datasets that we consider in this paper. in order to measure how performance scales with model size, we perform experiments with the base (220 million parameters), large (770 million), 3b (3 billion), and 11b (11 billion) variants of t5. given that the t5 models were pre-trained on a multitask mixture including question answering, we also report performance using the "t5.1.1" checkpoints, which were pre-trained on unlabeled data only. 3 for fine-tuning the t5 checkpoints, we follow the procedure used in @xcite without any additional hyperparameter tuning: we use the adafactor optimizer @xcite with a constant learning rate of 0.001, 10% dropout rate, and a batch size of 196,608 tokens. we halve the batch and double the dropout rate for webquestions due to its small size. for the t5.1.1 checkpoints, we follow the same procedure but with a dropout rate of 5% for all three datasets. for evaluation, we follow the procedure used in @xcite : for each dataset, we hold out 10% of the training set as a validation split, finetune a model from the remaining 90% of examples, and select the best-performing checkpoint for final evaluation on the test set. while we chose to train for 20,000 steps, our validation accuracy typically plateaued after only a few hundred steps and showed no signs of overfitting. we decode the model's predictions by choosing the most likely token at each timestep. to map question answering tasks to the text-to-text format, we simply feed the question with a task-specific prefix into the model as input and train it to predict the literal answer text as output. salient span masking recently, @xcite found that a "salient span masking" (ssm) pre-training objective produced substantially better results in open-domain question answering. this approach first uses bert @xcite to mine sentences that contain salient spans (named entities and dates) from wikipedia. the question answering model is then pre-trained to reconstruct masked-out spans from these sentences, which @xcite hypothesize helps the model "focus on problems that require world knowledge". we experimented with using the same ssm data and objective to continue pretraining the t5 checkpoints for 100,000 additional steps before fine-tuning for question answering. ## conclusion in this short paper, we have shown that large language models pre-trained on unstructured text can attain competitive results on open-domain question answering benchmarks without any access to external knowledge. this suggests a fundamentally different approach to designing question answering systems, motivating many threads for future work: first, we obtained state-of-the-art results only with the largest models which had around 11 billion parameters. this model size can be prohibitively expensive in resource-constrained settings, prompting future work on more efficient language models. second, "open-book" models typically provide some indication of what information they accessed when answering a question. this can provide a useful form of interpretability. in contrast, our model distributes knowledge in its parameters in an inexplicable way and hallucinates realistic-looking answers when it is unsure. third, the maximum-likelihood objective used to train our model provides no guarantees as to whether a model will learn a fact or not. this makes it difficult to ensure that the model obtains specific knowledge over the course of pre-training and prevents us from explicitly updating or removing knowledge from a pre-trained model. finally, the tasks we used in this paper mainly measure "trivia"-style knowledge. we are therefore interested in measuring performance on question answering tasks that require reasoning capabilities such as drop @xcite .