Explanation-aware Soft Ensemble Empowers Large Language Model In-context Learning (2024)

Abstract: Large language models (LLMs) have shown remarkable capabilities in various natural language understanding tasks with a few demonstration examples via in-context learning. Common strategies to boost such “in-context” learning ability are to ensemble multiple model decoded results and require the model to generate an explanation along with the prediction. However, these models often treat different class predictions equally and neglect the potential discrepancy between the explanations and predictions. To fully unleash the power of explanations, we propose EASE, an Explanation-Aware Soft Ensemble framework to empower in-context learning with LLMs. We design two techniques, explanation-guided ensemble, and soft probability aggregation, to mitigate the effect of unreliable explanations and improve the consistency between explanations and final predictions. Experiments on seven natural language understanding tasks and four varying-size LLMs demonstrate the effectiveness of our proposed framework.

## introduction recent advancements in natural language processing (nlp) have witnessed the remarkable capabilities of large language models (llms) @xcite @xcite . these llms can rapidly adapt to new tasks by learning only on a few input-output pairs (a.k.a. demonstrations) in context @xcite . yet, beyond those demonstrations, a significant facet of human learning revolves around explanations. these explanations 1 , typically in the form of a few keywords or sentences, reveal the underlying principles connecting the input and output @xcite . consequently, integrating free-text explanations into llm prompting holds great potentials to further enhance in-context learning performance. recent studies have examined how to incorporate free-text explanations into llm in-context learning scheme. for instance, the predict-then-explain pipeline @xcite proposes to generate the explanation after making the prediction. consequently, the predictions from llm won't directly benefit from their corresponding explanations. in contrast, the explain-then-predict pipeline (a.k.a "chain-of-thought") @xcite generates explanations before making predictions via greedy sampling. when the llmgenerated explanations are unreliable, predictions from this approach will be largely distracted and defective @xcite . to mitigate this issue, @xcite improves the "chain-of-thought" pipeline by generating multiple predictions with different explanations using temperature sampling and aggregating them via majority voting. however, this approach can be sub-optimal as (1) temperature sampling increases the inconsistency between generated explanations and their associated class predictions, and (2) majority voting treats predictions associated with explanations of varying qualities equally. how to robustly leverage free-text explanations for llm in-context learning remains challenging. in this work, we present an explanation-aware soft ensemble framework, named ease, to assist llm in-context learning with explanations. our technique integrates explanations into the ensemble procedure and employs soft probability to mitigate discrepancies between explanations and predictions. the key module of the ease framework hinges upon the idea of weighted ensemble: as shown in figure 1 , instead of treating all predictions equally, we assign a score to each prediction based on the contextual relevance and inherent quality of its associated explanation, which will be used as a weight during the final ensemble stage. figure 1 : the overview of ease framework, where we introduce two strategies to better harness explanations for llm in-context learning. while several works have studied scoring the llmgenerated text @xcite @xcite , these models typically require massive training labels on downstream tasks or intermediate reasoning annotations. to facilitate explanation scoring with under the few-shot setting studied in this work, we realize this explanationaware ensemble stage with an llm -after generating explanations and predictions using temperature sampling for each test instance, we prompt the llm to weight all class predictions based on their associated explanations in an in-context manner. while the llm offers great promise for the weighting purpose, it is crucial to provide sufficient supervision signals as demonstrations to guide the llm scoring, yet the primary constraint for this step lies in the absence of negative explanations from few-shot demonstrations. to construct negative examples, we first use llm to generate explanations for few-shot demonstrations, then select explanations associated with incorrect predictions as the negative samples. in this way, the llm scorer can be readily applied to perform explanation-aware ensembling without any additional annotation. beyond explanation-aware ensembling, ease incorporates an additional technique named soft probability aggregation, which helps to mitigate the inconsistency between explanations and predictions, given the sampling process may inevitably infuse noises into the final prediction. specifically, it employs probabilities across various classindicative verbalizers in place of the original onehot predictions. this design, although conceptually simple, can effectively reduce the discrepancies between explanations and predictions and further improve the final predictions accuracy. our contributions can be summarized as follows: ## related work two prevalent explanation types exist for interpreting nlp models: (1) extraction-based explanations that highlight important segments of the original input @xcite @xcite and ( 2 ) free-form explanations that craft prediction rationales directly using natural language text @xcite @xcite @xcite @xcite . beyond aiding in model interpretation, recent studies have demonstrated that these explanations can also enhance the few-shot reasoning capabilities of large language models. for example, @xcite use tasklevel explanations to assist the test-time adaptation for llms. @xcite leverage the extracted keywords tokens as additional input to assist llm in-context learning, but requires a white-box llm. @xcite propose to prepend explanations before the answers while @xcite suggest adding postanswer explanations. given that these explanations are often derived during the llm decoding stage and may contain noise, @xcite advocate for generating multiple candidate explanations with predictions, followed by aggregating these predictions via majority voting. in our study, we focus on free-form explanations and explore how to better aggregate these predictions with explanations in a weighted ensemble. using a bootstrapped llm, we evaluate each explanation to enhance in-context learning. another line of research related to our study is automated explanation quality evaluation @xcite @xcite . @xcite utilize lexical features to measure the faithfulness of explanations without considering their semantics. @xcite ) leverage a nli fine-tuned model to verify the reliability of explanations. @xcite @xcite also study how to use llm to build a generic text quality scorers for nlp tasks. these studies rely on ground-truth labels and human annotations, making them less suitable when the labels for test instances are unknown. besides, several works attempt to build up a scoring model @xcite and rely on a large training set for scoring model training, yet such labeled data can be infeasible to obtain under the true few-shot setting. in contrast, our research focuses more on effectively leveraging model-generated explanations to improve llm in-context learning with a few demonstrations only. ## method in this section, we first give a brief introduction to the problem definition. then, we present our approach with two designs, namely explanationaware ensemble and soft probability aggregation, with the goal of leveraging the generated explanations to improve the final prediction performance. ## conclusion in this work, we empower llm's in-context learning ability with natural language explanations. specifically, we design explanation-aware ensemble to weight multiple predictions using their associated explanations and realize this idea using a bootstrapped llm scorer. in addition, we leverage a soft probability aggregation scheme to mitigate the issue of inconsistent predictions for ensembling. we conduct extensive experiments on seven datasets from a diverse task set and show our proposed framework can outperform previous stateof-the-art methods using four llms as backbones.