<?xml-model href='http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng' schematypens='http://relaxng.org/ns/structure/1.0'?><TEI xmlns="http://www.tei-c.org/ns/1.0">
	<teiHeader>
		<fileDesc>
			<titleStmt><title level='a'>The Unreliability of Explanations in Few-shot Prompting for Textual Reasoning</title></titleStmt>
			<publicationStmt>
				<publisher></publisher>
				<date>2022</date>
			</publicationStmt>
			<sourceDesc>
				<bibl> 
					<idno type="par_id">10380030</idno>
					<idno type="doi"></idno>
					<title level='j'>Advances in neural information processing systems</title>
<idno>1049-5258</idno>
<biblScope unit="volume"></biblScope>
<biblScope unit="issue"></biblScope>					

					<author>Xi Ye</author><author>Greg Durrett</author>
				</bibl>
			</sourceDesc>
		</fileDesc>
		<profileDesc>
			<abstract><ab><![CDATA[Does prompting a large language model (LLM) like GPT-3 with explanations improve in-context learning? We study this question on two NLP tasks that involve reasoning over text, namely question answering and natural language inference. We test the performance of four LLMs on three textual reasoning datasets using prompts that include explanations in multiple different styles. For these tasks, we find that including explanations in the prompts for OPT, GPT-3 (davinci), and InstructGPT (text-davinci-001) only yields small to moderate accuracy improvements over standard few-show learning. However, text-davinci-002 is able to benefit more substantially. We further show that explanations generated by the LLMs may not entail the models' predictions nor be factually grounded in the input, even on simple tasks with extractive explanations. However, these flawed explanations can still be useful as a way to verify LLMs' predictions post-hoc. Through analysis in our three settings, we show that explanations judged by humans to be good---logically consistent with the input and the prediction---more likely cooccur with accurate predictions. Following these observations, we train calibrators using automatically extracted scores that assess the reliability of explanations, allowing us to improve performance post-hoc across all of our datasets.]]></ab></abstract>
		</profileDesc>
	</teiHeader>
	<text><body xmlns="http://www.tei-c.org/ns/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
<div xmlns="http://www.tei-c.org/ns/1.0"><p>Figure <ref type="figure">1</ref>: Prompting GPT-3 with explanations. By including explanations in the in-context examples, we can cause GPT-3 to generate an explanation for the test example as well. In this case, the generated explanation is nonfactual, despite the simple reasoning involved here. However, we show this nonfactuality actually provides a signal that can help calibrate the model.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="1">Introduction</head><p>Recent scaling of pre-training has empowered large language models (LLMs) to learn NLP tasks from just a few training examples "in context," without updating the model's parameters <ref type="bibr">(Brown et al., 2020)</ref>. However, this learning process is still poorly understood: models are biased by the order of in-context examples <ref type="bibr">(Zhao et al., 2021)</ref> and may not leverage the instructions or even the labels of the examples in the ways one expects <ref type="bibr">(Min et al., 2022;</ref><ref type="bibr">Webson and Pavlick, 2022)</ref>. Existing tools for interpreting model predictions have high computational cost <ref type="bibr">(Ribeiro et al., 2016)</ref> or require access to gradients <ref type="bibr">(Simonyan et al., 2014;</ref><ref type="bibr">Sundararajan et al., 2017)</ref>, making them unsuitable for investigating in-context learning or explaining the predictions of prompted models.</p><p>One appealing way to gain more insight into predictions obtained through in-context learning is to let the language model "explain itself" <ref type="bibr">(Nye et al., 2021;</ref><ref type="bibr">Wei et al., 2022;</ref><ref type="bibr">Chowdhery et al., 2022;</ref><ref type="bibr">Marasovi&#263; et al., 2022;</ref><ref type="bibr">Lampinen et al., 2022)</ref>. In addition to input-label training pairs in context, one can prompt the language model with an explanation for each pair and trigger the model to generate an explanation for its prediction (Figure <ref type="figure">1</ref>). Prompting with explanations introduces much richer information compared to using labels alone, which might guide the inference process and allow the model to learn more information from the examples.</p><p>In this work, we investigate the nature of the explanations that LLMs generate and whether they can improve few-shot in-context learning for textual reasoning tasks, specifically QA and NLI. Recent prior work that finds success with this approach largely targets symbolic reasoning tasks with a very different structure, such as math word problem solving <ref type="bibr">(Nye et al., 2021;</ref><ref type="bibr">Wei et al., 2022)</ref>. We experiment on three different datasets spanning QA and NLI with four LLMs: OPT, , , and text-davinci-002. The results suggest that explanations only substantially improve accuracy for text-davinci-002, but give a smaller improvement or even hurt the performance with the other LLMs.</p><p>Surprisingly, we find that the explanations generated by LLMs can be unreliable, even for a very simple synthetic dataset. We evaluate the explanations along two axes: factuality, whether the explanation is correctly grounded in the input, and consistency, whether the explanation entails the final prediction. LLMs tend to generate consistent explanations that account for the predictions, but the explanations may not be factual, as as shown in Figure <ref type="figure">1</ref>. Furthermore, our analysis suggests an unreliable explanation more likely indicates a wrong prediction compared to a reliable explanation.</p><p>Despite LLMs' failures here, we can still benefit from model-generated explanations by using them for calibration. If we are able to automatically assess the reliability of an explanation, we can allow an LLM to return a null answer when its explanation is unreliable, since the prediction in this case is less likely to be correct. Unfortunately, there is no automated way to perfectly assess the reliability, but we can extract features that approximately reflect it. We use these features to calibrate InstructGPT's<ref type="foot">foot_2</ref> predictions, and successfully improve the in-context learning performance across all the datasets. In summary, our main findings are: (1) Simply plugging explanations into the prompt does not always substantially boost the in-context learning performance for textual reasoning. (2) LLMs generate explanations consistent with their predictions, but these explanations might not be factually grounded in the inputs. (3) The factuality of an explanation can serve as an indicator for the correctness of the corresponding prediction. (4) Using features that can approximate the factuality of explanations, we successfully use explanations to improve the in-context learning performance across all tasks.</p><p>2 Does Prompting with Explanations Improve In-Context Learning?</p><p>In this paper, we specifically focus on tasks involving reasoning over natural language. These are tasks where explanations have been traditionally studied <ref type="bibr">(Camburu et al., 2018;</ref><ref type="bibr">Rajani et al., 2019)</ref>, but which are more complex than tasks like sentiment analysis which are well explained by extractive rationales <ref type="bibr">(Zaidan et al., 2007;</ref><ref type="bibr">DeYoung et al., 2020)</ref>. We experiment on two tasks, SYNTH Context: Christopher agrees with Kevin. Tiffany agrees with Matthew. Mary hangs out with Danielle. James hangs out with Thomas. Kevin is a student. Matthew is a plumber. Danielle is a student. Thomas is a plumber. Question: Who hangs out with a student?</p><p>Answer: Mary Explanation: Danielle is a student and Mary hangs out with Danielle.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>E-SNLI</head><p>Premise: A toddler in a green jersey is being followed by a wheelchair bound woman in a red sweater past a wooden bench. Hypothesis: A toddler is walking near his wheelchair bound grandmother.</p><p>Label: Neither Explanation: the woman may not be his grandmother.</p><p>Figure <ref type="figure">2:</ref> A SYNTH example and an E-SNLI example. See Figure <ref type="figure">3</ref> for ADVHOTPOT examples.</p><p>reading comprehension question answering (QA) and natural language inference (NLI), on three English-language datasets. For each dataset, we create a test set with 250 examples.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2.1">Datasets</head><p>Synthetic Multi-hop QA (SYNTH) In order to have a controlled setting where we can easily understand whether explanations are factual and consistent with the answer, we create a synthetic multi-hop QA dataset. Shown in Figure <ref type="figure">2</ref>, each example in this dataset asks a bridge question (using the terminology of <ref type="bibr">Yang et al. (2018)</ref>) over a context consisting of supporting facts paired with controlled distractors. This dataset is carefully designed to avoid spurious correlations, giving us full understanding over the correct reasoning process and the explanation for every example, which naturally consists of the two supporting sentences. See Appendix B for full details of this dataset. <ref type="foot">3</ref>Adversarial HotpotQA (ADVHOTPOT) We also test on the English-language Adversarial Hot-potQA dataset <ref type="bibr">(Yang et al., 2018;</ref><ref type="bibr">Jiang and Bansal, 2019)</ref>. We use the adversarially augmented version since InstructGPT achieves high performance on the distractor setting of the original dataset. We make a challenging set of examples by balancing sets of questions on which InstructGPT makes correct and incorrect predictions. The context of each question includes two ground truth supporting paragraphs and two adversarial paragraphs. Full details of preprocessing the ADVHOTPOT dataset can be found in Appendix C.</p><p>For ADVHOTPOT, we manually annotated explanations for the training examples. Figure <ref type="figure">1</ref> shows an example of such an explanation, highlighted in orange. We could use the supporting sentences as the explanations, but we found they are usually too verbose and not sufficient, e.g., with anaphors that resolve outside of the supporting sentences. Therefore, we manually annotate a set of explanations which clearly describe the reasoning path for each question.</p><p>E-SNLI E-SNLI <ref type="bibr">(Camburu et al., 2018)</ref> is an English-language classification dataset commonly used to study explanations, released under the MIT license. Shown in Figure <ref type="figure">2</ref>, each example consists of a premise and a hypothesis, and the task is to classify the hypothesis as entailed by, contradicted by, or neutral with respect to the premise. As a notable contrast to the other datasets, the explanations here are more abstract natural language written by human annotators, as opposed to mostly constructed from extracted snippets of context.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2.2">Baselines</head><p>We study the effectiveness of plugging in explanations by comparing the in-context learning performance of prompting with or without explanations. Prompting without explanations resembles the standard few-shot in-context learning approach (Few-Shot). To incorporate explanations into the prompt, we consider the following two most commonly used paradigms:</p><p>Explain-then-Predict (E-P) prepends an explanation before the label (Figure <ref type="figure">1</ref>). The language model is expected to generate an explanation first followed by the prediction. The prompting style of past work involving computational traces can be categorized into this paradigm, including <ref type="bibr">Nye et al. (2021)</ref> and <ref type="bibr">Wei et al. (2022)</ref>. This approach is also called a pipeline model in other literature on training models using explanations <ref type="bibr">(Jacovi and Goldberg, 2021;</ref><ref type="bibr">Wiegreffe et al., 2021)</ref>. Predict-then-Explain (P-E) generates the explanation after the prediction. Unlike E-P, the predicted explanation does not influence the predicted label, since we use greedy inference and the explanation comes afterwards. However, the explanations in the prompt still impact the predictions.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2.3">Setup</head><p>For few-shot learning, we use roughly the maximum allowed shots in the prompt that can fit the length limit of OPT <ref type="bibr">(Zhang et al., 2022)</ref> and GPT-3 <ref type="bibr">(Brown et al., 2020)</ref>, which is 16 for SYNTH, 6 for ADVHOTPOT, and 32 for E-SNLI, respectively. <ref type="foot">4</ref> We experiment with four LLMs, including OPT (175B), GPT-3 (davinci), InstructGPT (text-davinci-001), and text-davinci-002. OPT and GPT-3 are trained using the standard causal language modeling objective, whereas InstructGPT and text-davinci-002 are trained with special instruction data and human annotations. We generate outputs with greedy decoding (temperature set to be 0). Our prompt formats follow those in <ref type="bibr">Brown et al. (2020)</ref>. The explanations are inserted before/after the prediction with conjunction words like because.</p><p>Please refer to Appendix A for full prompts. Because the results of in-context learning vary with the examples presented in the input prompt, for each dataset, we randomly sample multiple groups of training shots, and report the mean and standard deviation of the results (subscript). We use 5 groups for InstructGPT, the primary LM we are using throughout our paper, and 3 groups for the rest.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2.4">Results</head><p>As shown in Table <ref type="table">1</ref>, OPT, GPT-3, and InstructGPT show small to moderate improvements from using explanations for textual reasoning tasks. On the two QA tasks, SYNTH and ADVHOTPOT, E-P improves the performance of InstructGPT, the best among these three LMs, from 54.8 to 58.5 and 56.8 to 59.4, respectively.<ref type="foot">foot_5</ref> On E-SNLI, P-E outperforms FEW-SHOT by 2.6, whereas E-P substantially lags FEW-SHOT. Comparing E-P against P-E on SYNTH and E-SNLI, E-P typically degrades performance (except on SYNTH for InstructGPT) and P-E is inconsistent across the different models, whereas E-P consistently leads to performance improvements on ADVHOTPOT. There is no single winner between the two paradigms of using explanations; choosing the most effective way is task-specific. Overall, vanilla LLMs (OPT and GPT-3) see limited benefit from producing explanations, and even the Instruct-series InstructGPT does not see substantial improvements.</p><p>The only exception is text-davinci-002. text-davinci-002 greatly benefits from explanations in the prompt across all three tasks, and E-P is consistently more effective than P-E. However, it is unclear what contributes to this difference. As far as we are aware, the differences between text-davinci-002   and InstructGPT are not described in any publication or blog post. <ref type="foot">6</ref> Comparing GPT-3 and Instruct-GPT, we see the move to Instruct series models is not sufficient to explain the difference. Given the lack of transparency with this model, we hesitate to make scientific claims about the results it yields.</p><p>Our results do not suggest immediate strong improvements from incorporating explanations across all LLMs, even for our synthetic dataset, contradicting recent prior work. This can be attributed to the difference between the tasks we study. The tasks that receive significant benefits from using explanations in <ref type="bibr">Nye et al. (2021)</ref> and <ref type="bibr">Wei et al. (2022)</ref> are all program-like (e.g., integer addition and program execution), whereas the tasks in this work emphasize textual reasoning grounded in provided inputs. In fact, in <ref type="bibr">Wei et al. (2022)</ref> and <ref type="bibr">Chowdhery et al. (2022)</ref>, explanations only show mild benefit on open-domain QA tasks like StrategyQA <ref type="bibr">(Geva et al., 2021)</ref> that are closer to our setting.</p><p>3 Can LLMs Generate Factual and Consistent Explanations?</p><p>Prompting LLMs with explanations and having models generate them may not guarantee higher performance on our tasks. But what about the quality of the model-generated explanations themselves?</p><p>We assess the reliability of the explanations for the three datasets, measured in terms of two aspects.</p><p>Factuality refers to whether a generated explanation is faithfully grounded in the corresponding input context (context for QA and premise/hypothesis pair for NLI). A factual explanation should not contain hallucinations that contradict the context. See Figure <ref type="figure">3</ref> for a nonfactual explanation.</p><p>Consistency measures if the explanation entails the prediction. Our concept of consistency resembles plausibility as described in <ref type="bibr">Jacovi and Goldberg (2021)</ref>, in that we assess whether the prediction follows from the explanation as perceived by a human. See Figure <ref type="figure">3</ref> for an inconsistent explanation. </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>% of Correct/Incorrect Predictions by Factuality/Consistency</head><p>Figure <ref type="figure">4</ref>: Explanations are more likely to be nonfactual than to be inconsistent, and a nonfactual explanation usually indicates an incorrect prediction.</p><p>For SYNTH, we use rules to automatically judge whether an explanation is factual and consistent on all four LLMs. For ADVHOTPOT and E-SNLI, the authors manually inspected the explanations generated by InstructGPT and annotated them for these two characteristics (more details in Appendix D). Note for each setting, the results are based on the explanations and predictions obtained with a single set of training shots. We only show the results of P-E on E-SNLI, as E-P is substantially worse here.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Results</head><p>We summarize the results in Table <ref type="table">2</ref>. We only report consistency on E-SNLI, as the explanations for E-SNLI often require some external commonsense knowledge which cannot be easily grounded in the inputs or judged as true or false (examples in Appendix F). The results suggest a disconnect between the model predictions and the "reasoning" in explanations. On InstructGPT, though using explanations improves its performance across three tasks, the generated explanations are unreliable (upper section), even for the straightforward synthetic setting. Comparing the factuality of explanations for SYNTH generated by GPT-3, InstructGPT, and text-davinci-002, we see that instruction tuning improves the factuality, but even the most powerful text-davinci-002 still fails to generate explanations that are perfectly grounded in the input context. Overall, LLMs tend to generate consistent explanations (&gt;80% for all three datasets with the right prompt structure), but the explanations are less likely to be factual, which is concerning as they can deceive a user of the system into believing the model's answer.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.1">Reliability of Explanations and Prediction Accuracy</head><p>LLMs may hallucinate problematic explanations, but this could actually be advantageous if it gives us a way of spotting when the model's "reasoning" has failed. We investigate the connection between the reliability of an explanation and the accuracy of a prediction and ask whether a reliable explanation indicates an accurate prediction. (This resembles the linguistic calibration of <ref type="bibr">Mielke et al. (2022)</ref>, but using a different signal for calibration.)</p><p>As shown in Table <ref type="table">2</ref> (right), accuracy and factuality/consistency are typically correlated, especially factuality. By knowing whether an explanation is factual, we can guess the model's accuracy a high fraction of the time (Accuracy = Factuality). A nonfactual explanation very likely means an incorrect prediction on the SYNTH dataset across all four LLMs. On ADVHOTPOT, factuality and Instruct-GPT's prediction correspond 80.0% of the time, substantially surpassing the prediction accuracy itself. We show fractions of correct and incorrect predictions when the explanations are factual/nonfactual and consistent/inconsistent in Figure <ref type="figure">4</ref> for two of our settings. Factual explanations are much more likely paired with correct predictions compared to nonfactual explanations. Consistency is also connected to accuracy but is an inferior indicator compared to factuality in general (Table <ref type="table">2</ref>).</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4">Calibrating In-Context Learning using Explanations</head><p>From Section 3.1, we see that a human oracle assessment of the factuality of an explanation could be of substantial use for calibrating the corresponding prediction. Can we automate this process?</p><p>We first show how to achieve this goal on the perfectly controlled SYNTH dataset (Section 4.1). On our other two datasets, we use surface lexical matching to approximate semantic matching and give real-valued scores approximately reflecting factuality. Following past work on supervised calibration <ref type="bibr">(Kamath et al., 2020;</ref><ref type="bibr">Chen et al., 2021;</ref><ref type="bibr">Ye and Durrett, 2022)</ref>, we can learn a calibrator that tunes the probabilities of a prediction based on the score of its explanation (Section 4.2). We show such a calibrator can be trained with a handful of examples beyond those used for in-context learning and successfully improve the in-context learning performance on realistic datasets. <ref type="foot">7</ref> We note that, as mentioned before, the experiments in this section are conducted on InstructGPT.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.1">Motivating Example: Improving SYNTH Dataset</head><p>We first show how post-hoc calibration functions in the controlled SYNTH setting, where we can simply check the factuality of an explanation. Since the generated explanation always follows the format "B is [profession] and A [verb] B." (example in Figure <ref type="figure">2</ref>), we can split the explanation into two sentences. The explanation is factual if and only if each of the two sentences exactly matches one of the sentences in the context.</p><p>We use the assessment to improve the performance of P-E for SYNTH, where a nonfactual explanation typically indicates an incorrect prediction. This gives us a way to reject presumably incorrect answers. Specifically, we iterate through the top 5 candidate answers (restricted by the API) given by InstructGPT and reject any answer-explanation pair if the explanation is nonfactual until we find a factual one. This procedure dramatically improves the accuracy from 52.4% to 74.8%. Note that this SYNTH dataset is a challenging task given its lack of reasoning shortcuts: for reference, neither ROBERTA <ref type="bibr">(Liu et al., 2019)</ref> nor DEBERTA <ref type="bibr">(He et al., 2021)</ref> finetuned with 16 examples can achieve an accuracy surpassing 50%. With the help of the explanations and the checking procedure, we can use InstructGPT to achieve strong results using few-shot learning.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.2">Learning-based Calibration Framework</head><p>Framework We now introduce the framework that can leverage the factuality assessment of an explanation to calibrate a prediction. Let p be the vector of predicted probabilities associated with each class label in NLI (or the probability score of predicted answer in QA). Let v be a scalar value extracted from the explanation to describe the factuality. Then, we can adjust the probabilities accordingly using a linear model: p = softmax(W [p; v] + b), where p is the tuned probabilities.</p><p>Our calibration framework is extended from classical calibration methods <ref type="bibr">(Platt, 1999;</ref><ref type="bibr">Guo et al., 2017;</ref><ref type="bibr">Zhao et al., 2021)</ref>, which apply an affine transformation on the probabilities alone: p = softmax(W p + b). In contrast, we use an additional factor v in calibration to incorporate the factuality assessment of the explanation.</p><p>There are a small number of parameters (W and b) that need to be trained in such a calibration framework. We will rely on a few more examples in addition to the shots we use in the prompt to train the calibrator. Specifically, we use the prompt examples to generate the predictions and explanations for these extra examples, and extract predicted probabilities, factors, and target probabilities triples to construct training data points used to train the calibrator. Note this procedure requires no explanation annotations for the extra examples.</p><p>Approximating Factuality We approximate the factuality using lexical overlap between the explanations and the inputs, which we found to work fairly well for our tasks.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>ADVHOTPOT:</head><p>We use an explanation consisting of two sentences (examples in Figure <ref type="figure">3</ref>) as an illustration. Let E = (E (1) , E (2) ) be the generated explanation, where E (1) and E (2) are the two sentences, and the E (i) = (e 1 , e 2 , &#8226; &#8226; &#8226; ) contain tokens e 1 , e 2 , &#8226; &#8226; &#8226; . Similarly, let P = (P (1) , P (2) , P (3) , P (4) ) be the context paragraphs, and</p><p>The factuality estimation of one explanation sentence E (i) is defined as:</p><p>Intuitively, the factuality score for a sentence E is defined as the maximum number of overlapping tokens over all paragraphs P , normalized by the number of tokens in E. We then define the factuality score for the whole explanation as V(E) = min E&#8712;E V(E), as it requires all sentences to be factual in order to make the entire explanation factual.<ref type="foot">foot_8</ref> E-SNLI: The explanations of E-SNLI do not really involve a concept of factuality. Nevertheless, we use an analogous score following the same principle by viewing the premise as the context. Let E = (e 1 , e 2 , &#8226; &#8226; &#8226; ) be the explanation and P = (p 1 , p 2 , &#8226; &#8226; &#8226; ) be the premise. We simply score the explanation by</p><p>The more an explanation overlaps with the premise, the more factual we judge it to be. Setup For E-SNLI, we use calibration methods to postprocess the final probabilities. Unlike classical temperature scaling <ref type="bibr">(Platt, 1999)</ref>, note that the methods we use here can actually change the prediction; we will therefore evaluate on accuracy of the calibrated model.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.3">Calibrating E-SNLI</head><p>We study the effectiveness of our explanationbased calibrator under different training data sizes varying from 32 to 128. Recall that we only require explanation annotations for 32 data points, and only need the labels for the rest to train the calibrator. For E-SNLI, we calibrate P-E, which is shown to be more effective than E-P in this setting (Section 2.4).</p><p>Baselines We provide the performance of finetuned ROBERTA <ref type="bibr">(Liu et al., 2019)</ref> model as a reference, finding this to work better than De-BERTa <ref type="bibr">(He et al., 2021)</ref>. To isolate the effectiveness of using explanations for calibration, we introduce three additional baselines using nonexplanation-based calibrators. We apply the probability-based calibrator as described in Section 4.2 on the results obtained on few-shot learning (FEW-SHOT+PROBCAL) and predict-then-explain pipeline (P-E+PROBCAL). We note that the parameters of these calibrators are trained using the additional data points, as opposed to being heuristically determined as in <ref type="bibr">Zhao et al. (2021)</ref>. Furthermore, we experiment with a recently proposed supervised calibrator from <ref type="bibr">Zhang et al. (2021)</ref>, which uses the CLS representations from an additional language model as features in the calibrator. The probabilities are tuned using p = softmax(W [p; h] + b), where h is the CLS representation. Since we do not have access to the embeddings obtained by GPT-3, we use ROBERTA to extract the vectors instead.</p><p>We use such a calibrator on top of our best-performing base model, P-E, resulting P-E+ ZHANG ET AL. <ref type="bibr">(2021)</ref>.</p><p>Limited by the maximum prompt length, in-context learning is not able to take as input the additional data used for training the calibrator. For a fair comparison, we can allow the in-context model to use this data by varying the prompts across test examples, dynamically choosing the prompt examples to maximize performance. Choosing closer data points for prompting is a common and effective way of scaling up the training data size for in-context learning <ref type="bibr">(Shin et al., 2021;</ref><ref type="bibr">Liu et al., 2021)</ref>. Following <ref type="bibr">Liu et al. (2021)</ref>, we test the performance of choosing nearest neighbors for the prompt based on CLS embedding produced by a ROBERTA model <ref type="bibr">(Liu et al., 2019)</ref>, referred as FEW-SHOT(NN). It is worth clarifying that the FEW-SHOT and FEW-SHOT+PROBCAL approaches use the same set of 32 training shots in the prompt for every test example, whereas the shot sets vary from example to example in FEW-SHOT(NN).</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Results</head><p>We show the results in Table <ref type="table">3</ref>. We use 5 different groups of training examples and report the mean and standard deviation across the groups. For FEW-SHOT(NN), we only report the results obtained using 128 examples; results using a smaller number of examples will be worse than this.</p><p>Under 128 training examples, applying a trained calibrator on top of prompting with explanation (i.e., P-E+EXPLCAL) achieves the best accuracy of 68.5%, which is 12% higher than the performance of the vanilla uncalibrated few-shot in-context learning (FEW-SHOT). P-E+EXPLCAL also outperforms FEW-SHOT+PROBCAL and P-E+PROBCAL by 5% and 3%, respectively. Using explanations is more effective than using probabilities alone. In addition, P-E+EXPLCAL also outperforms P-E+ZHANG ET AL. ( <ref type="formula">2021</ref>), whose performance is on par with P-E+PROBCAL. This suggests the additional CLS information is not very helpful in this setting.</p><p>As the data size increases from 32 to 128, the performance of the explanation-based calibrator keeps improving notably, whereas the performance of probability-based calibrators nearly saturates at a data size of 96. The performance of FEW-SHOT(NN) with 128 training instances only improves the performance by 3.3%, compared to FEW-SHOT with 32 training instances. Choosing nearest neighbors as the shots, while being effective when having access to a large amount of data, is not helpful in the extreme data-scarce regime. Calibrating using explanations is an effective way of using a few extra data points that cannot fit in the prompt, which is a pitfall of standard in-context learning.</p><p>Finally, ROBERTA finetuned using 128 shots only achieves an accuracy of 54.9%, lagging the performance of GPT-3 based models. The limited training data size is insufficient for finetuning smaller language models like ROBERTA, but is sufficient for P-E+EXPLCAL to be effective.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.4">Calibrating ADVHOTPOT</head><p>Setup For the ADVHOTPOT dataset, our calibration takes the form of tuning the confidence scores of the predicted answers to better align them with the correctness of predictions. These confidence scores can be used in a "selective QA" setting <ref type="bibr">(Kamath et al., 2020)</ref>, where the model can abstain on a certain fraction of questions where it assigns low confidence to its answers. We use the area under coverage-accuracy curve (AUC) to evaluate how well a model is calibrated as in past literature <ref type="bibr">(Kamath et al., 2020;</ref><ref type="bibr">Chen et al., 2021;</ref><ref type="bibr">Zhang et al., 2021;</ref><ref type="bibr">Garg and Moschitti, 2021;</ref><ref type="bibr">Ye and Durrett, 2022)</ref>. The curve plots the average accuracy with varying fractions (coverage) of questions being answered (examples in Figure <ref type="figure">5</ref>). For any given coverage, a better calibrated model should be able to identify questions that it performs best on, hence resulting a higher AUC.</p><p>We experiment with training data set sizes of 6, 32, and 64. We report the results averaged from 5 trials using different training sets. For ADVHOTPOT, we calibrate E-P, which is shown to be more effective than P-E in this setting (Section 2.4). Our approach is also effective for calibrating P-E; please refer to Appendix E for details.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Results</head><p>We show the AUC scores in Table <ref type="table">4</ref>. By leveraging explanations, E-P+EXPLCAL successfully achieves an AUC of 68.8, surpassing both FEW-SHOT by 7 points and E-P by 4 points. We note this is a substantial improvement, given that the upperbound of AUC is constrained by the accuracy of the answers and cannot reach 100. Figure <ref type="figure">5</ref> shows the coverage-accuracy curves of various methods averaged across the 5 training runs. E-P+EXPLCAL always achieves a higher accuracy than its uncalibrated counterpart, E-P, under a certain coverage, and the gap is especially large in the most confident intervals (coverage &lt; 50%). E-P+ZHANG ET AL. ( <ref type="formula">2021</ref>) is able to calibrate the predictions on this dataset, but still lags our explanation-based calibrator, E-P+EXPLCAL.</p><p>In addition, the explanation-based calibrator can be effective with as few as 32 examples. This is because there are only two parameters (the probability of predicted answer and the explanationbased factor) in the calibrator, which can be easily learned in this few-shot setting. Comparing E-P+EXPLCAL against FEW-SHOT(NN), using nearest neighbors in the prompt is also able to improve the performance compared to using a fixed set of shots (FEW-SHOT), yet our lightweight calibrator can better utilize such a small amount of data, and learn to distinguish more accurate predictions based on the explanations.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5">Related Work</head><p>Our investigation is centered around in-context learning <ref type="bibr">(Brown et al., 2020)</ref>, which has garnered increasing interest since the breakthrough of various large pretrained language models. Recent work has been devoted to studying different aspects of in-context learning, including its wayward behaviors <ref type="bibr">(Min et al., 2022;</ref><ref type="bibr">Webson and Pavlick, 2022)</ref> and approaches to overcome them <ref type="bibr">(Zhao et al., 2021)</ref>, whereas our exploration focuses on using explanations.</p><p>The utility of explanations for few-shot in-context learning has also been discussed concurrently <ref type="bibr">(Nye et al., 2021;</ref><ref type="bibr">Wei et al., 2022;</ref><ref type="bibr">Marasovi&#263; et al., 2022;</ref><ref type="bibr">Chowdhery et al., 2022;</ref><ref type="bibr">Lampinen et al., 2022;</ref><ref type="bibr">Wiegreffe et al., 2022)</ref>, especially in symbolic reasoning tasks. We differ in that we study more free-form explanations in tasks (QA and NLI, specifically) focusing on textual reasoning over provided contexts. Furthermore, our work focuses on the nature of the explanations generated by LLMs, which are found to be unreliable. Regarding our use of calibration, similar ideas of explanation-based performance estimation have been applied to other tasks <ref type="bibr">(Rajani and Mooney, 2018;</ref><ref type="bibr">Ye et al., 2021;</ref><ref type="bibr">Ye and Durrett, 2022</ref>), but we rely on the free-text explanations generated by the model instead of interpretations obtained through post-hoc interpretation techniques.</p><p>More broadly, how to use explanations in various forms (textual explanation, highlights, etc.) to train better models is a longstanding problem <ref type="bibr">(Zaidan et al., 2007)</ref>. Past work has built a series of pipeline models that first generate the explanations and then make predictions purely based on the generated explanations <ref type="bibr">(Wiegreffe et al., 2021;</ref><ref type="bibr">Zhou and Tan, 2021;</ref><ref type="bibr">Chen et al., 2022)</ref>. Prior research has also explored using explanations as additional supervision to train joint models <ref type="bibr">(Hancock et al., 2018;</ref><ref type="bibr">Dua et al., 2020;</ref><ref type="bibr">Lamm et al., 2021;</ref><ref type="bibr">Stacey et al., 2022)</ref>. Another line of work seeks to align the reasoning process of a trained model with the explanations, which is typically done by interpreting a prediction post-hoc through explanation techniques and optimizing the distance between the obtained explanation and ground truth explanation <ref type="bibr">(Liu and Avci, 2019;</ref><ref type="bibr">Rieger et al., 2020;</ref><ref type="bibr">Plumb et al., 2020;</ref><ref type="bibr">Erion et al., 2021;</ref><ref type="bibr">Yao et al., 2021)</ref>. These aforementioned methods all update the model parameters and typically require a considerable amount of explanation annotations to be effective. By contrast, our setting treats language models as pure black boxes and only requires few-shot explanations.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="6">Discussion &amp; Conclusion</head><p>Caveats and Risks of Explanations from Large Language Models Our analysis suggests that LLMs' internal "reasoning" does not always align with explanations that it generates, as shown by our consistency results. More concerning, the explanations might not be factually grounded in the provided prompt. This shortcoming should caution against any deployment of this technology in practice: because the explanations are grammatical English and look very convincing, they may deceive users into believing the system's responses even when those responses are incorrect. Section 6 of <ref type="bibr">Bender et al. (2021)</ref> discusses these risks in additional detail. The fact that language models can hallucinate explanations is also found in other work <ref type="bibr">(Zhou and Tan, 2021)</ref>. This result is unsurprising in some sense: without sufficient supervision or grounding, language models do not learn meaning as distinct from form <ref type="bibr">(Bender and Koller, 2020)</ref>, so we should not expect their explanations to be strongly grounded.</p><p>We have shown that even explanations which don't lead to accuracy gains can still be useful for calibration. However, the lexical overlap feature we use here is a weak signal of explanation correctness (see the example in Figure <ref type="figure">1</ref>). Strong enough entailment models should theoretically be able to perform this task and work across a range of tasks without fine-tuning. This explanation assessment model can even be a language model itself trained for this particular propose to approach the verification tasks for a given domain by in-context learning.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Conclusion</head><p>We have explored the capabilities of LLMs in using explanations in in-context learning for textual reasoning. Through our experiments with four LLMs and on two QA datasets and an NLI dataset, we find that simply including explanations in the prompt does not always improve the performance of in-context learning. Our manual analysis demonstrates that LLMs tend to generate nonfactual explanations when making wrong predictions, which can be a useful leverage to assess the correctness of the predictions. Lastly, we showcase how to use explanations to build lightweight calibrators, which successfully improve InstructGPT's in-context learning performance across all three datasets. </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>A Details of Prompts</head><p>We show examples of the prompts used for SYNTH, ADVHOTPOT, and E-SNLI in Figure <ref type="figure">6</ref>, Figure <ref type="figure">7</ref>, and Figure <ref type="figure">8</ref>, respectively. Our prompts follow the original formats in <ref type="bibr">Brown et al. (2020)</ref>. For approaches that use explanations (E-P and P-E), we insert explanations before/after with necessary conjunction words.  </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>B Details of the SYNTH Dataset</head><p>We create a controlled synthetic multi-hop QA dataset. Each context consists of four reasoning chains, where each chain contains two sentences following a template: "A [verb] B. B is <ref type="bibr">[profession]</ref>.". We fill in A and B in the reasoning chain templates using randomly selected names from a pool of 50 names. To fill in the <ref type="bibr">[verb]</ref> and <ref type="bibr">[profession]</ref> in the four reasoning chain templates, we first select two verbs from a pool of 30 verbs and two professions from a pool of 30 professions. Next, we fill in the four chains using the combination of these two verbs and professions, which give a set of completely symmetric chains. Finally, we sample one reasoning chain from all of the four to derive a asking: "Who <ref type="bibr">[verb]</ref> [profession]?" (example in Figure <ref type="figure">2</ref>). Such a design ensures there are no reasoning shortcuts <ref type="bibr">(Chen and Durrett, 2019)</ref>, making it a difficult dataset even despite the regular structure of the task. A ROBERTA model needs roughly 500 data points to tackle this problem and achieve near 100% accuracy on the test set.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>C Details of the ADVHOTPOT Dataset</head><p>We preprocess the original Adversarial HotpotQA dataset <ref type="bibr">(Yang et al., 2018;</ref><ref type="bibr">Jiang and Bansal, 2019)</ref> in a few ways. We reduce the context length to make it better fit the purpose of testing in-context learning. We use two ground truth supporting paragraphs joined with two adversarial paragraphs to construct the context for each question, instead of using all eight distractors. In addition, we simplify each paragraph by only keeping relevant sentences needed for answering the question (or distracting the prediction); otherwise, the prompt length limit only allows 2-3 examples fit in the input prompt.</p><p>We make a challenging test test set of 250 examples by balancing the mix of examples on which prompted GPT-3 makes correct and incorrect predictions. This is done by first running few-shot inference over 1000 examples, and then randomly sampling 125 examples with correct and incorrect predictions, respectively.</p><p>Since assessing the accuracy of an answer in QA is hard, and F1 scores do not correlate with the true quality of the answers (e.g., "United States" is a correct answer but has 0 F1 score with respect to the provided ground truth answer "US") <ref type="bibr">(Bulian et al., 2022)</ref>, we manually assess the correctness of the answers. We observed a high inter-annotator agreement (Cohen's Kappa of 0.84) between the correctness annotations of 100 examples on which the annotations of the authors intersected. Please refer to the supplementary material for these annotations.</p><p>This dataset is licensed under the MIT license.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>D Details of Reliability Annotations</head><p>The authors manually inspected the predictions and explanations generated for the 250 ADVHOTPOT test examples using a single set of training shots, and annotated them for factuality and consistency.</p><p>We observed a Cohen's Kappa of 0.85 between the factuality annotations of 100 examples (obtained using the E-P paradigm) on which the annotations of the authors overlapped.</p><p>E Calibrating P-E on ADVHOTPOT We also experiment with calibrating predictions obtained using P-E on ADVHOTPOT, following the same setup as described in Section 4.4.</p><p>As in Table <ref type="table">5</ref>, using explanations is also effective for calibrating the predictions obtained using P-E. P-E+EXPLCAL successfully improves the AUC of P-E from 58.4 to 62.6, outperforming FEW-SHOT and FEW-SHOT (NN). A person wearing sunglasses, a visor, and a British flag is carrying 6 Heineken bottles. Q: The person has beer bottles and has a england flag and glasses. True, False, or Neither? A: False , because the person could be carrying any number of items and not just six Heineken bottles.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>F Additional Output Examples</head></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>GT: False</head><p>A woman and a man are sword fighting. Q: Two people have engaged in a sword fight and both are dead. True, False, or Neither? A: False, because it is impossible for two people to sword fight and both be dead.</p><p>Two construction workers in a truck having a conversation. Q: Two people are outside a truck. True, False, or Neither? A: True, because two people are outside a truck.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>GT: Neither</head><p>A dog running on grass Q: A dog is playing outside. True, False, or Neither? A: True, because a dog playing outside implies that the dog is playing outside.</p><p>A silhouette at the bottom of an escalator. Q: The silhoutte is creeping out the children. True, False, or Neither? A: False, because the silhouette is not necessarily creeping out the children.</p><p>Figure <ref type="figure">11</ref>: The completions generated for E-SNLI examples with different ground truth labels (GT) using E-P. GPT-3 sometimes ignores the information from premises when explaining its predictions (examples in the bottom section).</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>G Details of Automatically Assessing Consistency and Factuality on SYNTH</head><p>Our questions follow the template Who V1 P1?. Our generated explanations follow the template N1 is P2 and N2 V2 N3. Our answers are always a name, e.g., N4. Because large language models almost always produce well-formed explanations, we can match the output against these patterns and extract variables V 1 , P 1 , etc. using simple regular expressions.</p><p>We say that an explanation is consistent if and only if the following conditions are satisfied: (1) N2 = N4 and N1 = N3.</p><p>(2) P2 = P1 and V2 = V1. These rules ensure the explanation matches the intent of the question and entails the answer at the same time.</p><p>We say an explanation is factual if and only if both N1 is P2 and N2 V2 N3 appear exactly in the context. As shown in Table <ref type="table">8</ref>, adding triggers in the prompts does not lead to statistically significantly improvements in E-P for GPT-3 and InstructGPT. In fact, it typically causes a performance degradation.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>J Information about Cost of Running Experiments</head><p>The cost of our experiments, described as follows, is estimated based on using the GPT-3 API with the largest models available (davinci, text-davinci-001, and text-davinci-002) as of August 2022 ($0.06 per 1,000 tokens). The setting in Table <ref type="table">1</ref> uses 250 examples for each result, with roughly 1400 tokens per example using the FEW-SHOT paradigm and 2000 tokens per example using the E-P or E-P paradigm. The cost of evaluating FEW-SHOT, P-E, and E-P for 5 trials on a single dataset is roughly $105, $150, and $150, respectively. The total price for reproducing results on three datasets as in Table <ref type="table">1</ref> using a single language model is roughly $1200. We subsample 250-example sets to reduce cost rather than running on full datasets. Based on the significance tests in this paper and the reported confidence intervals, this size dataset is sufficient to distinguish between the performance of different approaches.</p></div><note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="1" xml:id="foot_0"><p>Data and code available at https://github.com/xiye17/TextualExplInContext 36th Conference on Neural Information Processing Systems (NeurIPS</p></note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" xml:id="foot_1"><p>2022).</p></note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="2" xml:id="foot_2"><p>Throughout our paper, we primarily test on InstructGPT for two reasons. First, it was the most capable model available at the time we were conducting the majority of our experiments. Second, it still has significant room to improve on the datasets we explore in this work. This setting is a representative testbed for the situation where an LLM-based system does not yet give satisfactory performance on a target task, causing the system designer to turn to explanations in prompts to improve things.</p></note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="3" xml:id="foot_3"><p>This dataset is inspired by task 15 of the bAbI dataset<ref type="bibr">(Weston et al., 2016)</ref>. In our preliminary experiments with some of the other bAbI tasks, we found poor performance from InstructGPT similar to our results on SYNTH, both with and without explanations.</p></note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="4" xml:id="foot_4"><p>This contrasts with recent work like<ref type="bibr">Zhao et al. (2021)</ref> that focuses on improving performance in the 1-4-shot setting; by using more data we achieve much stronger results on our tasks.</p></note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="5" xml:id="foot_5"><p>For SYNTH, we also tried using an alternative style of explanations (reversing the order of the two sentences in the explanations), which leads to mild performance degradation.</p></note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="6" xml:id="foot_6"><p>One publicly-described difference is the addition of editing and insertion, discussed at https://openai. com/blog/gpt-3-edit-insert/, but this does not explain the performance differences we observe.</p></note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="7" xml:id="foot_7"><p>This procedure does require extra data. However, it provides a natural avenue for using a small number of additional examples that otherwise would be impossible to incorporate into this procedure, when the size of the context actually limits the amount of data for in-context learning.</p></note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="8" xml:id="foot_8"><p>Alternatively, one might use a fine-tuned NLI model as a proxy<ref type="bibr">(Chen et al., 2021)</ref>. However, our focus is on the pure black-box setting, and we avoid models that require substantial amounts of data to make work.</p></note>
		</body>
		</text>
</TEI>
