Systematic Methods and Practices for Evaluating LLM Mathematical Reasoning Capabilities

    Evaluating mathematical reasoning is a critical way to assess the logical stability of large language models. This article outlines a systematic approach to LLM math evaluation, covering goal definition, dataset stratification, data contamination control, answer verification methods, reasoning process checks, multi-sampling for stability, and a minimal evaluation code framework. It also highlights best practices for reporting results and common pitfalls to avoid.

    Why Evaluate Mathematical Reasoning Separately

    Math problems are a special type of task for testing a language model’s reasoning capabilities. The answers can usually be judged precisely, the reasoning chains are long, and no step can afford to be wrong. Therefore, math performance is often used to observe a model’s logical stability. However, a single score is hardly conclusive. The source of problems, scoring rules, and sampling parameters all affect the conclusion; the same score under different conditions may represent entirely different capability levels.

    1. Clarify Evaluation Goals First

    Before starting the evaluation, three questions need to be answered. First, are you evaluating the accuracy of the final answer or the rigor of the reasoning process? Second, is the target competition problems, textbook problems, or research-level unsolved problems? Third, will the results be used for model selection, version regression testing, or capability research? Different goals dictate different dataset structures and metric designs.

    2. Dataset Stratification and Data Contamination Control

    It is recommended to stratify the problem set by difficulty, with common categories including:

    1. Basic calculations and algebraic transformations;
    2. Middle school competition problems;
    3. Undergraduate course problems;
    4. Research-level problems, including open problems.

    Problems with known answers can be graded automatically. Open problems usually require expert review, and the conclusions should be reported separately, not directly merged with auto-graded results.

    Data contamination is another issue that must be addressed. Publicly available problems and reference answers may have appeared in the model’s training data, leading to inflated scores. There are three common countermeasures: use recently released problems; make equivalent rewrites of problems (changing variable names, swapping condition orders, changing numerical values) and compare with original scores; retain a portion of private problems in the dataset that are not publicly disclosed. If there is a significant score gap between the original and rewritten problems, it suggests the model may have memorized the problem itself rather than mastered the solving method.

    3. Answer Verification Methods

    Different problem types require different verification methods:

    • Exact matching: Suitable for integers and expressions in fixed formats. This method is format-sensitive and requires standardizing writing conventions before judging.
    • Numerical comparison: Suitable for floating-point results. A tolerance range must be set in advance, and the tolerance size should be specified.
    • Symbolic equivalence: Uses symbolic computation tools to determine if two expressions are equal, preventing misjudgments caused by different notations.
    • Formal verification: Converts proofs into formal languages for machine checking. This is costlier but provides the most reliable conclusions.
    • Expert review: Suitable for proof problems and open problems. Multiple reviewers should score independently, and the inter-rater reliability coefficient should be calculated. Items with low agreement require a re-discussion of standards.

    4. Reasoning Process Verification

    A correct final answer does not mean the reasoning process is reliable. Incorrect derivations might coincidentally yield the right result. Therefore, the reasoning process needs separate verification:

    1. Check whether each key assertion is justified and whether it cites the correct theorem or condition;
    2. Check if there are skipped steps and whether the omitted steps can be filled in;
    3. Check whether the intermediate results are consistent and free of contradictions.

    The length of the reasoning process can be an observation item, but length itself is not a quality metric. A short and correct derivation is usually more valuable than a lengthy, convoluted one. Expression style, such as clear structure and concise language, belongs to the readability dimension and should be scored separately from correctness to avoid inferring mathematical ability from writing style.

    5. Stability and Multiple Sampling

    The model’s output for the same problem may vary each time. A single pass does not prove the model has stably mastered the problem. It is recommended to sample multiple times per problem (e.g., 4 to 8 times), calculate the pass rate, and report the pass rate interval. If a problem is only solved correctly in one sample, it should be flagged as an unstable result and not included in the capability conclusion.

    6. Example Code: Minimal Evaluation Framework

    The following code demonstrates the basic structure of the evaluation process. Note that extract_final_answer needs to be implemented based on the actual output format.

    1. from dataclasses import dataclass
    2. @dataclass
    3. class Problem:
    4. pid: str
    5. statement: str
    6. answer: str
    7. level: str # e.g., "competition", "undergrad", "open"
    8. def check_exact(pred: str, gold: str) -> bool:
    9. return pred.strip() == gold.strip()
    10. def evaluate(model_call, problems, samples=4):
    11. report = {}
    12. for p in problems:
    13. hits = 0
    14. for _ in range(samples):
    15. output = model_call(p.statement)
    16. final = extract_final_answer(output) # Implement according to output format
    17. if check_exact(final, p.answer):
    18. hits += 1
    19. report[p.pid] = hits / samples
    20. return report

    In practical use, the following improvements should be added: replace exact matching with tolerance comparison for numerical problems, replace with symbolic equivalence for expression problems, and record the raw output of each sample for post-hoc review.

    7. Result Reporting and Interpretation

    A complete evaluation report should include the following:

    • Pass rates for each difficulty level;
    • Variance or pass rate intervals for multiple samples per problem;
    • The proportion of manually reviewed samples and reviewer agreement;
    • Dataset version number and scoring rule descriptions.

    When interpreting results, pay attention to sample size. If a difficulty level only has a dozen problems, conclusions drawn from a few problems’ differences may not be reliable. For open problems, conclusions should be described as “results of this review” and should not be extrapolated into a general capability ranking of the model.

    8. Common Pitfalls

    1. Treating a single run’s score as a stable capability.
    2. Repeatedly evaluating with the same set of public problems, ignoring the memorization effect.
    3. Only looking at the final answer without checking errors accidentally masked in the reasoning process.
    4. Taking response length, writing style, or confidence level as evidence of mathematical ability.

    Conclusion

    The key to evaluating mathematical reasoning capabilities lies in reproducibility and interpretability. Clarify goals before evaluation, ensure the dataset is properly stratified and protected against contamination, match verification methods to problem types, verify the reasoning process separately from the final answer, and support conclusions with multiple sampling and comprehensive reporting. Following this process ensures that evaluation results can be repeatedly verified across different times and conditions, truly guiding model selection and improvement.