Generated Knowledge Prompting for Commonsense Reasoning (2022)

Abstract: It remains an open question whether incorporating external knowledge benefits commonsense reasoning while maintaining the flexibility of pretrained sequence models. To investigate this question, we develop generated knowledge prompting, which consists of generating knowledge from a language model, then providing the knowledge as additional input when answering a question. Our method does not require task-specific supervision for knowledge integration, or access to a structured knowledge base, yet it improves performance of large-scale, state-of-the-art models on four commonsense reasoning tasks, achieving state-of-the-art results on numerical commonsense (NumerSense), general commonsense (CommonsenseQA 2.0), and scientific commonsense (QASC) benchmarks. Generated knowledge prompting highlights large-scale language models as flexible sources of external knowledge for improving commonsense reasoning. Our code is available at github.com/liujch1998/GKP

## introduction it remains an open research question whether external knowledge is needed for commonsense reasoning. on one hand, a substantial body of prior work has reported that integrating external knowledge can help improve task performance @xcite , especially if the knowledge is high quality (e.g. hand-crafted by experts). on the other hand, recent leaderboards are often dominated by large-scale pretrained models that are fine-tuned on a target benchmark @xcite , suggesting that the benefits of external knowledge may wash away as the underlying models increase in size and are pretrained on ever larger amounts of raw text. even if external knowledge is found to be effective on a particular task, flexibility remains a fundamental hurdle to integrating external knowl-figure 1 : generated knowledge prompting involves (i) using few-shot demonstrations to generate questionrelated knowledge statements from a language model; (ii) using a second language model to make predictions with each knowledge statement, then selecting the highest-confidence prediction. in this paper, we investigate whether external knowledge can be helpful for commonsense reasoning, even on top of the largest state-of-the-art pretrained models (e.g. t5-11b @xcite and its variants), with a focus on four recent commonsense benchmarks. to facilitate easier adaptation with any zero-shot or finetuned models, we propose an approach that does not require access to a structured knowledge base or joint finetuning for knowledge integration. the key insight behind our method, generated knowledge prompting (sketched in figure 1 ), is that we can generate useful knowledge from a language model, then provide the knowledge as an input prompt that is concatenated with a question. to dataset question / knowledge prediction score numersense the word children means [m] or more kids. one 0.37 | 0.35 the word child means one kid. two 0.91 csqa she was always helping at the senior center, it brought her what? feel better 0.97 | 0.02 people who help others are usually happier. happiness 0.98 csqa2 part of golf is trying to get a higher point total than others. yes 1.00 | 0.00 the player with the lowest score wins. no 1.00 qasc sponges eat primarily cartilage 0.95 | 0.00 sponges eat bacteria and other tiny organisms. experiments show that our method improves both zero-shot and finetuned models on numerical commonsense (numersense (lin et al., 2020)), general commonsense (commonsenseqa @xcite , commonsenseqa 2.0 @xcite ), and scientific commonsense (qasc @xcite ) benchmarks, setting a new state-ofthe-art on three of these datasets. it outperforms the template-based knowledge generation method self-talk @xcite , while performing comparably to retrieval-based systems. we find three factors contribute to the performance of generated knowledge prompting: (i) the quality of knowledge, (ii) the quantity of knowledge where the performance improves with more knowledge statements, and (iii) the strategy for integrating knowledge during inference. our qualitative analysis suggests that the generated knowledge statements cover a variety of types, and can transform commonsense question answering to explicit reasoning procedures, e.g. deduction, that are supported by off-the-shelf and finetuned language models. ## generated knowledge prompting a multiple-choice commonsense reasoning task involves predicting an answer @xmath0, where the set of choices a q is finite and can vary by question, and both questions and answers are variable-length text sequences. our method answers commonsense questions in two steps. the first step is knowledge generation, where we use a language model p g (k|q) to generate knowledge statements conditioned on the question: the second step is knowledge integration, where generated knowledge is integrated into the decision process of a language model used for inference, â = arg max @xmath1, k q ) in contrast, the vanilla setting of using the inference model without knowledge is represented by â = arg max @xmath2. next, we describe the knowledge generation and integration steps in detail. ## experimental setup here, we describe the implementation details of our method and how they are adapted to each task. for knowledge generation, we use @xcite as the underlying language model, where our few-shot prompting method is most effective. we generate @xmath3.5 @xcite , and discard repetitions and empty strings. generation is terminated when it exceeds 64 tokens or hits the \n token. 1 for inference, we use off-the-shelf t5 @xcite and gpt-3, as well as finetuned models that are state-of-the-art on each dataset, including unifiedqa (uqa) @xcite and unicorn @xcite . see details in the task setup below. ## experimental results as we will show, our generated knowledge prompting method sets new state-of-the-art results on most datasets we evaluate on, and works well under both zero-shot and finetuned settings. in particular, our knowledge generation outperforms naive baselines as well as template-based knowledge generation, and is on-par with retrieval-based systems. ## related work knowledge can be elicited from pretrained language models. numerous works have shown that pretrained language models implicitly contain a large amount of knowledge that can be queried via conditional generation @xcite @xcite . consequently, these models can directly perform inference on tasks like commonsense reasoning @xcite ), text classification @xcite , and natural language inference @xcite . inspired by these observations, we elicit question-related knowledge in an explicit form from language models and use them to guide the inference. leveraging external knowledge for commonsense reasoning. some work uses external commonsense knowledge bases to make improvements on various nlp tasks, including commonsense reasoning. one approach is to inject commonsense knowledge into language models, either by pretraining on knowledge bases @xcite @xcite or finetuning the model so that it can reason with additional retrieved knowledge @xcite @xcite . another di-rection is to ground the question into a knowledge graph and do inference with graph-based reasoning @xcite @xcite . a common prerequisite of these methods is a high-quality, high-coverage, in-domain commonsense knowledge base @xcite . some commonsense reasoning datasets are derived from existing knowledge bases; for example, common-senseqa @xcite is derived from conceptnet @xcite , and social iqa @xcite is derived from atomic @xcite . for such datasets, it is natural to elicit related knowledge from the underlying knowledge base that derived them, and typically this would demonstrate considerable gains @xcite . however, if there is a domain mismatch between the dataset and the knowledge base, such gains tend to diminish @xcite . this becomes a bottleneck when encountering datasets that have no suitable knowledge base (e.g. numersense @xcite and commonsenseqa 2.0 @xcite ), or when the system needs to handle commonsense queries that do not fit in any of the commonsense domains represented by an existing knowledge base. our work overcomes this diffi-culty by leveraging pretrained language models as the source of commonsense knowledge. adding generated text during inference. recently, several works show that model performance on commonsense reasoning can be boosted by augmenting the question with model-generated text, such as clarifications, explanations, and implications. self-talk @xcite elicits clarifications to concepts in the question and appends them to the inference model input. contrastive explanations @xcite prompts inference models with generated explanations that contrast between two answer choices. the aforementioned methods depend on task-specific templates to inquire the generator, which means they are only capable of eliciting a limited variety of knowledge and require careful hand-crafting to transfer to new tasks. other explanation-based methods @xcite finetune the generator model so that it produces explanations that are used for question augmentation. dynagen @xcite uses pretrained commonsense models to generate implications of a question and expands the inference input with these generations. however, its usage of comet @xcite as the generator confines its applicability to the social commonsense domain. our work contributes to this general line of research, yet different from these previous methods that elicit knowledge with task-specific templates or from finetuned knowledge generators, our method requires only a few human-written demonstrations in the style of the task, making it much more flexible, easy-to-transfer, and engineering-efficient. ## conclusion we introduce generated knowledge prompting, a simple method to elicit and integrate knowledge from language models so as to improve performance on commonsense reasoning tasks. in particular, we generate knowledge statements by prompting a language model with task-specific, humanwritten, few-shot demonstrations of questionknowledge pairs. we show that knowledge can be integrated by simply plugging it in at inference time, with no need to finetune the model for knowledge integration. our method shows effectiveness across multiple datasets, sets the new state-of-theart on three commonsense reasoning tasks, and works under a variety of settings. the method's success highlights language models as sources of flexible, high-quality knowledge for commonsense reasoning.