How to Evaluate and Benchmark LLM Mathematical Reasoning: A Practical Guide
This guide presents a practical methodology for evaluating large language models on mathematical reasoning. It defines the scope of math capability across four categories, proposes a three-tier evaluation framework, explains how to fix sampling and prompting variables for reproducibility, and introduces dual-track scoring that checks both answers and reasoning steps. It also covers key metrics such as solvability rate, stability, and unit cost, along with common pitfalls like benchmark contamination and version drift, and offers deployment recommendations for building an offline evaluation pipeline. Readers will learn how to replace vague model rankings with reproducible, scenario-specific conclusions.
1. Background: Why “Which Model Is Better” Rankings Fail to Convince
In engineering model selection, teams often run into debates about where a given model actually stands on math tasks and whether it is good enough for the business requirements. A typical pattern in such discussions is to arrange several models into tiers and claim that one model sits “between two versions.” Conclusions like this usually come from personal usage experience, with small sample sizes, an opaque distribution of problems, and sampling parameters that were never fixed, so reproducibility is very weak.
A more reasonable approach is to reframe the question: under a clearly defined task distribution and constraints, what are the model’s solvability rate, stability, and cost? A ranking is only one projection of the result; what really matters is the evaluation design itself. This article does not focus on any specific product. Instead, it lays out a general evaluation methodology that helps developers reach conclusions in their own scenarios.
2. Define the Boundary of “Math Capability” First
“Math capability” is an over-generalized term. In engineering, it should at least be split into four categories, each requiring a completely different evaluation approach:
- Arithmetic and numerical precision: multi-step computation, unit conversion, and boundary-value handling, checking whether calculation drift occurs.
- Symbolic and algebraic reasoning: solving equations, simplification, and identity transformations, checking whether intermediate steps are verifiable.
- Combinatorics and probability modeling: counting, recurrences, and expected-value computation, checking whether cases are missed or double-counted.
- Open-ended math problems: problems that require autonomously constructing auxiliary lines, introducing variables, and designing proof paths, checking exploration depth and self-correction.
The original discussion emphasized that “being able to solve open-ended math problems” is the watershed, and this holds up in engineering: the first three categories can achieve high scores through templated prompts, while the fourth cannot be completed by pattern matching and depends on longer reasoning chains and backtracking ability.
3. Designing a Layered Evaluation Framework
A three-layer structure is recommended, tightening the scope of the conclusions layer by layer.
The first layer is a smoke set of about 50 to 100 problems, used for fast regression to determine whether a version upgrade introduces degradation. The second layer is the main evaluation set of 300 to 1000 problems, sampled in layers according to the four categories above to ensure enough samples in each category. The third layer is a hard-problem set dedicated to open-ended problems and multi-step proofs; the sample does not need to be large, but the key steps of the standard solution must be annotated manually.
The key constraint of layering is that problems must not enter the training corpus. In practice, you can reduce contamination risk through a “private problem bank + periodic rotation + variant rewriting,” for example by applying equivalent transformations to the problem statements, changing numerical values, or adjusting the order of the narrative.
4. Prompting and Sampling: Lock Down the Variables
When evaluation conclusions are not reproducible, in most cases it is not a model problem but a failure to lock down variables. At minimum, fix the following:
temperature = 0 # or fixed at 0.2 and noted in the reporttop_p = 1.0max_tokens = enough to cover the longest chain of thoughtseed = fixed value (if supported by the platform)n_samples = 1 (deterministic evaluation) / 5~8 (stability evaluation)system_prompt = unified template requiring the model to list the approach before calculating
For scenarios where stability needs to be examined, it is recommended to sample the same problem multiple times and compute the pass rate rather than relying on a single result. A single success may come from luck; the variance of the pass rate is the direct source of engineering risk.
5. Scoring: From “Checking the Answer” to “Checking the Process”
Comparing only the final answer masks two types of problems: a correct answer with flawed reasoning, and a wrong answer with a correct method. Dual-track scoring is recommended.
The answer track uses executable validation logic, for example error comparison for numeric problems and substitution verification for equation problems:
def check_numeric(pred, gold, rel=1e-6):try:return abs(float(pred) - float(gold)) <= rel * max(1.0, abs(float(gold)))except (TypeError, ValueError):return Falsedef check_equation(expr, solution):# Substitute the solution into the original equation and check whether it holds identicallyreturn substitute_and_simplify(expr, solution) == 0
The process track combines rules with manual spot checks: checking for circular reasoning, skipped steps, and missed cases at critical classification points. For open-ended problems, it is recommended that two reviewers annotate independently, that samples with disagreements go to third-party arbitration, and that consistency metrics be computed.
6. Metric Selection: Solvability Rate, Stability, and Cost
A single accuracy figure is not enough to support decisions; it is recommended to look at three dimensions together:
- Solvability rate: the pass ratio on the hard-problem set, reflecting the capability ceiling.
- Stability: the variance of the pass rate across multiple samples of the same problem, reflecting production readiness.
- Unit cost: includes the overhead from input and output length; long chains of thought significantly amplify consumption on the output side.
A common mistake is to look only at solvability rate while ignoring output length. Some models tend to generate extremely long reasoning processes; although their accuracy is not low, the cost and latency are unacceptable in high-concurrency scenarios. Therefore, it is recommended to introduce an “effective reasoning length” metric, the average output length of correct samples, to assess redundancy.
7. Common Evaluation Pitfalls
- Benchmark contamination: public problems have been widely trained on, inflating scores. The countermeasure is privatization and variant rewriting.
- Prompt leakage: the prompt unintentionally reveals the solution structure, making scores incomparable.
- Scorer defects: numeric comparison without a tolerance, or equivalent expressions judged wrong.
- Version drift: silent updates on the platform side invalidate historical conclusions, so the evaluation time and version identifier must be recorded.
- Selection bias: testing only the problem types you are good at, so the conclusions cannot be extrapolated.
8. Implementation Recommendations
If the goal is to integrate mathematical reasoning capability into a business, you can first build an offline evaluation pipeline on a container platform, use object storage to keep the problem bank and results, use a message queue to decouple sampling from scoring, and use logging services and monitoring alerts to track pass-rate fluctuations. If you use a cloud model service, the evaluation configuration should be managed as code to ensure every conclusion is traceable.
Ultimately, rewriting “which rank a model is in” into “under my problem distribution, the solvability rate and stability meet the thresholds and the unit cost is acceptable” is what makes a deliverable engineering conclusion. Baidu AI Cloud’s related practices also emphasize replacing generalized rankings with scenario-based evaluation, which is consistent with the method above.
