SlowGuess/NeurIPS_2023_OCR huggingface dataset:
Beichen Zhang $^{13*}$ , Kun Zhou $^{23*}$ , Xilin Wei $^{4}$ , Wayne Xin Zhao $^{13\dagger}$ , Jing Sha $^{5}$ , Shijin Wang $^{56}$ , Ji-Rong Wen $^{123}$
$^{1}$ Gaoling School of Artificial Intelligence, Renmin University of China.
$^{2}$ School of Information, Renmin University of China.
<sup>3</sup>Beijing Key Laboratory of Big Data Management and Analysis Methods.
<sup>4</sup>College of Computer Science, Sichuan University.
$^{5}$ iFLYTEK Research,  $^{6}$ iFLYTEK AI Research (Central China).
{zhangbeichen724,wiselnn570,batmanfly}@gmail.com,francis_kun_zhou@163.com
{jingsha,sjwang3}@iflytek.com,jrwen@ruc.edu.cn
Chain-of-thought prompting (CoT) and tool augmentation have been validated in recent work as effective practices for improving large language models (LLMs) to perform step-by-step reasoning on complex math-related tasks. However, most existing math reasoning datasets may not be able to fully evaluate and analyze the ability of LLMs in manipulating tools and performing reasoning, as they often only require very few invocations of tools or miss annotations for evaluating intermediate reasoning steps, thus supporting only outcome evaluation. To address the issue, we construct CARP, a new Chinese dataset consisting of 4,886 computation-intensive algebra problems with formulated annotations on intermediate steps, facilitating the evaluation of the intermediate reasoning process. In CARP, we test four LLMs with CoT prompting, and find that they are all prone to make mistakes at the early steps of the solution, leading to incorrect answers. Based on this finding, we propose a new approach that can facilitate the deliberation on reasoning steps with tool interfaces, namely DELI. In DELI, we first initialize a step-by-step solution based on retrieved exemplars, then iterate two deliberation procedures that check and refine the intermediate steps of the generated solution, from both tool manipulation and natural language reasoning perspectives, until solutions converge or the maximum iteration is achieved. Experimental results on CARP and six other datasets show that the proposed DELI mostly outperforms competitive baselines, and can further boost the performance of existing CoT methods. Our data and code are available at https://github.com/RUCAIBox/CARP.
Recently, large language models (LLMs) (e.g., GPT-3 and ChatGPT) have shown remarkable zero-shot and few-shot performance on various tasks [1-6], including language generation and question answering. As LLMs have been pre-trained on a vast amount of text data that covers a broad spectrum of world knowledge, existing work also shows that LLMs can solve complex tasks, e.g., math reasoning [7-12] and college entrance exam [4, 13].
To evaluate the capacity of LLMs for solving complex tasks, math reasoning datasets have been widely used as testbeds, e.g., GSM8K [14] and MATH [15], where the math problems can not
*Equal contributions.
be directly answered but require multi-step reasoning. To elicit LLMs for step-by-step reasoning, chain-of-thought (CoT) [7, 16-20] has become the de facto prompting strategy, where LLMs can be guided to generate a solution consisting of a series of intermediate steps to reach the answer. However, previous work also reveals that LLMs are prone to make mistakes at intermediate steps, especially in numerical computation [10, 21-24], and yet a minor mistake would lead to an incorrect final answer. To alleviate it, a line of work [25-40] employs external tools to make up for the weakness of LLMs, and can greatly improve accuracy of answers on math reasoning tasks. With the rapidly evolving LLMs and tool-augmented methods, it is necessary to adopt a suitable math reasoning dataset for evaluating them systematically and differentially. Whereas, problems in most existing math reasoning datasets may only require the one-off utilization of tools [26, 27, 29, 30], which are not adequate to fully measure the ability of tool manipulation in existing methods. Moreover, even though incorrect answers often stem from errors in intermediate reasoning steps, most existing datasets are not equipped to test this, due to a lack of formal annotations of the intermediate steps in the solution text. The two issues limit existing math reasoning datasets to systemically evaluate and analyze LLMs and tool-augmented methods.
To address them, we construct a new Chinese dataset that consists of 4,886 Computation-intensive Algebra Problems associated with formulated annotations of all the intermediate steps, namely CARP. In CARP, problems require deriving multiple intermediate math expressions based on math knowledge, and solving them based on arithmetic knowledge, which makes it a complex and difficult dataset to evaluate the computation-intensive math reasoning ability. In addition, the formulated annotations also enable researchers to test the accuracy of intermediate reasoning steps for analyzing the errors of LLMs. As shown in Table 3, four popular LLMs with CoT prompting can not solve over half of the problems in our CARP, indicating the difficulty of CARP. Furthermore, we also find that all LLMs are more likely to make mistakes in the first step (over  $69\%$ ), leading to totally wrong solutions and answers. It reveals that LLMs mostly fail in performing early reasoning steps, and can not correct the errors in the latter steps. Based on CARP, we also devise a variety of fine-grained interfaces based on available tools, to provide practical functionalities for handling complicated calculations. These interfaces can also be applied to other math reasoning datasets to improve the tool manipulation capacity of LLMs.
Considering that LLMs can not fix errors in early steps by themselves in the generation, we propose a new approach that can deliberate  ${}^{3}$  the reasoning steps of LLMs with tool interfaces, namely DELI. DELI can iteratively refine the generated result from both tool manipulation and natural language reasoning, which makes it able to correct the mistakes of existing solutions from different perspectives and avoid error accumulation. Concretely, we initialize a step-by-step solution for the given question based on retrieved relevant exemplars, then iterate two deliberation procedures that check and refine the generated solution from the perspectives of tool manipulation and natural language reasoning, until reaching the stop condition, e.g., solution has converged or iterations reach the maximum number. Such a way is similar to the solution checking process of humans, and can elicit LLMs to deliberate and correct the possible errors in intermediate steps of the solution. We evaluate DELI and existing prompting methods on CARP and six other computation-intensive datasets. Experimental results show that DELI mostly outperforms competitive baselines (e.g., 9.35% accuracy improvement over the best baseline on CARP), and can further boost the performance of existing CoT prompting methods.
To summarize, our major contributions are:
- We construct a new dataset named CARP with formulated annotation of intermediate reasoning steps for systematically evaluating LLMs in solving computation-intensive math problems, and devise interfaces with practical functionalities to help LLMs.
- We propose DELI, a new approach that can deliberate and correct the reasoning steps of LLMs with tool interfaces.
- We conduct extensive experiments to show the superiority of our DELI over existing prompting methods on 7 computation-intensive math reasoning datasets.
In this work, we use the term "Deliberation" to reflect that the LLM can self-check and refine its generated solution iteratively until the result converges. This iterative refinement bears resemblance to the human cognitive process of meticulous contemplation and correction of potential errors in problem solving.
Math Problem Solving Datasets. A line of work constructs math word problem datasets with annotations of several math equations [41-52, 35, 53]. With the growth of the language models' reasoning ability, researchers propose more challenging math word problem datasets annotated with natural language solutions. GSM8k [14] is a diverse math problem dataset with multi-step reasoning annotation. However, the above math word problem datasets do not involve complex math domain knowledge, and the computation types are limited. MATH [15] is a challenging dataset at high school competition difficulty, covering various math domains. Besides, math subsets of AGIEval [13] collect problems requiring complex reasoning and computations from college entrance exams for humans. Our proposed CARP dataset mainly differs from these computation-intensive datasets in two aspects: (1) We provide formulated annotations of intermediate reasoning steps, thus supporting both process and outcome evaluation; (2) We provide fine-grained interfaces for evaluating the tool manipulation ability of LLMs in complex reasoning.
Tool-Augmented Language Models. To expand the capability boundaries of language models, a line of work employs external tools to aid them [25-40]. Existing work typically employs LLMs to determine tool arrangement or generate programs, then executes them in a single pass to obtain the results for solving math word problems [26, 27, 29, 30, 34]. Nevertheless, computation-intensive math problems encompass a range of challenges, including math domain knowledge, math expression understanding, and complex computations. The plan-and-execute approaches, which lack a procedure of reasoning based on intermediate results, may not be sufficient for handling such problems. ReAct [32] is a tool-augmented approach that interleaves reasoning and tool manipulation in the solving process. We extend ReAct to the math domain by incorporating our fine-grained tool interfaces as a component of our iterative deliberation approach.
Iterative Refinement Methods. Large language models have demonstrated remarkable performance in math-related tasks [7, 17, 16, 54-60]. Chain-of-thought (CoT) prompting is notably effective for complex reasoning in LLMs [7, 16]. However, LLMs are prone to make minor mistakes in multi-step reasoning [61]. To this end, existing studies explore iteratively refining reasoning steps with LLMs [62-71]. A line of work leverages self-generated feedback to improve math problem solutions [63-65]. However, recent studies show that LLMs may struggle with identifying problems in the text or providing faithful explanations [61, 72, 73]. Therefore, minor errors, such as inaccurate computation, pose a challenge for LLMs to check and correct solutions when solving computation-intensive problems. Another line of work explores iterative methods for solving computation-intensive math problems. Learning to Program [74] aims to iteratively learn natural language problems from training sets to guide the solving process. Progressive-Hint Prompting [69] is an iterative method that leverages prior answers as hints to guide LLMs in generating better CoT solutions.
3 CARP Dataset
Computation-intensive math reasoning task aims to solve complex math problems that require performing multi-step arithmetical computation and reasoning based on mathematical knowledge. Typically, to solve a computation-intensive math problem, humans or models need to iteratively derive the math expression and then compute the result (via calculators or other tools), until obtaining the final answer. In this way, the accuracy of intermediate reasoning and computation steps is crucial, where a subtle error would lead to completely wrong answers. In this paper, we construct a new dataset CARP (Computation-intensive Algebra Problems) that provides the formulated annotations of all the intermediate steps for the computation-intensive middle school math problems. Based on the annotations, we also design a set of interfaces with fine-grained computation functions, to help LLMs manipulate commonly-used tools for solving these problems.
Although there are a number of computation-intensive math problems in available datasets, their solutions are generally not well-formulated natural language and may omit intermediate steps [41-52, 35, 13]. To construct a well-formulated dataset, we first collect real-world computation-intensive math problems, and then invite crowdworkers to extract and annotate their expression flow graph.
Table 1: An example from CARP, which is translated into English. Errors are marked in red.
Problem	The solution to the equation ax + 2bx = 3 is x = 1, then the solution to the equation a(y - 1) + 2b(y - 1) = 3 is ?
Solution	From the question we have : a + 2b = 3 , a(y - 1) + 2b(y - 1) = 3 . Rectifying gives (a + 2b)y - (a + 2b) = 3 , i.e., 3y - 3 = 3 , therefore y = 2 .
ChatGPT	Substituting x = 1 into ax + 2bx = 3 gives a + 2b = 3 , and substituting y - 1 gives a(y - 1) + 2b(y - 1) = 3 , which simplifies to ay + by = 3 . . . . . The answer is y = 3/3-a - 1
Error Type	Reasoning error.
Table 2: Statistics for CARP dataset.
Statistic	Number
# of training samples	3,410
# of development samples	500
# of testing samples	976
# of nodes (Avg./Max)	6.0/18
# of edges (Avg./Max)	5.7/25
# of expression nodes (Avg./Max)	4.7/15
Problem length (Avg./Max)	52.1/257
Solution length (Avg./Max)	71.3/278
Figure 1: An EFG annotation example for CARP.
Data Collection. We collect the math problems and their step-by-step solutions from a Chinese education website Zhixue<sup>4</sup>, which contains vast problems to provide education assistance for students. We mainly crawl middle school math problems, since they are of moderate difficulty and require basic arithmetic computations (e.g., quadratic equation) and mathematical knowledge (e.g., Veda's theorem), making them a good testbed for computation-intensive math reasoning. We first crawl about 1,000,000 problems with solutions. Then, to obtain computation-intensive problems, we design hand-crafted rules based on SymPy to roughly extract and count the computation steps in solutions, and only select the ones with both over one computation step and over two reasoning steps. Finally, we invite math teachers to select about 10,000 high-quality examples for annotation.
Expression Flow Graph Annotation. In a math problem, the natural language solution can be generally formulated as a directed acyclic graph (DAG), where the nodes and edges refer to the intermediate results and derivation steps, respectively [75]. For computation-intensive problems, we consider a special DAG format that adopts intermediate math expressions as nodes. We name it expression flow graphs (EFG), as it can explicitly show how to derive new math expressions based on existing ones in the step-by-step reasoning process. In this way, a solution can be formulated as: starting from initial condition nodes within the problem, we continue deriving new nodes (i.e., intermediate math expressions) from existing nodes, until reaching the final expression that can obtain the answer, where the computation results of intermediate expressions can be utilized for evaluation. Whereas, a math problem may involve special initial conditions that are hard to be converted into readable expressions, e.g., Equations have rational solutions. Thus, we add a special type of node to store these conditions in natural language, while guaranteeing that all the derived new nodes are math expressions. As an example, the EFG annotation of the Problem in Table 1 is shown in Figure 1.
Based on the above definition, we invite five middle school math teachers to crowdsource the annotations of formulated EFGs for collected problems. The annotation process is similar to the information extraction process [76], where we first extract the nodes and then link them to compose the graph. Concretely, we first rely on hand-crafted rules to automatically extract the math expressions and text conditions from the solution texts as node candidates. Then, we ask math teachers to link the related node candidates and annotate their corresponding relations. To reduce the difficulty, we utilize heuristic rules to select the most possible related nodes and relations as references. Consequently, we can collect a set of edges with special relations connecting several nodes from the node candidates,
<sup>4</sup>https://www.zhixue.com/
Table 3: Evaluation results of different LLMs with CoT prompting on CARP.
Models	Acc.	ExpAcc	Fail@where
Fail@first	Fail@mingle	Fail@last
text-davinci-002	31.15	37.45	79.04	11.29	9.65
text-davinci-003	37.50	44.89	73.61	15.41	10.98
claude-v1.3	40.78	46.89	76.85	12.08	11.05
gpt-3.5-turbo	49.39	56.48	69.69	16.36	13.94
which compose the EFG of a problem. After annotation, we further design an automatic verification program to verify the completeness of the EFG and the validity of relations, and filter improper ones. Besides, we also ask teachers to check the annotated EFGs from each other, to judge if the EFG has fully covered the whole problem-solving process of the problem, and refine the incomplete ones.
3.2 Dataset Details
Dataset Description. The statistics of the CARP dataset are shown in Table 2. CARP consists of 4,886 middle school computation-intensive algebra problems, and each problem is associated with a natural language solution and an annotated EFG. Our annotated EFG explicitly depicts the step-by-step reasoning process of a math problem in a readable and concise format. On average, an EFG contains 6.0 nodes and 5.7 edges, as we only keep the expressions and conditions that lead to the final answer in the EFG. Besides, an EFG has 4.7 expression nodes on average, which are the main stem of the reasoning process and can be used for evaluating the accuracy of intermediate steps.
To solve the problems in CARP, LLMs require to iteratively perform reasoning based on math knowledge to correctly derive the intermediate math expressions, and solve it accurately. As the example in Table 1, given the conditions, a reasonable solving process should first deduce the intermediate equation  $a + 2b = 3$  by substituting  $x = 1$  into  $ax + 2bx = 3$ , and then reformulate the equation  $a(y - 1) + 2b(y - 1) = 3$  to support plugging  $a + 2b = 3$  into it. Such a reformulation step is not easy to reason out, and ChatGPT has made a mistake there, leading to a wrong answer.
Evaluation Metrics. Based on EFGs, we can evaluate the intermediate step-by-step reasoning process of LLMs. Specifically, we propose two new metrics, i.e., ExpAcc and Fail@where. ExpAcc measures the recall rate of expression nodes on the reference EFG by the generated output. Considering that a math problem may have different ways to solve it, we also regard the ancestors of a recalled expression in EFG as recalled ones, as the generated output has derived the subsequent conclusion starting from the ancestors. In this way, ExpAcc can be obtained by finding matched expression nodes in the reference EFG, then counting their ancestors and themselves as matched ones for computing the rate. We use SymPy to determine if two mathematical expressions match. Fail@where is another type of metric for analyzing where are the causes of incorrect answers, and we define three implementations, i.e., Fail@first, Fail@middle, and Fail@last. The three metrics refer to the rates of making the first mistakes in the first step, middle steps, and last step (before the answer) within all generated incorrect solutions, respectively.
As shown in Table 3, we evaluate competitive LLMs [2, 77] on CARP with chain-of-thought prompt [7] and report Accuracy, ExpAcc, and Fail@where. First, all LLMs can not solve over half of the problems in CARP (under  $50.0\%$ ), and the accuracy of intermediate steps is relatively low (under 57.0), indicating the difficulty of computation-intensive math reasoning. Second, all LLMs are more likely to make mistakes in the first step, while less likely in the last step. It demonstrates that LLMs are prone to fail in early steps, due to misuse of improper math knowledge or wrong calculations. Thus, careful deliberations on early steps might be promising to reduce errors of the model.
3.3 Tool Interfaces
As the results in Table 3 and existing work [15, 22, 10, 23], it is hard for LLMs to solve computation-intensive math problems, especially for numerical calculation. In the real world, humans can utilize tools (e.g., calculator) to avoid errors in manual work. Inspired by it, we consider augmenting LLMs with tools for handling complicated calculations. Considering the complexity of math calculation, we
devise multiple interfaces based on available tools, to provide specific and practical functionalities. All the interfaces are formulated into a unified format with detailed descriptions, to support convenient manipulation of LLMs. Concretely, we mainly utilize SymPy [78] as the tool, which is a Python library including various basic and advanced arithmetic operators. Based on it, we encapsulate three types of interfaces to help the computation of LLMs: (1) Numerical Computation: compute the value  $v$  of an expression  $e$  by calculating directly or substituting existing conditions. (2) Equation Solving: solve an equation or inequation  $e$ , or solve the system of equations or inequalities  $\{e\}$ . (3) Expression Transformation: transform an expression  $e$  into the desired format  $e'$ .
Based on them, we devise fine-grained interfaces covering commonly used functionalities in math calculation. Details of interface definitions are listed in Appendix A. We set the name, arguments, and output formats of each interface, associated with a docstring that provides a natural language explanation for its usage. These interfaces are general to various computation-intensive math reasoning tasks, and can help LLMs perform complex computations. In addition, we also add a special interface, think, which can utilize the LLM to analyze existing conditions, deduce new conclusions, and create new math expressions, before or after tool manipulation. It can also help handle the cases that fail to invoke computation interfaces, where LLMs think to produce an output instead, to prevent the solving process from being interrupted.
Our proposed CARP dataset focuses on systematically evaluating LLMs in solving computation-intensive math problems. CARP exhibits three key characteristics: First, solving problems in CARP involves multi-step reasoning with math domain knowledge and complex computations; CARP provides fine-grained interfaces to assess the ability of LLMs to manipulate tools during complex reasoning. In this context, LLMs should understand the usage of various interfaces and invoke them appropriately multiple times based on reasoning and math knowledge during the solving process. Third, evaluation metrics for intermediate reasoning steps are incorporated, based on formulated annotations. This allows for a more nuanced analysis of the multi-step reasoning performance of LLMs, in contrast to existing datasets that primarily focus on evaluating outcome accuracy [13-15]. Through these metrics, researchers can quantify the models' proficiency in the problem-solving process and gain insights for model improvement.
According to the results in Section 3.2, LLMs struggle to solve computation-intensive math problems on their own and frequently make mistakes at early reasoning steps. Inspired by the human practice of reviewing and verifying solutions, we propose a new approach that can deliberate the reasoning steps of LLMs with interfaces of tools, namely DELI. The overview of DELI is shown in Figure 2. In DELI, we leverage a retrieval-augmented chain-of-thought prompting strategy to initialize a step-by-step natural language solution. Then, we iterate the two-stage deliberation method that checks and refines the solution from the perspectives of natural language reasoning and tool manipulation. After multiple iterations, we can finally obtain a more reasonable solution with the answer.
4.1 Retrieval-Augmented Solution Initialization