TL;DR
The paper introduces GSM8K, a dataset of 8.5K grade-school math word problems written in plain language, with step-by-step solutions in natural language. It shows that large language models fail on many of these problems even when they are finetuned on them. Its fix is a verifier: a second model that reads a finished solution and estimates whether it is correct. At test time the system samples many solutions, and the verifier picks the one it ranks highest.
Builds on: Language Models are Few-Shot Learners (GPT-3), Autoregressive Model, Fine-Tuning, Cross-Entropy Loss, Best-of-N Sampling, Solution Verifier · Leads to: the wider use of trained verifiers and reward models to choose among sampled answers
Why it mattered
GSM8K became one of the standard benchmarks for step-by-step reasoning in language models. Papers that report math performance of new models often report it on GSM8K, frequently alongside the harder MATH dataset. Its problems are easy to state and check, so a single number, the share of problems solved, is easy to compare across systems.
The verifier idea became a standard pattern. Sample several answers, score each one, keep the best. This is the same family as Best-of-N Sampling with a learned scorer. The paper summarises its result as verification giving a gain comparable to a roughly 30 times larger model trained only by finetuning.
The paper has over ten thousand citations on Semantic Scholar.
The problem
Around 2021, large language models could write fluent text and solve many tasks, but multi-step arithmetic reasoning was still weak. The authors name a cause: a model that writes a solution one token at a time has no mechanism to notice that an early step went wrong. A solution that veers off course early usually stays wrong to the end.
Existing math datasets did not measure this well. Some were small. Some gave only equations or final answers, not explanations. Some were large but full of templated or badly checked problems. The paper's dataset is designed to avoid those faults. Its problems are written by people, each one is different from the others, and the solutions are written in words, so a model has to read the question and reason through it.
The problems need only the four basic operations and early algebra, and a bright middle-school student should be able to solve them. The difficulty comes from reading the question correctly and keeping track of several quantities. The dataset has 7,500 training problems and 1,000 test problems.
How it works
Trace one problem through the whole method. The method has two parts, and the paper compares them on the same data.
The baseline is finetuning. A pretrained Autoregressive Model is trained further on the training solutions, using the usual next-token Cross-Entropy Loss. At test time it writes one solution with low sampling temperature and the answer is checked.
The proposed method is verification. It runs in this order:
- Finetune a generator. Train a model, the generator, on the training set.
- Sample many solutions. For each training problem, have the generator write many solutions at a higher temperature so they differ from one another. Label each solution correct or incorrect by one rule only: did its final answer match the true answer. A solution with the right answer reached by flawed reasoning gets the label correct, which the paper accepts as a known source of noise.
- Train the verifier. Train a second model on these labeled solutions. It reads a problem and a candidate solution and outputs the probability that the solution is correct.
- At test time, sample and rank. For each test problem, the generator writes many solutions. The verifier scores each one. The system returns the solution with the highest score.
An invented example of step 4, with three sampled solutions to one problem:
- Solution A ends with the answer 18, and the verifier gives it probability 0.31.
- Solution B ends with the answer 24, and the verifier gives it probability 0.72.
- Solution C ends with the answer 24, and the verifier gives it probability 0.55.
The system returns B. The verifier does not check the arithmetic by itself; it learned from labeled examples which kinds of solutions tend to be right.
A second detail matters. The generator writes the full natural-language solution before the final answer. The reasoning steps are the part the model works through, so the method depends on them being written out.
flowchart LR P[problem] --> G[generator: sample many solutions] G --> V[verifier: score each solution] V --> S[return the highest-scoring solution]
Two more ideas appear in the method. Calculator annotations: the training solutions contain markers such as <<48/2=24>> that show a calculation. At test time, when the model writes an annotation, the system evaluates the expression with a calculator, so arithmetic errors are reduced. Dropout: the paper applies Dropout at 20 percent and reports that it helps both finetuning and verification.
The math
Let be a problem, a candidate solution, and the final answer that ends with. The generator defines a distribution over solutions. Finetuning minimises the average cross-entropy over the training tokens,
where is the token at position and are the tokens before it.
Step 2 in symbols: labels
Each sampled solution gets a label if equals the reference answer, and otherwise. The paper uses only this rule. It does not check the reasoning.
Step 3 in symbols: the verifier
The verifier is a network that gives a score in to the pair . It is trained as a classifier with cross-entropy on the labels,
averaged over the labeled solutions. This is the same loss used for any yes-or-no classifier. The paper compares a verifier that scores every prefix of the solution, which it treats as a token-level value function, with one that scores only the finished solution.
Step 4 in symbols: selection
For samples drawn from the generator, the system returns
Majority voting is a variant. The top-scoring solutions each cast a vote for their final answer, and the answer with the most votes is returned. The paper studies how many solutions should vote.
Results
The paper reports results on the GSM8K test set, using models from the GPT-3 family at two sizes, 6B and 175B parameters.
Finetuning. Test performance rises with training-set size and with model size. The paper extrapolates a trend to estimate how much data and scale would be needed for much higher accuracy, and it cautions that the extrapolation is rough.
Verification. A verifier on a smaller generator can match or beat a finetuned larger model. The paper's summary is that verification gives a boost comparable to a roughly 30 times increase in model size. The paper reports that verifiers gain little when the training set is small, and that the gain grows as the training set grows.
Test-time compute. Performance rises with the number of sampled solutions, but the paper reports that the gain eventually levels off or reverses. Its explanation is that a larger pool gives the verifier more chances to pick a candidate that scores well for the wrong reasons.
Regularisation. Dropout helps the finetuned models, and it also helps verifiers.
Ablations. The paper compares verifiers that score every prefix with ones that score only the finished solution, and it keeps the language-modeling loss as an extra training signal for the verifier. Read the paper's tables for the exact comparisons.
Limits. The dataset is small by modern standards, and the problems need only early algebra. The paper tests only this distribution, and it expects verification to matter more for harder mathematics without showing it here.
Reading guide
Read the paper in this order, and use the lessons listed for each part.
- Abstract and Section 1 (Introduction). Motivation and the main contributions. Needs Autoregressive Model and the idea of a Language Model.
- Section 2 (Dataset). How the problems were written and checked. Needs only the floor. Read the design principles as the reason for the difficulty.
- Section 3 (Related Work). Earlier math datasets and methods, and the closest work on generator-and-ranker systems. Needs Best-of-N Sampling and Solution Verifier.
- Finetuning section. The baseline and its test-time sampling. Needs Fine-Tuning, Cross-Entropy Loss and Softmax Temperature.
- Verification section. The pipeline and its training labels. Needs Solution Verifier and Overfitting.
- Ablation section. Token-level versus solution-level verifiers, which the paper frames as a Value Function. Needs Value Function and Reward Model for the comparison with learned rewards.
- Test-time compute and regularisation sections. Majority voting and dropout. Needs Dropout.
- Appendices. Hyperparameters, calculator details and examples. Read them after the main text.
Check yourself
QuestionWhat is the verifier trained to predict, and what is its training label based on?Show answer
QuestionA system samples 4 solutions. Their verifier scores are 0.2, 0.9, 0.6 and 0.4. Which solution does it return, and why is that the rule?Show answer
QuestionA verifier gives 0.8 to a solution it should label correct (c = 1). What is the cross-entropy loss for that one example, to two decimal places? Use the natural logarithm.Show answer
QuestionDoes sampling more candidate solutions always improve the final answer under verifier ranking? Give the reason the paper gives.Show answer
QuestionWhy does the paper's method keep the generator's full natural-language solution rather than asking the model to output only the final answer?Show answer
Sources
- Cobbe et al., Training Verifiers to Solve Math Word Problems, arXiv:2110.14168, 2021: https://arxiv.org/abs/2110.14168
- The GSM8K dataset repository: https://github.com/openai/grade-school-math