Can Generative Pre-trained Language Models Serve As Knowledge Bases for Closed-book QA ? (2021)

Abstract: Recent work has investigated the interesting question using pre-trained language models (PLMs) as knowledge bases for answering open questions. However, existing work is limited in using small benchmarks with high test-train overlaps. We construct a new dataset of closed-book QA using SQuAD, and investigate the performance of BART. Experiments show that it is challenging for BART to remember training facts in high precision, and also challenging to answer closed-book questions even if relevant knowledge is retained. Some promising directions are found, including decoupling the knowledge memorizing process and the QA finetune process, forcing the model to recall relevant knowledge when question answering.

## introduction large-scare pre-trained language models (plms) such as bert @xcite , gpt @xcite have significantly improved the performance of nlp tasks @xcite . there is increasing evidence showing that plms contain world knowledge @xcite @xcite . as a result, recent research considers generative plms such as t5 @xcite and bart @xcite for closed-book qa, which has only question-answer pairs without external knowledge source. for example, after being finetuned on a few qa pairs, a generative lm can directly output "florence" after being given the question "where was dante born?". @xcite find that generative plms can store and use knowledge as they can achieve relatively high performance in closed-book qa task on three datasets. however, @xcite find that the excellent results are mainly due to high question/answer overlap rates between training and testing data. existing research leaves many open questions on the potential of generative pre-trained lms on closed-book qa. for example, the used datasets consist of question-answer pairs only, and there is no mechanism to control what factual knowledge is already used to train a generative plm before taking the closed-book questions. in addition, the high overlapping rates between training and testing questions and answers make it difficult to understand whether the answer that a model gives comes from its inherent knowledge or superficial cues in training data. to address these issues, we make a new benchmark of question-answer pairs from squad @xcite , where each ques-tion has a corresponding wikipedia passage as a traceable knowledge source for pre-training. we find that despite giving around 25% accuracy on existing test sets (i.e., webquestions and triviaqa), bart gives only 1.5% accuracy on the squad dataset. this result shows that there is still much challenge in using bart for closed-book qa directly. we further investigate the reason by separately examining whether bart can remember factual knowledge accurately, and whether it can make use of remembered knowledge to answer questions. the general process of investigating these two issues is presented in figure 1 . for the first issue, we use related passages in squad to further extra pre-train bart, which we call as lm-finetuning, and test the ratio of retained factual knowledge using a language modeling task, which we call as reciting. results show that as the number of training passages grows, bart demonstrates severe issues of forgetting, losing track of exact facts in the lm task. for example, when the number of passage is around 500, bart can memorize 66% needed knowledge. but when the number of passage increases to about 5000, the ratio becomes 4%. for the second issue, we use versions of lmfinetuned bart that can retain the majority of factual knowledge for further qa finetuning, by constraining the number of passages. although all the training and testing questions concern the passages in lm-finetuning, bart still fails to answer the majority of questions. this demonstrates difficulties in making use of internal knowledge for qa. in addition, further experiments show that qa finetuning can negatively influence the retained factual knowledge as measured using the original lm task. while reporting such challenges, we also find some promising directions by using simple data augmentation tricks. for example, simply adding related passages to test outputs can help bart retrieve relevant factual knowledge and give the correct answer. in addition, rather than treating qa finetuning in the same way as lm pre-training @xcite , decoupling the lm pretraining task and the qa finetuning tasks can also allow a model to better retain factual knowledge through the qa-finetuning task. in the closed-book qa task @xcite , a model needs to answer questions without external resources. formally, the input is a question q, and the output is a sequence of tokens o. for evaluation, the correct golden answer g will be compared with o. previous work @xcite uses the exact match (em) metric to score o against g. we conduct closed-book qa by using the bart model @xcite on four datasets-webquestions @xcite , triv-iaqa @xcite , naturalquestions @xcite and squad2 @xcite . bart is a transformer-based @xcite sequence-to-sequence generative plm, which we choose because it has achieved several state-of-the-art results on generative tasks. we use the publicly released checkpoint bart-large in this work. 2 to use a generative plm on each dataset, the model is first finetuned using the training question-answer pairs. we call this process as qafinetuning. while the other three datasets are used by following previous work @xcite , we make a novel adaptation of the squad dataset for closed-book qa. squad @xcite is a wildly-adopted qa dataset typically for extractive qa, where the input is a question to- for triviaqa and webquestions, many questions have multiple answers. in order to align with the other two data sets, we split one question with several answers into several same questions with one answer when training, and take one test output as correct if it appears in the answer list when testing. as the test sets of squad, naturalquestions and triviaqa are not fully publicly released yet and webquestions does not have a development set, we split the development set of the three datasets and the test set of webquestions into two subsets to serve as a new development set and a new test set. we report performance on the new test sets in previous work shows that t5 and bart can achieve promising results @xcite on webquestions, triviaqa and naturalquestions. however, recently, @xcite find that the high performance is mainly because the three datasets have severe testtrain overlap problems. in particular, we use an- the breakdown statistics are given in ## task design the original purpose of previous research @xcite is to use pretrained language models (plms) as knowledge bases (kbs) and answer questions according to internal knowledge the model contains. however, if the model tends to match test questions with training questions for retrieving answers, then the source of knowledge is restricted to training questions. this deviates from the ultimate goal. we are interested in quantitatively measuring the capability of pre-trained model in closed-book qa using its own internal knowledge from pretraining. this capability can be broken down into two components. first, the capability of a memorizing knowledge from pre-training. second, the ability of retrieving memorized knowledge for question answering. we show investigations and report the results in the two sections below. ## knowledge memory to investigate whether bart can acquire and store knowledge from raw corpus, we use passages from squad to finetune the bart model, which we call lm-finetuning. this period can be seen as figure 3 : examples of two types of mask policies in training and testing periods of lm-finetuning. the passage masked randomly is for training and the passage masked with answer spans is for testing (reciting). training of lm-finetuning. we follow the original training objective of bart for the mlmfinetune step, which is a denoising auto-encoding process. the original bart training objective involves five operations, namely token masking, sentence permutation, document rotation, token deletion and text infilling @xcite . we only adopt token infilling in this work because it shows benefits on all downstream tasks @xcite . in addition, the sentence permutation task is shown harmful for tasks despite only being useful for text summarization @xcite . for each input passage, we randomly mask 30% tokens following @xcite . an example is shown in the third row of figure 3 . we ask the model to recover the passage as the output, and use the output and the original passage to compute loss. ## question answering we employ the settings in the first three columns in ## related work there are two types of pre-trained language models (plms), discriminative plms such as bert @xcite , elmo @xcite and generative plms such as gpt @xcite , bart @xcite . the key difference is that generative plms are of encoderdecoder architectures so they can generate text sequences of any length or token. an increasing number of works have shown that plms contains world knowledge. @xcite first solves that discriminative plms such as bert @xcite can be used for cloze-style qa using a mask language modeling task without external resources, such as "dante was born in @xcite ." → "florence". their results show that plms have certain factual knowledge. talmor et al. (2020) set eight types of cloze-style qa, such as 'always-never' and 'age com-parison', to test different types of knowledge in several discriminative plms, including bert and roberta @xcite . they also use the mask language modeling task to do qa without finetuning, and results show that the evaluated plms indeed contain those kinds of knowledge. wang et al. (2019); zhou et al. (2020) adopt some discriminative plms on commonsense reasoning qa tasks such as comve @xcite and swag @xcite without finetuning, indicating the plms have commonsense knowledge. @xcite show that pretrained transformer models can be used to help construct commonsense knowledge graphs, such as conceptnet @xcite . however, @xcite argue that bert uses some superficial cues such as stereotypical characters to solve factual questions. @xcite seems to have ability to answer factual questions in zeroshot setting, but there exists some evidence that gpt-3 is limited in storing and using knowledge @xcite . @xcite firstly use closed-book qa to detect how much knowledge is in pre-trained language models' parameters. they perform experiments on three datasets webquestions @xcite , triviaqa @xcite and nat-uralquestions @xcite by t5 model @xcite . the results are relatively pleasant. however, @xcite find that the high performance of @xcite is mainly due to the high test-train overlap of the three datasets rather than the model's internal knowledge. our findings confirm the conclusions of @xcite , and we further experiment with a more controlled squad dataset, and discussed the weakness of bart in both memorization and knowledge retrieval. because t5 @xcite ) is more resource demanding, considering the balance of effectiveness and experimental feasibility, we choose bart rather than the t5 model. different from closed-book qa, where no additional resource is available when answering questions, open-domain qa requires models to generate a sequence of tokens as the answer to each question by looking up related text from unstructured documents @xcite . @xcite first try to retrieve related passages from wikipedia for each question and encode both the question and passages into the model, then output the answer. @xcite integrate the retrieval process into pre-training process, helping the plms better retrieve information from external knowledge source when needed, and finding benefits on opendomain qa task. retriever-based models have the advantage of relieving the burden of pre-trained language models to remember every factual detail. the retrieval qa setting is slightly reminiscent to our data augmentation setting in figure 4 , but with the related passage being the input, rather than the output. in contrast, the settings we consider fully rely on a neural model for all knowledge. squad @xcite is a widely-used dataset for machine reading comprehension, which is also a type of qa task. it asks models to use a text span from a given referential passage to answer questions. it is also used in other type of qa task, for example, @xcite adopt it in the open-domain qa task. we first apply it on closed-book qa and analyze why it is superior than other three commonly used datasets. ## conclusion we investigated by using squad, finding that closed-book qa is still challenging for generative pre-trained language models such as bart. the challenge lies both in remembering the knowledge details and in answering the questions after remembering the knowledge. potential solutions include explicitly asking models to recall relevant knowledge when answering questions and decoupling lm-finetuning process and qa-finetuning process.