arXiv(opens in a new tab)Computer ScienceMar 2021Cited by 256 papers on PaperVantageClassic Paper

Manuscript Offprint

arXiv:2103.03874

Measuring Mathematical Problem Solving With the MATH Dataset

Dan Hendrycks, Collin Burns, Saurav Kadavath, Akul Arora, Steven Basart, Eric Tang, D. Song, J. Steinhardt

Abstract

Many intellectual endeavors require mathematical problem solving, but this skill remains beyond the capabilities of computers. To measure this ability in machine learning models, we introduce MATH, a new dataset of 12, ⁣50012,\!500 challenging competition mathematics problems. Each problem in MATH has a full step-by-step solution which can be used to teach models to generate answer derivations and explanations. To facilitate future research and increase accuracy on MATH, we also contribute a large auxiliary pretraining dataset which helps teach models the fundamentals of mathematics. Even though we are able to increase accuracy on MATH, our results show that accuracy remains relatively low, even with enormous Transformer models. Moreover, we find that simply increasing budgets and model parameter counts will be impractical for achieving strong mathematical reasoning if scaling trends continue. While scaling Transformers is automatically solving most other text-based tasks, scaling is not currently solving MATH. To have more traction on mathematical problem solving we will likely need new algorithmic advancements from the broader research community.

1 Introduction

Mathematics is a highly effective tool in many intellectual endeavors. It enables us to count and quantify objects, and it can be relied upon because it is consistent and based on logic. Mathematics pervades the sciences and can be used to model planetary orbits, atomic motion, signal frequencies, and much more. These phenomena can be encoded with mathematics precisely and concisely. This has even led some to describe mathematics as being “unreasonably effective” (Wigner, 1960). These observations speak to the broad reach and domain-generality of mathematics.

In machine learning, mathematics is a valuable testbed for problem-solving ability: the ability to analyze a problem, pick out good heuristics from a large set of possibilities, and chain them together to produce an answer. This contrasts with plug-and-chug calculations, a skill which ML models can already exhibit (Henighan et al., 2020). Visual or linguistic reasoning may involve limited problem-solving ability for tasks such as image classification, but unlike math this is not the focus of these domains.

To measure the problem-solving ability of machine learning models, we introduce the MATH dataset, which consists of 12,50012,500 problems from high school math competitions. Given a problem from MATH, machine learning models generate a sequence, such as 23\frac{2}{3}, that encodes the final answer. These answers are unique after normalization, allowing MATH to be scored with exact match rather than with heuristic metrics such as BLEU. In addition, MATH problems are tagged by difficulty from 1 to 5, and span seven subjects including geometry, where diagrams can be specified in text with the Asymptote language. This enables a fine-grained assessment of mathematical problem-solving ability across difficulties and subjects. Finally, problems come with full step-by-step solutions. By training on these, models can learn to generate their own step-by-step solutions, which can facilitate learning and make model outputs more interpretable.

Metamath Theorem Proving

n∈N∧n+12∈N  ⟹  ∃m∈N:n=2m+1n\in\mathbb{N}\land\tfrac{n+1}{2}\in\mathbb{N}\implies\exists m\in\mathbb{N}:n=2m+1. GPT-ff’s generated proof:

|- ((N e. NN0 /\ ((N + 1)/2) e. NN0) -> ((N - 1) / 2) e. NN0) |- (N e. NN0 -> N e. CC) |- 1 e. CC |- ((N e. CC /\ 1 e. CC) -> (N - 1) e. CC )

⋮\vdots

DeepMind Mathematics Dataset

Divide 1136975704 by -142121963. A: -8 Let k(u) = u**2+u-4. Find k(0). A: -4 Sort 2, 4, 0, 6. A: 0, 2, 4, 6 Solve 4 - 4 - 4 = 188*m for m. A: -1/47

v MATH Dataset (Ours) Problem: Tom has a red marble, a green marble, a blue marble, and three identical yellow marbles. How many different groups of two marbles can Tom choose? Solution: There are two cases here: either Tom chooses two yellow marbles (1 result), or he chooses two marbles of different colors ((42)=6\binom{4}{2}=6 results). The total number of distinct pairs of marbles Tom can choose is 1+6=71+6=\boxed{7}. Problem: The equation x2+2x=ix^{2}+2x=i has two complex solutions. Determine the product of their real parts. Solution: Complete the square by adding 1 to each side. Then (x+1)2=1+i=eiπ42(x+1)^{2}=1+i=e^{\frac{i\pi}{4}}\sqrt{2}, so x+1=±eiπ824x+1=\pm e^{\frac{i\pi}{8}}\sqrt[4]{2}. The desired product is then (−1+cos⁡(π8)24)(−1−cos⁡(π8)24)=1−cos⁡2(π8)2=1−(1+cos⁡(π4))22=1−22\left(-1+\cos\left(\frac{\pi}{8}\right)\sqrt[4]{2}\right)\left(-1-\cos\left(\frac{\pi}{8}\right)\sqrt[4]{2}\right)=1-\cos^{2}\left(\frac{\pi}{8}\right)\sqrt{2}=1-\frac{\left(1+\cos\left(\frac{\pi}{4}\right)\right)}{2}\sqrt{2}=\boxed{\frac{1-\sqrt{2}}{2}}.

Figure 1: Previous work is based on formal theorem provers or straightforward plug-and-chug problems. Our dataset, MATH, has competition mathematics problems with step-by-step solutions written in LaTeX and natural language. Models are tasked with generating tokens to construct the final (boxed) answer.

The MATH dataset is challenging: large language models achieved accuracies ranging from 3.0%3.0\% to 6.9%6.9\%. Despite these low accuracies, models clearly possess some mathematical knowledge: they achieve up to 15%15\% accuracy on the easiest difficulty level, and they are able to generate step-by-step solutions that are coherent and on-topic even when incorrect. We also evaluated humans on MATH, and found that a computer science PhD student who does not especially like mathematics attained approximately 40%40\% on MATH, while a three-time IMO gold medalist attained 90%90\%, indicating that MATH can be challenging for humans as well.

The presence of step-by-step solutions allows models to utilize “scratch space”: rather than having to generate a final answer immediately, models can first generate solutions that may contain intermediate computations. Interestingly, we found that having models generate step-by-step solutions before producing an answer actually decreased accuracy relative to immediately outputting a final answer without generating solutions, indicating the solutions are currently not useful for models at test time. In contrast, having models train on solutions increases relative accuracy by 10%10\% compared to training on the questions and answers directly. We also find that models do better with hints in the form of partial solutions. Our results show that models can make use of actual step-by-step solutions provided to them in various ways, but that they are still unable to effectively use their own generated solutions. Bridging this gap poses an interesting direction for further research.

While MATH covers advanced problem-solving techniques, models may first need to be trained thoroughly on the fundamentals of mathematics. To address this, we create the first large-scale mathematics pretraining dataset with hundreds of thousands of step-by-step solutions in natural language and LaTeX. We call this dataset the Auxiliary Mathematics Problems and Solutions (AMPS) pretraining corpus, which consists of Khan Academy and Mathematica data. AMPS has over 100,000100,000 Khan Academy problems with step-by-step solutions in LaTeX; these exercises are used to teach human students concepts ranging from basic addition to Stokes’ Theorem. It also contains over 55 million problems generated using Mathematica scripts, based on 100100 hand-designed modules covering topics such as conic sections, div grad and curl, KL divergence, eigenvalues, polyhedra, and Diophantine equations. In total AMPS contains 23GB of problems and solutions. Pretraining on AMPS enables a 0.10.1 billion parameter model to perform comparably to a fine-tuned model that is 130×130\times larger.

Altogether, while large Transformer models (Vaswani et al., 2017) make some progress on the MATH dataset, such as by AMPS pretraining or by training with step-by-step solutions, accuracy nonetheless remains relatively low. While enormous Transformers pretrained on massive datasets can now solve most existing text-based tasks, this low accuracy indicates that our MATH dataset is distinctly harder. Accuracy also increases only modestly with model size: assuming a log-linear scaling trend, models would need around 103510^{35} parameters to achieve 40%40\% accuracy on MATH, which is impractical. Instead, to make large strides on the MATH dataset with a practical amount of resources, we will need new algorithmic advancements from the broader research community.

References (100)

Couldn't load all references. Reload the page to try again.

Cited by (256)