Evaluating Mathematical Reasoning in Large Language Models: Methods and Model Selection
Learn how to systematically evaluate the mathematical reasoning capabilities of large language models. This guide covers evaluation dimensions, test set construction, a reproducible evaluation workflow with sample code, result interpretation, and how to translate evaluation findings into practical model selection decisions.
Why Systematic Evaluation Matters
Judging whether a large language model is reliable on mathematical tasks is often done informally, based on a handful of subjective impressions. This approach has three problems. First, the sample size is too small: getting one or two problems right or wrong is largely a matter of chance. Second, the difficulty and type of the problems are not transparent, so you cannot tell whether the model performs well on routine problems or has genuine ability on open-ended, hard ones. Third, conclusions are hard to reproduce—someone following the same steps may reach an entirely different judgment.
Evaluation should therefore be conducted like engineering testing: define the goal first, design the samples, fix the procedure, and then interpret the results with statistical methods.
Breaking Down the Evaluation Dimensions
Mathematical ability is not a single metric. It should be decomposed into at least the following five dimensions.
- Correctness: whether the final answer matches the reference answer. This is the most basic metric, and you need to distinguish multiple-choice, fill-in-the-blank, and proof problems, since their grading rules differ.
- Reasoning quality: whether intermediate steps contain logical leaps, cite incorrect theorems, or omit conditions. For proof problems, reasoning quality often matters more than the final answer.
- Stability: whether the same problem yields consistent results across multiple runs. If a model answers correctly only twice out of three attempts, its ability sits in a boundary region, and a single result cannot represent its true level.
- Verifiability: whether the output can be independently checked—for example, whether the given computation can be reproduced with a program.
- Cost and latency: average time per problem and the cost per task. Both directly affect the feasibility of batch usage.
Each dimension should have a corresponding record field. Otherwise, the evaluation ends with only a single aggregate score, making it impossible to locate problems.
Building the Test Set
The test set determines the ceiling of your evaluation results. Keep the following in mind when building it.
- Tiered coverage: divide problems by difficulty into four levels—basic, intermediate, competition-level, and open problems. Each tier needs enough items to support statistics, generally no fewer than fifty per tier.
- Balanced problem types: computation, algebraic derivation, geometric proof, and combinatorial counting should be distributed in proportion. If problems concentrate in one category, the conclusions apply only to that category.
- Decontamination checks: problems from public datasets may already be in the model’s training data. You can modify the numbers or conditions of some problems and compare performance against the originals. If scores drop noticeably, the original results likely included a memorization component.
- Double-checking reference answers: answers should be verified by humans or reliable symbolic computation tools. A wrong reference answer will mark a correct model as failed, directly distorting the results.
Evaluation Workflow and Sample Code
The evaluation workflow should fix the input format, prompt template, parsing rules, and grading criteria. If any one of these changes, results are no longer comparable.
Below is a simplified evaluation framework. The model invocation function and answer parsing function need to be implemented based on your actual integration; only the workflow structure is shown here.
import statisticsdef evaluate(model_fn, extract_final_answer, items, runs=3):"""model_fn: takes a problem text and returns the model's raw outputextract_final_answer: parses the final answer from the raw outputaccording to the agreed formatitems: list of problems, each containing id, question, answerruns: number of repetitions per problem, used to assess stability"""per_item = []for item in items:hits = []for _ in range(runs):raw = model_fn(item["question"])hits.append(extract_final_answer(raw) == item["answer"])per_item.append({"id": item["id"],"accuracy": sum(hits) / runs,"all_correct": all(hits),})overall = statistics.mean(r["accuracy"] for r in per_item)stable_ratio = sum(r["all_correct"] for r in per_item) / len(per_item)return {"overall_accuracy": overall, "stable_ratio": stable_ratio, "details": per_item}
In practice, you should also record the latency and cost of each call and save the raw outputs. Keeping raw outputs helps with manual review of whether the grading was reasonable.
Interpreting the Results
Once you have the numbers, do not directly compare two models’ overall scores. Pay attention to the following when interpreting results.
- Look at confidence intervals: with small sample sizes, a gap of a few percentage points may just be noise. You can estimate the error range using binomial confidence intervals; when intervals overlap, no conclusion should be drawn.
- Look at error types: classify errors into computational slips, conceptual errors, omitted conditions, logical leaps, and so on. Two models with the same total score but different error profiles suit different scenarios.
- Look at difficulty tiers: an overall score can mask differences on high-difficulty problems. Report results for each tier separately.
- Distinguish “can solve” from “can solve reliably”: metrics like stable_ratio reflect whether a model is dependable. In scenarios requiring reproducible results, stability is more valuable than occasional high scores.
From Evaluation to Model Selection
Evaluation results ultimately serve concrete tasks. When selecting a model, you can build a decision matrix by task type.
| Task Type | Primary Focus | Secondary Factors |
|---|---|---|
| Batch computation, data verification | Correctness, stability | Per-problem cost |
| Proof-style derivation, research assistance | Reasoning quality, verifiability | Latency (as long as acceptable) |
| Tutoring and step-by-step explanation | Clarity of expression, completeness of steps | Stability |
| High-frequency automated pipelines | Cost, latency, stability | Performance on the hardest problems |
Avoid relying on a single leaderboard when selecting a model. A leaderboard’s test set, prompts, and grading rules usually differ from your own business context and should only serve as a reference.
Budget and Quota Management
When using compute resources or credits on various platforms, quotas often approach expiration while still unused. A practical approach:
- Before the quota expires, list pending tasks and rank them by value.
- Assign high-value tasks to the model whose capabilities match best, and avoid spending the quota on low-value experiments.
- Set a cap per task—for example, each call should not exceed a certain proportion of the budget.
- Record the actual consumption of each task to inform future estimates.
This both prevents resource waste and makes usage traceable.
Common Pitfalls
- Replacing systematic testing with personal impressions: impressions from a small sample are easily skewed by problem style and phrasing.
- Ignoring prompt differences: the same model can behave very differently under different prompts; comparisons must standardize them.
- Overlooking data leakage: public datasets without decontamination can produce inflated scores.
- Mistaking fluent reasoning for correct reasoning: outputs that read smoothly and look well-organized can still contain critical errors and need step-by-step verification.
The core of mathematical ability evaluation is reproducibility, interpretability, and decision usefulness. By following the process above, your conclusions can withstand scrutiny and genuinely support technical model selection.
