Large Language Models are Better Reasoners with Self-Verification (2023)

Abstract: Recently, with the chain of thought (CoT) prompting, large language models (LLMs), e.g., GPT-3, have shown strong reasoning ability in several natural language processing tasks such as arithmetic, commonsense, and logical reasoning. However, LLMs with CoT require multi-step prompting and multi-token prediction, which is highly sensitive to individual mistakes and vulnerable to error accumulation. The above issues make the LLMs need the ability to verify the answers. In fact, after inferring conclusions in some thinking decision tasks, people often check them by re-verifying steps to avoid some mistakes. In this paper, we propose and prove that LLMs also have similar self-verification abilities. We take the conclusion obtained by CoT as one of the conditions for solving the original problem. By performing a backward verification of the answers that LLM deduced for itself, we can obtain interpretable answer validation scores to select the candidate answer with the highest score. Experimental results demonstrate that the proposed method can improve the reasoning performance on various arithmetic, commonsense, and logical reasoning datasets. Our code is publicly available at: https://github.com/WENGSYX/Self-Verification.

## introduction the ability of reasoning in the process of thinking and decision-making is an essential aspect of human intelligence. recently, chain of thought (cot) prompting @xcite has been a good way to solve the arithmetic, commonsense, and logical reasoning tasks with large language models (llms), which help the llms simulating the human thinking process when solving complex natural language processing (nlp) tasks. cot guides llms to generate a series of intermediate reasoning steps to address complex problems rather than just predict a final answer. this approach has been shown the advance performances on several challenging nlp tasks, even when using only a few or no training samples @xcite @xcite . although cot can enable llms to solve complex reasoning tasks, it is highly sensitive to individual mistakes and vulnerable to error accumulation @xcite . if a tiny mistake occurs, it can change the meaning deviations of the whole statement @xcite , leading to incorrect answers @xcite . that is especially problematic in using cot for addressing multi-step precise reasoning (such as mathematical calculation). due to the lack of the error correction mechanism, it is difficult for the llms to obtain correct results from the possible errors in multiple steps reasoning. detecting and mitigating errors is essential to improve reasoning capabilities. previous methods resolve the above issue by training another verifier to evaluate the correctness of the model's output @xcite . however, there are some drawbacks in these work. on the one hand, training a verifier requires a lot of human annotations and additional fine-tuned models, which limits its widespread use in other tasks and domains. on the other hand, the verifier fine-tuned by a language model is not easily explainable, making it difficult to assess the model's reliability based on its output scores. therefore, the challenge of obtaining a better reasoner based on the llms is to get a verifier that can avoid manual annotation and additional training, so that it can be better extended and migrated to other fields and tasks. to address this challenge and overcome the limitations of training verifiers, we propose utilizing llms as reasoners with self-verification for selecting better prediction results. in numerous decision-making tasks, humans often perform selfverification of inferred conclusions to mitigate mis-q: jackie has 10 apples. adam has 8 apples. how many more apples does jackie have than adam? a: 2 具体方法 : 1 2 jackie have 2 apples than adam. figure 1 : the answer of a question can be verified by masking and predicting the conditions of the original contexts. to mimic the self-verification ability of human, we predict the accuracy of f c by predicting the original conditions f 1 or f 2 is right or not based on this conclusion. our method employs llms for self-verification with only a few prompts, eliminating the need for fine-tuning or gradient updating. this approach enables automatic verification of multiple candidate answers and corresponding conclusions, mitigating deviations from the correct thought chain in the original cot. our verification score arises from evaluating each step during the backward verification phase, rather than from the direct output of a neural network model @xcite , enhancing the explainability of prediction outcomes and solution processes @xcite @xcite . we conducted experiments on various open-source datasets for mathematical reasoning, common sense, and logical reasoning tasks, achieving results beyond the baseline (e.g., 60.8 → 65.1 on gsm8k, 91.01 → 93.40 on singleeq). in addition, we also attempt to combine our method with some approaches to improving forward reasoning, such as self-consistency @xcite and least-to-most @xcite . the experimental results show that our method also improves upon these forward reasoning approaches. our contributions are summarized as follows: in-context learning. large language models such as gpt-3 exhibit impressive few-shot learning ability @xcite , and closely approximate the predictors computed by gradient descent @xcite . it requires only filling a few exemplars into context as prompts and without the need for finetuning on a dataset of training examples @xcite . however, this approach struggles with tasks requiring complex reasoning @xcite , which drives researchers to explore other prompting strategies. cot @xcite is a chained reasoning approach that inserts a multi-step reasoning path before generating the final answer. @xcite proposed a selfconsistency decoding strategy to vote on the reasoning path, and @xcite demonstrated that llms could as zero-shot reasoners through the prompt "let's think step-by-step". these methods focus on constructing the cot but ignore the high sensitivity of llms to individual mistakes in generating these chains, so some of these conclusions by cot may be unreliable @xcite @xcite . in this paper, we proved that llms can self-verify their conclusions. answer verification. it is a common method for evaluating and reordering candidate answers with a trained language understanding model. @xcite train a classifier to select the best answer from candidate answers, while @xcite ## the proposed method the proposed method can be used to verify prediction results. as shown in figure 2 , the process mainly consists of two steps. the first step, forward reasoning, is similar to the normal cot, except that multiple candidate answers are generated through sampling decoding. in the second step, we calculate the verification scores for each candidate's answer by the self-verification method, and the answer with the highest score is selected as the final answer. ## result and analysis the main experimental results are shown in the table shows that the proposed self-verification method (sv) can improve previous methods in all datasets. our method achieved a new stateof-the-art (sota) performance in six of these eight datasets. @xcite shows specific examples of language model self-verification for each dataset. additionally, we observed that self-verification led to an average increase of 2.33% in the highperforming instruct-gpt model, which indicates that the model with strong forward reasoning capabilities also benefits from the self-verification mechanism. the detailed experimental conclusions and analysis are described as follows: the current self-verification method is more suitable for arithmetic reasoning tasks than other reasoning tasks. we find that the average performance improvement of arithmetic reasoning tasks (1.67%/2.84% ↑) is higher than that of other reasoning tasks (0.62%/0.78% ↑) in the self-validation method can be combined with improved methods for forward reasoning. we report the results of combining selfconsistency or pol at the bottom of larger language models are better reasoners with self-verification. figure 3 shows the capability of gpt-3 models with parameters ranging from 0.4b to 175b. the experimental results suggest that the self-verification ability tends to be more robust as the number of parameters increases, aligning with the limited experimental results in @xcite . this indicates that self-verification is an emergent property that arises in larger models, where stronger reasoning capacities allow them to derive reliable and accurate conclusions during the context learning process @xcite . consequently, their performance in the backward verification phase is also enhanced. however, smaller models are prone to generate erroneous text during the generation process, and augment them with self-verification abilities presents a challenge. with the different number of few-shots, the reasoning ability of models using selfverification has significantly improved. figure 4 demonstrate the impact of different sample sizes on three arithmetic reasoning datasets. we observe that the self-verification method exhibits greater robustness with smaller samples, even with only 2-shots (at this time, it has 99.6% performance of 8-shot, while cot has only 98.7%). in addition, we find that even with only four samples (2 cot samples + 2 self-verification samples), self-verification outperforms the cot with eight samples, which *60. 6lqjoh(t @xmath0ulwk @xmath15@xmath203 d ,qvwuxfw*37 3ureohpvroyhudwh *60. 6lqjoh(t @xmath3ulwk @xmath45@xmath503 e *37 3ureohpvroyhudwh &r7 7uxh)dovh,whp9hulilfdwlrq &rqglwlrq0dvn9hulilfdwlrq highlights the importance of answer verification in scenarios of limited data. the more verification conditions are used, the better self-verification reasoning ability. we observed the effect of using the single conditional mask on six different arithmetic datasets for condition mask verificat in figure 5 . as each number in these datasets' input can be thought of as a condition, we can study the impact of increasing the number of validation conditions. in most experiments, we found that the multi-condition mask performed better than the single-condition mask, and both performed better than the original cot. these results suggest that the accuracy of verification scores improves as the number of available conditions increases. masked conditions can guide the llms to reason more effectively. as shown in figure 6 , we compared the results of using cmv (conditional masked verification) and tfv (token form verification) for self-verification. we found that the performance of cmv is generally better than tfv. we believe this is because the lack of explicit goals can lead to a lack of use of existing conclusions, so cmv is more helpful in stimulating the selfverification ability of the model. however, due to its simplicity, tfv can be applied to a variety of tasks (including common sense reasoning and logical reasoning, both with improvements compared to the cot baseline) for self-verification, making it highly adaptable to different scenarios. ## conclusion in this study, we show that large language models have a strong ability to self-verification, allowing them to assess the conclusions they generate accurately. we propose a novel method that uses self-verification to generate interpretable scores for ranking results in few-shot tasks. our approach demonstrates the potential of using self-verification to improve the accuracy and reliability of large language models in reasoning tasks. by relying on the self-verification ability of large language models, we significantly improved the accuracy of three types of reasoning tasks. all in all, we posit that the self-verification capability of large language models will have an extensive positive impact, as it enables the enhancement of their reasoning abilities through a simple process of self-verification.