Evaluating LLM Mathematical Reasoning: A Reproducible Approach
Evaluating the mathematical reasoning capabilities of Large Language Models (LLMs) requires moving beyond subjective impressions to structured, reproducible metrics. This article outlines a comprehensive framework for assessing LLM math capabilities, covering goal definition, question bank construction, multi-dimensional scoring, automated and manual verification, and statistical interpretation. By implementing this methodology, teams can establish a continuous evaluation mechanism to make data-driven engineering decisions.
1. Why Structured Evaluation is Needed
A single interaction with a model can easily create an impression bias. Changing the phrasing of a problem or using a different sampling seed can yield completely different results. Someone might draw a sweeping conclusion just because the model solved a difficult problem, while others might dismiss it entirely after a single failure. These judgments lack comparability and cannot support sound engineering decisions.
The core of structured evaluation is transforming the subjective feeling of “whether it seems good” into repeatable, testable metrics. Evaluation requires clarifying three things: what to test, how to test, and how to determine the outcome.
2. Defining Evaluation Goals and Boundaries
Mathematical capability is not a single metric. Common evaluation goals include the following categories:
- Calculation and Solving: Problems with standard answers, such as algebraic simplification, integration, and combinatorial counting.
- Proof Construction: Problems requiring a complete logical chain. The answer alone is insufficient; the derivation process must also be verifiable.
- Open-ended Questions: Research-oriented questions without an established consensus answer. The evaluation focuses on whether the argumentation is rigorous and whether the model can accurately identify the applicable boundaries of known conclusions.
- Application Modeling: Translating real-world problems into mathematical models and solving them.
Different goals require different question banks, grading criteria, and scopes of conclusion applicability. Using the accuracy rate on calculation problems as a proxy for proof capability is a common misuse.
Before reporting conclusions, you should clearly state the evaluation scope: which problem types were tested, what difficulty range was used, what prompting method was employed, and whether external tools were allowed. Conclusions without defined boundaries cannot be reproduced or challenged by others.
3. Constructing the Question Bank
The quality of the question bank determines the credibility ceiling of the evaluation results. It is recommended to follow these principles:
- Stratification: Divide by difficulty into basic, advanced, competition, and research levels. Retain sufficient samples for each level to avoid representing the whole with just a few problems.
- Anti-leakage: Publicly available problems may have already been included in the training data. Prioritize newly released problems or create your own, and record the source and release date of each problem to facilitate tracing data contamination.
- Version Control: Problems, standard answers, and grading rules all require version numbers. If a problem is modified, historical results must be re-tagged with the new version; otherwise, horizontal comparisons are impossible.
- Disambiguation: Each problem needs a unique grading criterion. If the problem statement is ambiguous, the same answer might be judged as correct or incorrect by different reviewers.
4. Scoring Dimensions
A simple “right or wrong” loses a significant amount of information. It is recommended to score at least from the following dimensions and record them separately:
- Conclusion Correctness: Whether the final answer is equivalent to the standard answer.
- Argument Validity: Whether each derivation step holds, and whether there are skipped steps, circular reasoning, or shifting of premises.
- Completeness: Whether all requirements of the problem are covered. For example, when asked to “prove all cases,” it must be checked whether the case division truly exhausts all possibilities.
- Reasoning Efficiency: The length and redundancy of the reasoning process, under the premise of achieving the same accuracy rate.
- Expression Clarity: Whether the reader can easily check it step by step. This serves as an auxiliary metric and cannot replace correctness.
- Self-verification: Whether the model can point out weak links in its own argumentation and label uncertain conclusions with a confidence interval.
These dimensions should be recorded separately and not merged into a single total score, which would discard details. Details are what explain the reasons for failure.
5. Automated Verification and Manual Review
For problems that can be formalized, programmatic verification should be used as much as possible.
- Algebraic and numerical problems can be simplified and compared using symbolic computation tools, or checked by substituting numerical values.
- Finite combinatorial problems can use enumeration as a reference.
- Formal proofs can be handed over to proof checkers for verification.
Parts that cannot be covered by automated verification require review by domain experts. During review, a double-blind method should be adopted, meaning reviewers do not know which system the answer came from, and the inter-rater reliability coefficient should be calculated. If there is significant disagreement between two experts, the grading guidelines should be revised first before continuing the evaluation.
6. Example Evaluation Workflow
The following code demonstrates a minimal evaluation framework. The model invocation part uses a placeholder function, which should be replaced with your team’s actual inference interface.
import jsonimport randomfrom dataclasses import dataclass@dataclassclass Problem:pid: strlevel: str # basic / advanced / competition / researchstatement: strreference: str # standard answer or grading guidelineschecker: str # symbolic / numeric / manualdef call_model(prompt: str, seed: int) -> str:"""Placeholder function: replace with actual model inference call."""raise NotImplementedErrordef run_eval(problems, n_samples=5, seed=0):random.seed(seed)records = []for p in problems:for k in range(n_samples):out = call_model(p.statement, seed=seed * 1000 + k)records.append({"pid": p.pid,"level": p.level,"sample": k,"output": out,"checker": p.checker,})return recordsdef save(records, path="eval_records.jsonl"):with open(path, "w", encoding="utf-8") as f:for r in records:f.write(json.dumps(r, ensure_ascii=False) + "\n")
The key points of this code are: sampling multiple times per problem, recording the complete output, and preserving the problem metadata. Subsequent scoring, statistics, and reviews are all based on this raw record, ensuring the conclusions can be recalculated and verified.
7. Statistics and Result Interpretation
- Sample Size: The results of a single problem with a single sample fluctuate greatly. Each difficulty level should contain enough problems, and each problem should be sampled multiple times to estimate the confidence interval of the pass rate.
- Sources of Variance: Sampling temperature, random seeds, and prompt wording all affect the results. When comparing two systems, these variables should be fixed, or their impacts should be reported separately.
- Significance: A difference of a few percentage points in pass rates between two systems may not be statistically significant. You can use a binomial test, or use the bootstrap method to estimate the interval of the difference.
- Failure Analysis: Categorize failed samples by type, such as calculation errors, omitted cases, or incorrect theorem citations. Categorization results are more instructive for improvement than the overall pass rate.
8. Common Pitfalls
- Extrapolating the whole from a few cases: The performance on one problem cannot represent an entire category of capability.
- Equating reasoning length with quality: A longer reasoning process might be redundant derivation or an error-correction process; the content itself must be examined.
- Equating writing style with correctness: Fluent, well-organized expression might mask logical errors.
- Ignoring question bank leakage: If the model has seen the problem during training, a high score says nothing about its reasoning ability.
9. Implementation Suggestions
Teams can consolidate the above process into a regular mechanism. Store the question bank in object storage with version control, write inference records to a logging service, connect core metrics to monitoring and alerts, and automatically trigger regression evaluations after each model update. This ensures that every change has comparable data, allowing decisions to be based on data rather than personal impressions.
When evaluation results conflict with intuition, you should first check the question bank, grading rules, and sampling settings before considering the model itself.
