How to Evaluate Large Language Model Math Reasoning: Methods and Practice
This article presents a practical framework for evaluating the mathematical reasoning ability of large language models in a rigorous, reproducible, and scalable way. Instead of relying on subjective rankings, it breaks math capability into five measurable levels, explains how to build evaluation sets with layered sampling and contamination control, and shows how to assess process quality rather than final answers alone. It also covers experiment design with repeated sampling, cost and engineering constraints, and common pitfalls, helping developers make model selection and regression testing decisions based on reproducible data.
1. Why “Which Model Is Better” Is Hard to Answer in One Sentence
In model selection and capability assessment, a recurring debate is how different large language models actually rank on advanced math and open-ended math problems. Original discussions are often full of subjective rankings and anecdotal impressions, which offer limited value for engineering decisions for three reasons:
- Opaque samples: The source of the problems, their difficulty distribution, and whether they are covered by training data are all unknown.
- Inconsistent judging criteria: Some people look at the final answer, some at the reasoning process, and some at the style of expression.
- Mixed versions and access modes: The same model can perform noticeably differently across different endpoints, context lengths, and tool configurations.
Therefore, this article does not repeat any specific product rankings. Instead, it frames the issue as an engineering problem: how to build a rigorous, reproducible, and scalable evaluation system for the mathematical reasoning ability of large language models. This system also applies to horizontal comparisons of coding assistants, common industry solutions, and self-built enterprise model services.
2. Capability Layers: Breaking “Math Ability” into Measurable Dimensions
A vague claim that a model is “good at math” cannot guide selection. It is better to split capability into at least five levels:
- L1 Calculation and symbolic manipulation: Arithmetic, algebraic transformation, and unit conversion, testing basic reliability.
- L2 Standard problem solving: Routine problems in calculus, linear algebra, and probability and statistics.
- L3 Multi-step proofs: Problems that require constructing auxiliary results, case analysis, and inequality bounds.
- L4 Open-ended math problems: Problems with no standard solution, requiring the model to set its own strategy and revise it.
- L5 Expression and verifiability: Whether conclusions can be checked, whether steps can be recomputed, and whether uncertainty is acknowledged.
The differences truly emphasized in the original discussion are concentrated in L4 and L5: whether a model can keep making progress without a clear path, instead of starting to “guess the answer” at step three. This is extremely important in engineering, because L1–L3 capabilities are already highly homogeneous, and selection value mainly comes from L4/L5.
3. Building the Evaluation Set: Difficulty, Coverage, and Contamination Control
The quality of the evaluation set sets the upper bound of the conclusions. In practice, it is recommended to:
- Use layered sampling: Keep a fixed proportion for each of L1–L5, avoiding dilution of high-level problems by a large number of easy ones.
- Construct new problems: Perturb parameters, add or remove conditions, and combine two old problems to reduce the chance of memory hits.
- Keep verifiable answers: Prioritize multiple-choice, fill-in-the-blank, and numerically checkable results to reduce manual scoring costs.
- Record metadata: Problem source, construction method, expected number of steps, and whether external tools are required.
An illustrative data structure (independent of any specific platform):
{"id": "math-0421","level": "L4","prompt": "Given a function that satisfies..., provide the construction idea and prove the conclusion","answer_type": "proof","rubric": ["reasonable strategy choice", "complete case analysis", "recomputable conclusion"],"expected_steps": 12,"contaminated_risk": "low"}
4. Process Quality Assessment: Chain-of-Thought Length Is Not Capability
The original discussion mentions that different models have chains of thought of different lengths and complexity. This suggests that the “process” must be treated as an independent metric, rather than looking only at the final answer.
Practical ways to quantify it include:
- Median number of steps: Reflects how verbose the reasoning is.
- Effective step ratio: The proportion remaining after removing repetition, backtracking, and self-restatement.
- Number of backtracks: How often “that was wrong earlier, let me reconsider” appears; too high indicates unstable strategy.
- Conciseness score: Given a correct conclusion, fewer steps earn a higher score.
- Expression naturalness: Human or rule-based assessment of readability, avoiding mechanical stacking.
It must be emphasized that a long chain of thought may be deep exploration or inefficient circling; a short chain of thought may reflect strong insight or skipping key verification. Therefore, accuracy must be viewed together with process metrics. Looking at any single dimension will lead to wrong conclusions.
5. Experiment Design: Repeated Sampling, Temperature, and Judging Constraints
The randomness of a single generation is high, so rigorous evaluation needs to fix the following variables:
- Number of samples (e.g., repeat each problem 5–10 times) and report the mean and variance;
- Generation parameters (temperature, maximum output length) kept consistent;
- Whether calling computational tools is allowed and whether multi-turn follow-up is allowed;
- Judging method: prioritize automatic verification; for subjective problems, use multiple blind reviewers with scoring rubrics.
A simplified evaluation main loop:
def evaluate(model_client, items, repeats=5):stats = {}for it in items:runs = [model_client.solve(it["prompt"]) for _ in range(repeats)]correct = sum(1 for r in runs if check(r, it)) / repeatssteps = median([count_steps(r) for r in runs])stats[it["id"]] = {"accuracy": correct,"variance": variance([check(r, it) for r in runs]),"median_steps": steps,"level": it["level"]}return aggregate_by_level(stats)
aggregate_by_level summarizes results separately for L1–L5, ultimately forming a “capability radar chart” rather than a single vague total score.
6. Cost and Engineering Constraints: Evaluation Must Work in Production
Enterprise selection cannot look at accuracy alone; it must also account for:
- Cost per problem: Input and output token consumption multiplied by unit price;
- Latency distribution: P50/P95 response time; long chains of thought often push up P95;
- Concurrency and rate limits: Whether truncation or timeouts occur under high concurrency;
- Observability: Whether it is easy to integrate with logging services and monitoring alerts to locate failed samples.
On Baidu AI Cloud, the evaluation pipeline can be broken down into general-purpose capability combinations: use a container platform to host evaluation tasks, object storage to save problems and results, a message queue for task distribution, and logging services with monitoring alerts to track failure rates and latency fluctuations. This turns evaluation from a “one-off script” into a sustainable engineering quality gate for regression.
7. Common Pitfalls and Conclusion
- Overgeneralization: Ranking models based on individual problems or cases; the conclusions do not transfer.
- Confusing access modes: Directly comparing results from different access methods and context configurations.
- Ignoring variance: Not repeating samples and treating random fluctuation as capability difference.
- Only looking at answers: Ignoring process verifiability, leading to a production environment that “seems to answer correctly but cannot be recomputed”.
In summary, instead of arguing whether one model “beats” another, it is better to build an evaluation mechanism that combines a layered evaluation set, process metrics, and cost accounting. For developers, this method can be directly used for coding assistant selection, regression testing of internal model services, and building an automated evaluation platform on top of general cloud capabilities, so that technical decisions rest on reproducible data rather than subjective impressions.
