How to Evaluate and Benchmark the Mathematical Reasoning of Large Language Models
This article presents a practical guide to evaluating the mathematical reasoning of large language models. It explains why a single leaderboard score is misleading, breaks mathematical ability into five measurable dimensions, and shows how to build contamination-resistant evaluation sets with controllable difficulty. It also covers tracking chain-of-thought complexity, running an observable and reproducible evaluation pipeline, and avoiding common benchmarking mistakes. Readers will learn how to report a capability vector instead of one scalar score, so model comparisons reflect accuracy, reasoning cost, and verifiability.
1. Background: Why “Which Model Is Better” Is Hard to Answer
In technical communities, discussions about the mathematical ability of large language models quickly collapse into a linear leaderboard: one model ranks first, another second, and the rest follow in order. An implicit assumption behind such discussions is that models differ sharply on open-ended math problems, and that this gap cannot be captured by a single score. From an engineering perspective, this ranking approach has at least three flaws.
First, evaluation task distributions differ. Competition problems, textbook exercises, formal proofs, and applied modeling tasks place completely different demands on a model. A model that leads on standardized competition problems may perform only average on open-ended problems that require it to define variables on its own and judge whether a problem is solvable.
Second, the cost of reasoning is not accounted for. Some models tend to generate very long chains of thought, trading a large number of intermediate steps for final correctness; others produce more concise reasoning that resembles how humans write. If an evaluation looks only at the final answer, the cost difference between the two is completely ignored.
Third, versions and deployment forms differ. The same model family may use different sampling strategies, context lengths, and tool availability across access modes such as chat, workbench, and batch inference, so models with the same name can behave inconsistently in practice.
The core argument of this article is therefore that mathematical reasoning ability should be modeled as a multi-dimensional vector, not a scalar.
2. Capability Layers: Breaking “Math Ability” into Measurable Dimensions
The evaluation dimensions can be split into five progressive layers:
- Arithmetic and symbolic manipulation accuracy: the correctness rate of deterministic steps such as long division, simplifying fractions, and elementary matrix transformations.
- Single-theorem application: whether the model can correctly identify and apply a known theorem (for example, the AM-GM inequality or Bayes’ formula).
- Multi-step chained reasoning: derivations requiring 5 to 20 steps, where an error in any intermediate step leads to a wrong final answer.
- Open-ended problem solving: the problem does not specify a solution path, and the model must complete problem formulation, variable selection, and feasibility judgment on its own. This layer has the highest discriminative power and is the layer where the original discussion claimed a “gap” exists.
- Expression and verifiability: whether the output is clearly structured, whether steps can be reviewed, and whether conclusions can be independently verified by a third party.
In engineering practice, assign an independent weight to each layer and report a vector rather than a total score:
DIMENSIONS = ["arith", "single_theorem", "multi_step", "open_ended", "verifiability"]def score_report(acc: dict, weight: dict) -> dict:# acc: accuracy per dimension; weight: weight per dimensionvector = {d: round(acc.get(d, 0.0), 4) for d in DIMENSIONS}weighted = sum(vector[d] * weight.get(d, 0.0) for d in DIMENSIONS)return {"vector": vector, "weighted": round(weighted, 4)}
The benefit of this design is that when two models have similar total scores, you can pinpoint the source of the difference: whether it is weaker open-ended performance or poorer verifiability.
3. Building the Evaluation Set: Controllable Difficulty and Contamination Resistance
A high-quality evaluation set must satisfy three conditions.
First, difficulty must be labelable in layers. Each problem should be annotated with the minimum number of reasoning steps required and whether a solution hint is provided, making it easy to compute per-layer statistics.
Second, answers must be automatically judgeable. Prefer problem types with a unique final answer that can be compared after symbolic simplification; for proof problems, use a dual condition of “key lemma hit plus correct conclusion” to avoid relying on manual grading.
Third, guard against data contamination. Continuously introduce newly written problems and problems generated with randomized parameters, and keep a private holdout set for regression validation. A sketch of parameter randomization:
import randomdef gen_linear_word_problem(seed: int) -> dict:rnd = random.Random(seed)a, b, c = rnd.randint(2, 9), rnd.randint(2, 9), rnd.randint(10, 99)# Problem: a machines finish c items in x hours; find the hours needed for b machinesanswer = round(a * c / b, 4)return {"prompt": f"{a} machines need {c} hours to finish a batch of tasks. How many hours do {b} machines need?","answer": answer}
Generating thousands of problems from one template effectively reduces inflated scores caused by models memorizing the original items.
4. Chain-of-Thought Complexity: An Overlooked Key Metric
The original discussion noted that models differ markedly in chain-of-thought length and complexity, which deserves to be measured as a separate metric. Three quantities can be collected: average number of generated tokens, number of reasoning steps (split by paragraph or numbering), and number of self-corrections (the frequency of backtracking phrases such as “recompute” or “check again”).
def chain_metrics(text: str) -> dict:steps = [s for s in text.split("\n") if s.strip()]tokens = len(text) # in real engineering, replace with counts from a specific tokenizerbacktracks = sum(text.count(k) for k in ("recompute", "check again", "wait"))return {"tokens": tokens, "steps": len(steps), "backtracks": backtracks}
When interpreting these numbers, note that a longer chain of thought does not mean a stronger model, but a longer chain usually implies higher reasoning cost and lower throughput. If a model’s accuracy is only slightly lower while consuming several times as many tokens, it is actually the worse choice in cost-sensitive scenarios. Conversely, a model with concise and correct reasoning is better suited to latency-sensitive online services.
5. The Evaluation Pipeline: Observable, Regressable, Reproducible
Build the evaluation as a routine pipeline rather than a one-off script. Typical stages include evaluation set version management, batch inference calls, structured storage of results, automatic judging, and a metrics dashboard with alerts. A sketch of the storage record:
{"run_id": "eval-20260901-01","model_tag": "candidate-a","dimension": "open_ended","item_id": "rnd-000217","correct": false,"tokens": 4210,"backtracks": 7}
When deploying on the cloud, you can combine general-purpose capabilities: object storage to hold evaluation sets and raw outputs, a message queue to smooth peaks and support batch inference, a container platform to run judging and statistics tasks, and logging plus monitoring with alerts to track failure rates and latency fluctuations. The general cloud product categories offered by Baidu AI Cloud can cover these stages, upgrading evaluation from manual spreadsheets into sustainable engineering infrastructure.
6. Common Pitfalls and Conclusion
Three pitfalls should be clearly avoided: replacing the capability vector with a single total score; treating chain-of-thought length as proof of ability; and ignoring access-mode differences by directly comparing results from different sampling configurations.
Overall, a reasonable evaluation of mathematical reasoning should answer three questions: which capability layer a model leads in, at what reasoning cost that performance is achieved, and whether the conclusions can be independently verified. The intuition from the original discussion — that one model has a clear advantage on open-ended math problems while the others trade wins with different styles — only becomes engineering-actionable once it is decomposed into the dimensions above. Building a layered evaluation set, turning chain-of-thought into metrics, and running a routine pipeline is the reliable path from subjective impressions to decision-ready evidence.
