Paper: GPT Can Solve Mathematical Problems Without a Calculator (ICLR-2024)

Reviewer comment (Experiments):
While specializing for arithmetic is beneficial, it could compromise more general capabilities. Testing on broader math/reasoning tasks could help characterize tradeoffs.

Author response:
In our study, we leverage the continue training strategy to address the limitation of fine-tuning that damages the generic ability of the MathGLM. 

Here, we report the generic ability of the MathGLM on [Z-bench](https://github.com/zhenbench/z-bench). To evaluate the quality of responses generated by the model, we score responses with the powerful GPT-4 on a scale of 1-10 based on factors such as correctness (high priority), helpfulness, relevance, depth, innovativeness, and level of detail.   


|Model | Math | Text|
|----|----|----|
|GLM-10B | 0% | 5.91 |
|MathGLM-10B | 56.6% | 5.35 |



Compared to GLM-10B, MathGLM-10B shows a significant improvement in handling math tasks, with an accuracy of 56.6% compared to GLM's 0%. However, it is also noticeable that there's a slight reduction in the performance on text tasks for MathGLM-10B (5.35) compared to the original GLM (5.91). While MathGLM-10B excels in mathematics, its ability to handle general text tasks is marginally impacted. However, this reduction is not drastic, indicating that the continue training using a hybrid dataset, which includes both mathematical and general text data, helps in retaining the model's overall linguistic competence.

Reviewer comment (Evaluation):
More analysis and examples demonstrating the step-by-step generation process could be useful to understand MathGLM's learned skills.

Author response:
We have included the impact of the step-by-step generation process in the Appendix, particularly in Section D.6. By leveraging the step-by-step generation process, the accuracy on MathGLM-500M rises from 31.96% to 89.57%, while for MathGLM-2B, it increases from 40.76% to 93.03%. This suggests that the step-by-step process is highly effective in enhancing the model's performance. This could be due to the process allowing the model to break down complex problems into smaller, more manageable steps, thereby reducing errors that can accumulate in a single-step solution.

Reviewer comment (Theory):
The reasoning behind curriculum learning's benefits is not fully fleshed out. Is it mainly about efficiency gains?

Author response:
We leverage curriculum learning to enhance inference performance. This approach involves a gradual introduction of increasingly complex tasks during training. Initially, we focus on simpler training instances, specifically within the 5-digit range. This foundational stage allows the model to efficiently grasp basic calculation rules. 

Once the model achieves stable convergence and satisfactory performance on the test dataset, we then implement curriculum learning as a strategic advancement. We introduce a new set of training data that includes numbers ranging from 5 to 12 digits. This methodical escalation in complexity is designed to incrementally challenge and refine the model's capabilities.

Here, we report the performance on MathGLM-2B without using curriculum learning. From the results, it is evident that the use of curriculum learning has a significant impact on the performance of MathGLM-2B. The model, when trained without curriculum learning, achieves an accuracy of 88.70%. However, with the implementation of curriculum learning, the accuracy increases to 93.03%. 

|Model | Accuracy |
|----|----|
|MathGLM-2B (w/o curriculum learning) | 88.70% | 
|MathGLM-2B | 93.03% |

Reviewer comment (Experiments):
How well do the findings transfer to non-Chinese languages? Cross-lingual experiments could help strengthen claims of language-agnostic reasoning.

Author response:
In this study, our primary focus is indeed on Chinese language datasets. To conduct cross-lingual experiments, we develop a Chinese-English mathematical model called MathGLM2-6B. Here, we report a preliminary experimental result on our MathGLM2-6B. We evaluate MathGLM2-6B with the same-scale English mathematical models on three classical inference datasets: Math23K, GSM8K, and MATH. The results indicate that MathGLM2-6B demonstrates promising cross-lingual capabilities. On Math23K, a Chinese language dataset, MathGLM2-6B shows competitive performance with a 61.8% accuracy, slightly behind GPT-4's 63.3%. On GSM8K, MathGLM2-6B achieves an accuracy of 63.00%, slightly lower than the similar-scale model MetaMath-7B. In the MATH dataset, MathGLM2-6B achieves an accuracy of 26.76%. In comparison to other  same-scale models, MathGLM2-6B is ahead of WizardMath-7B, Mammonth-7B, and MetaMath-7B.


|Model | Math23K | GSM8K| MATH |
|----|----|----|----|
|GPT-3.5 | 52.4% |80.8% | 34.1% |
|GPT-4 | 63.3% | 92% | 42.5% |
|WizardMath-7B | - | 54.9% |10.70% |
|Mammonth-7B | - | 50.50% |10.40% |
|MetaMath-7B | - | 66.50% | 19.80% |
|MathGLM2-6B | 61.80% | 63.00% | 26.76% |

Reviewer comment (Evaluation):
Are there any analysis and examples of the errors made by MathGLM? Understanding the remaining limitations could guide future improvements.

Author response:
In the Appendix of our manuscript, specifically Figure 12, we provide a comprehensive analysis of the errors made by MathGLM-10B in solving math word problems. This analysis identifies various types of errors, including misunderstanding the question, calculation mistakes, incorrect application of mathematical knowledge, and common-sense errors. For instance, in cases of misunderstanding the question, the model sometimes confuses terms like 'more than' with 'less than', leading to wrong solutions. Calculation errors occur when the model makes arithmetic mistakes, often producing partially correct answers but failing to arrive at the correct final solution. Knowledge errors are identified when the model incorrectly applies mathematical concepts, such as formulas for area and volume. Common-sense errors are instances where the model's reasoning deviates from typical human logic, for example, in understanding relationships between velocity and distance.

Additionally, we discuss strategies to mitigate these errors in future versions of MathGLM. This involves improving the training data to encompass a wider variety of problem types and incorporating more comprehensive problem-solving procedures. We also consider using a larger model with more training parameters, specifically fine-tuned for math-related tasks. Our ongoing research efforts aim to address these shortcomings, and we expect substantial enhancements in the subsequent iterations of MathGLM.

Reviewer comment (Experiments):
For real-world usage, how does MathGLM handle novel word problems outside its training distribution? Experiments on out-of-distribution generalization could be insightful.

Author response:
For real-world usage, we have conducted experiments on the K6 dataset, a collection of problems specifically designed to test out-of-distribution generalization. The K6 dataset, not included in MathGLM’s training data, is collected from the renowned educational institution, TAL AI Lab. The dataset consists of math problems for each grade level, with each grade containing approximately 100 problems. The wide-ranging nature of these math word problems empowers us to gauge the model’s efficacy across an array of difficulty gradients and academic grades. 

Applying MathGLM to the K6 dataset without additional training allows us to observe its inherent generalization capabilities. As detailed in Figure 6, MathGLM demonstrates notable success in tackling a variety of grade levels compared with the majority of Chinese LLMs. However, we observe that MathGLM's effectiveness in certain grades is not as high as GPT-4's, indicating room for improvement in its performance across the full spectrum of grade levels.

Reviewer comment (Experiments):
The training/testing setup used in the present work differ from those used in similar work, making it challenging to compare the current results with previous contributions. Overall, it seems that the advantage in the reported benchmarks mostly (only?) stems from the use of an extended training set containing math problems, rather than from architectural innovations. This would still constitute an interesting finding, but it should be demonstrated using out-of-distribution test instances (see next point).

Author response:
**Response**: Thanks for your valuable suggestions on evaluating out-of-distribution generalization. 


Here, we expand the scope of our experiments to evaluate the generalization ability of MathGLM. In our study, the pre-training dataset for arithmetic tasks is designed to encompass a wide spectrum of arithmetic operations, spanning from straightforward 1-atomic operation to more complex 9-atomic operations. To evaluate the generalization ability of MathGLM, we conduct additional evaluations with different atomic operations ranging from 10-atomic to 15-atomic involving numbers within the 12-digit range. 

**Different atomic operations within the 12-digit range:**
|Model | 10-atomic | 11-atomic| 12-atomic |  13-atomic| 14-atomic | 15-atomic |
|----|----|----|----|----|----|----|
|MathGLM-2B | 52.05%| 46.48% | 47.83% | 54.17% | 39.06% | 57.41% |

Reviewer comment (Reproducibility):
The paper does not include any Reproducibility Statement or any pointer to source code repositories, which makes it difficult to replicate the simulations and the experimental setup.

Author response:
**Response**: Here, we provide an anonymous repository (https://anonymous.4open.science/r/MathGLM-anonymous-3085) to release our datasets and code.

Reviewer comment (Theory):
The authors say that MathGLM learns to solve arithmetic tasks “by integrating a step-by-step strategy into its architecture”. However, it is not clear how the model architecture actually implements step-by-step reasoning process (from the description, it seems that such feature is just a property of the solution format, rather than of the architecture design). This point should be clarified.

Author response:
**Response**: We apologize for the confusion. In this study, we do not design a new architecture to solve arithmetic tasks. Instead, we construct a pre-training dataset that includes a variety of arithmetic expressions, encompassing different types of arithmetic operations and various types of numbers. 

The key to facilitating the step-by-step reasoning is in the way these expressions are structured and presented in the dataset. This structure of a pre-training dataset provides the model with examples of grasping calculation rules during training and inference.

Furthermore, to enhance the model's ability to handle arithmetic tasks, we employ a unique tokenization strategy. Each digit in an arithmetic expression is tokenized as a distinct token. This approach allows MathGLM to focus on each component of the problem individually, facilitating more accurate computations and enabling the model to follow the step-by-step reasoning pattern inherent in the dataset.

By training MathGLM on this carefully constructed dataset with its unique tokenization method, the model implicitly learns a step-by-step reasoning process, despite not having an architecture explicitly designed for this purpose. Compared with the method that directly calculates the answer of the question, the step-by-step methodology enhances the model's accuracy in arithmetic tasks (Cf. Figure 10).

Reviewer comment (Experiments):
It is not clear whether the curriculum learning strategy is beneficial since there is no comparison with a non-curriculum counterpart.

Author response:
**Response**: We leverage curriculum learning to enhance inference performance and increase model efficiency. This approach involves a gradual introduction of increasingly complex tasks during training. Initially, we focus on simpler training instances, specifically within the 5-digit range. This foundational stage allows the model to efficiently grasp basic calculation rules. 

Once the model achieves stable convergence and satisfactory performance on the test dataset, we then implement curriculum learning as a strategic advancement. We introduce a new set of training data that includes numbers ranging from 5 to 12 digits. This methodical escalation in complexity is designed to incrementally challenge and refine the model's capabilities.

Here, we report the result of the performance on MathGLM-2B without using curriculum learning. From the results, it is evident that the use of curriculum learning has a significant impact on the performance of MathGLM-2B. The model, when trained without curriculum learning, achieves an accuracy of 88.70%. However, with the implementation of curriculum learning, the accuracy increases to 93.03%. 

|Model | Accuracy |
|----|----|
|MathGLM-2B (w/o curriculum learning) | 88.70% | 
|MathGLM-2B | 93.03% |

Reviewer comment (Experiments):
It is not clear how the Ape210K dataset was reconstructed. Were the step-by-step solutions generated in an automatic way? If so, how was their quality verified?

Author response:
**Response**: In our reconstruction of the Ape210K dataset, we employ a Python script to enable a detailed, step-by-step calculation for each math problem (Cf. Figure 3). This enhancement in the dataset is specifically designed to bolster MathGLM's proficiency in grasping the intricate calculation rules essential for solving math word problems. By navigating through these step-wise computations, MathGLM is trained to not only reach the correct answer but also to comprehend the underlying mathematical reasoning. Furthermore, we plan to make the enhanced Ape210K dataset publicly available for open research, contributing to the broader academic community.

Reviewer comment (Experiments):
The authors should more carefully explain how GPT models were tested. Which prompting methods were used to probe these models? How did performance change when using more advanced (e.g., Chain-of-thought) prompting strategies?

Author response:
**Response**: In our evaluation, we use the standard direct prompting method. In this approach, the models are presented with straightforward questions without additional contextual or guiding prompts. This method was chosen to ensure a fair and consistent baseline for comparing the performance of different models.

Reviewer comment (Writing):
The title is misleading, since it suggests that models from the GPT family (e.g., ChatGPT, GPT-4) achieve the best accuracy, while in fact the authors are tuning a model from the GLM family. A better option could be to just use “LLMs” as a more general term?

Author response:
**Response**: Thanks for your nice suggestions!

Reviewer comment (Writing):
“GLM” has not been properly defined in the introduction (I suggest including both the acronym description and the reference paper).

Author response:
**Response**: Thanks for your nice suggestions! We will add the description of the GLM model in the Introduction Section in the next version. We have introduced GLM models in Appendix B.2.

Reviewer comment (Writing):
The manuscript content is often redundant; I suggest removing duplicate (or similar) sentences.

Author response:
**Response**: Thanks for your nice suggestions. We will revise our statements in the next version.

Reviewer comment (Experiments):
Could we extend the evaluation of the new model and see the performance on non-math tasks? The math focus finetune may have reduced the performance on other tasks, and it is good to know how good / bad that would be.

Author response:
In fact, fine-tuning the model specifically for mathematical tasks may have implications for its performance in other domains. This specialized fine-tuning could lead to a reduction in the model's effectiveness in handling non-mathematical tasks.

In order to reduce this effect, we leverage a hybrid dataset dataset that includes both mathematical and text data for the continue training strategy. Specifically, we use a public Chinese text data [Chinese-Vicuna](https://huggingface.co/datasets/Chinese-Vicuna/instruct_chat_50k.jsonl), a rich source of public Chinese text dataset, with our reconstructed Ape210K dataset for continue training. This approach aims to maintain the model's proficiency in general language tasks while enhancing its mathematical abilities. 


To evaluate the performance of the model on non-math tasks, we use the [Z-bench](https://github.com/zhenbench/z-bench), consisting of 63 diverse questions. To evaluate the quality of responses generated by the model, we score responses with the powerful GPT-4 on a scale of 1-10 based on factors such as correctness (high priority), helpfulness, relevance, depth, innovativeness, and level of detail. The results are as follows:


|Model | Math | Text|
|----|----|----|
|GLM-10B | 0% | 5.91 |
|MathGLM-10B | 56.6% | 5.35 |



MathGLM-10B demonstrates a significant improvement in the mathematical task, achieving a 56.6% accuracy, a significant leap from GLM's 0%. However, it's important to note the slight decrease in performance on general text tasks for MathGLM-10B (5.35) compared to GLM-10B (5.91). While MathGLM-10B excels in mathematics, its ability to handle general text tasks is marginally impacted. 


Nevertheless, the marginal reduction in text task performance indicates that the continue training strategy of using a hybrid training dataset has been effective in preserving the model's overall linguistic abilities. Therefore, while there is a noticeable specialization in mathematical tasks, MathGLM-10B maintains a competent level of performance in general language processing.

Reviewer comment (Novelty):
The claim regarding motivation is not robust. While MathGLM achieves a high accuracy of 93.03% on the constructed dataset for complex computations, these calculations can be done with 100% accuracy using other tools.

Author response:
The motivation of our paper is to address the misconception about the capabilities of large language models (LLMs) in performing arithmetic operations. 

1. ***Redefining LLMs Capabilities on Arithmetic Tasks*** 
MathGLM challenges the prevailing notion about LLMs' limitations in arithmetic operations, particularly with longer digits and more complex calculations like decimals and fractions. This contributes to the field by expanding the understanding and capabilities of LLMs in mathematical computations. 

2. ***Beyond Mere Calculations***
We acknowledge that other tools may achieve 100% accuracy. However, we clarify that the uniqueness of MathGLM lies in its ability to handle complex arithmetic operations within the framework of large language models. This allows it to not only perform calculations but also understand and process complex math word problems, which is beyond the capability of many conventional tools. 

3. ***Enhanced Performance in Math Word Problems***
For math word problems, we incorporate this step-by-step strategy into the original Ape210K dataset, which significantly bolsters MathGLM's answer accuracy (42.29% performance gains).

Reviewer comment (Theory):
The computation is limited to addition, subtraction, multiplication, division, and exponentiation. The method probably wouldn't generalize well to more intricate computations such as log, sin, etc. Moreover, mathematics should aim for complete accuracy, so utilizing LLMs for these calculations isn't a suitable strategy, especially considering the costly pretraining involved for computations that other tools can resolve more efficiently. Instead, LLMs should concentrate on providing more insight and higher-level strategies for solving math problems.

Author response:
In this study, we focus on addressing the misconception about the capabilities of large language models (LLMs) in performing arithmetic operations. MathGLM is currently limited to basic operations like addition, subtraction, multiplication, division, and exponentiation. 

It's important to note that functions like logarithm and sine, which are more complex, are not directly computable by humans without tools. We often rely on calculators for these function calculations, suggesting that LLMs may not be critically needed for such intricate calculations. 


We agree with your claim that LLMs should concentrate on providing more insight and higher-level strategies for solving math problems. In our study, we find that calculation errors are a significant error type in solving math word problems (Cf. Figure 9). In order to enhance the performance of MathGLM-10B in solving math word problems, we incorporate an additional 5,500 calculation-specific training data into the reconstructed Ape210K, and evaluate performance on the Ape210K test dataset. From the results, we can observe that by adding calculation-specific data, MathGLM-10B's performance is significantly improved compared with the original MathGLM-10B (reported in our manuscript). Therefore, the study of calculation also plays an important role in solving math word problems. 



|Model | Accuracy |
|----|----|
|GPT-3.5 | 39.78% | 
|GPT-4 | 59.57% |
|MathGLM-10B | 58.68% | 
|MathGLM-10B (with calculation-specific data)  | 63.20% |

Reviewer comment (Experiments):
The primary math word problem datasets are APE and K12, both of which are in Chinese. There were no experiments conducted on popular math datasets like MATH and GSM8K. Since GPT-4 is primarily trained in English, and MathGLM is fine-tuned for Chinese math word problems, such a comparison might not be valid. The advantage of MathGLM could be due to the language, rather than its proficiency in resolving math problems.

Author response:
In this study, our primary focus is indeed on Chinese language datasets. However, it's important to clarify that the effectiveness of MathGLM is not solely attributable to the language aspect.


To further verify our claim, we develop a Chinese-English mathematical model called MathGLM2-6B. Here, we report a preliminary experimental result on our MathGLM2-6B. We evaluate MathGLM2-6B with the same-scale English mathematical models on three classical inference datasets: Math23K, GSM8K, and MATH. The results indicate that MathGLM2-6B demonstrates promising cross-lingual capabilities. On Math23K, a Chinese language dataset, MathGLM2-6B shows competitive performance with a 61.8% accuracy, slightly behind GPT-4's 63.3%. On GSM8K, MathGLM2-6B achieves an accuracy of 63.00%, slightly lower than the similar-scale model MetaMath-7B. In the MATH dataset, MathGLM2-6B achieves an accuracy of 26.76%. In comparison to other same-scale models, MathGLM2-6B is ahead of WizardMath-7B, Mammonth-7B, and MetaMath-7B.


In conclusion, while language is an important aspect of our model, the primary advantage of MathGLM lies in its ability to understand and solve complex mathematical problems. 



|Model | Math23K | GSM8K| MATH |
|----|----|----|----|
|GPT-3.5 | 52.4% |80.8% | 34.1% |
|GPT-4 | 63.3% | 92% | 42.5% |
|WizardMath-7B | - | 54.9% |10.70% |
|Mammonth-7B | - | 50.50% |10.40% |
|MetaMath-7B | - | 66.50% | 19.80% |
|MathGLM2-6B | 61.80% | 63.00% | 26.76% |