Evaluating Mathematical Reasoning in Large Language Models: Methods and Practices
This article provides a systematic framework for assessing the mathematical reasoning capabilities of large language models (LLMs). It outlines the core evaluation dimensions, test set design principles, answer verification methods, reasoning process analysis, and reporting practices. The goal is to help practitioners build reproducible, comparable, and interpretable evaluation pipelines, avoiding common pitfalls such as small sample sizes, data contamination, and over-reliance on final-answer accuracy.
Why Systematic Evaluation Matters
Judging a model’s mathematical ability based on a few questions often leads to unreliable conclusions. With small sample sizes, biased question selection, or answers that may already exist in the training data, the model’s output style can also influence human perception. A robust evaluation must satisfy three requirements: reproducible results, comparability across different models, and explainable failure cases.
Decomposing Evaluation Dimensions
Mathematical reasoning capability can be broken down into several measurable dimensions.
- Correctness of the final answer: Whether the final answer is equivalent to the standard answer. This is the most basic metric, but by itself it does not reflect reasoning quality.
- Soundness of the process: Whether intermediate steps are valid, whether there are unsupported jumps, whether theorems are misapplied, or whether conclusions are drawn without satisfying the required preconditions.
- Performance across difficulty levels: Models often show significant differences between basic calculations, competition-style problems, and open research questions. These should be reported separately.
- Stability: Whether the model produces consistent results for the same problem when sampled multiple times with identical parameters. An unstable model—even if it occasionally answers correctly—cannot be relied upon in practical scenarios.
- Reasoning efficiency: The output length and computational resources needed to solve a problem. Length alone does not indicate quality and should be interpreted together with accuracy.
- Expression and formatting: Whether the answer format meets the requirements and whether the proof structure is complete. This dimension matters but should not dominate the overall score.
Test Set Design Principles
The test set is the foundation of evaluation. Design considerations include:
- Diverse sources: Cover algebra, number theory, combinatorics, analysis, geometry, and other areas, avoiding concentration on a single problem type.
- Preventing data contamination: Public problems may already be present in training corpora. It is advisable to build a private test set and record the source, publication date, and any modifications for each problem. For public problems, rewriting parameters or transforming conditions can reduce the risk of memorization.
- Reliable difficulty labeling: Have multiple experts independently label difficulty, then compute inter-rater agreement metrics (e.g., Cohen’s kappa). Keep only labels that meet the consistency threshold.
- Verifiable answers: Prioritize problems with clear standard answers. For open-ended questions, provide detailed scoring rubrics and expert review procedures.
Answer Verification Methods
Answer verification determines the credibility of evaluation results. Common methods and their applicable scenarios are as follows.
- Exact matching: Suitable for integer or simple numeric answers. Before use, normalize formats—reduce fractions, simplify radicals, and standardize decimal places.
- Symbolic equivalence checking: Use computer algebra systems to determine whether two expressions are identically equivalent. This works for algebraic expressions and functional forms.
- Formal verification: Translate proof steps into a formal language and verify with a proof checker. This is costly and best reserved for validating critical conclusions.
- Human review: Two or more reviewers independently score according to a detailed rubric. Compute inter-rater reliability and bring in a third party to adjudicate significant disagreements.
Below is an illustrative evaluation pipeline. The verification function should be replaced with the appropriate implementation for each problem type.
def normalize_answer(text: str) -> str:"""Remove whitespace and common formatting symbols, returning a comparable string."""return text.strip().replace(" ", "").lower()def is_equivalent(pred: str, gold: str) -> bool:"""Check whether the predicted answer is equivalent to the standard answer.For numeric problems, use exact comparison; for expressions, call symbolic computation."""if normalize_answer(pred) == normalize_answer(gold):return True# A symbolic equivalence check can be plugged in here, e.g., simplifying the difference to zero.return Falsedef extract_final_answer(output: str) -> str:"""Extract the final answer from the model output, assuming a unified answer marker."""marker = "Final answer:"if marker in output:return output.split(marker)[-1].strip()return output.strip()def evaluate(model_fn, problems, k=4):"""Sample each problem k times, compute correctness rates, and enable stratified reporting by difficulty."""records = []for p in problems:hits = []for _ in range(k):output = model_fn(p["question"])hits.append(is_equivalent(extract_final_answer(output), p["answer"]))records.append({"id": p["id"],"level": p["level"],"correct_rate": sum(hits) / k,})return records
In this pipeline, fixing decoding parameters, using a unified answer marker format, and sampling each problem multiple times are essential for ensuring comparability across runs.
Analyzing the Reasoning Process
A correct final answer does not guarantee reliable reasoning. Process analysis can be structured as follows.
- Identify critical steps: Locate steps that determine whether the conclusion holds, such as introducing auxiliary variables, applying a theorem, or handling boundary cases in case-based reasoning.
- Check preconditions: Verify that the conditions for each theorem invocation are satisfied and that there is no circular reasoning.
- Annotate error types: Classify errors into categories such as calculation mistakes, logical jumps, misuse of preconditions, or invalid backward reasoning, then count the frequency of each type.
- Compare multiple paths for the same problem: Different samples of the same problem often fail at the same step, which helps identify the model’s weak points.
The relationship between chain-of-thought length and correctness should be supported by concrete data. If longer reasoning does not yield higher accuracy, the report should state this explicitly rather than treating length as a proxy for capability.
Reporting and Interpreting Results
An evaluation report should allow readers to reproduce and understand the conclusions. Recommended contents include:
- Sample information: Number of problems, difficulty distribution, source ratios, sampling count, and decoding parameters.
- Confidence intervals: Estimate intervals for accuracy using bootstrap methods, avoiding the interpretation of small percentage differences as significant.
- Stratified results: Present results by difficulty level separately; avoid reporting only a single aggregate score or ranking.
- Error examples: Include typical incorrect reasoning fragments with error type annotations, to help developers locate problems.
- Limitations: Acknowledge that the sample size is limited, human judgment involves subjectivity, and results represent performance at a specific point in time.
Practical Recommendations
- Clarify the evaluation task and success criteria—for example, whether the focus is computational accuracy, proof rigor, or both.
- Build a stratified test set with a data decontamination process and agreement checks for difficulty labels.
- Fix decoding parameters, sample each problem multiple times, and record all inputs and outputs.
- Combine automatic verification with human review, paying special attention to borderline cases identified by automatic checks.
- Produce reproducible reports that include data version, code version, verification rules, and statistical methods.
Following this workflow ensures that evaluation conclusions can withstand scrutiny and provide clear direction for model improvement.
