Evaluating LLM Mathematical Reasoning: Methodologies and Best Practices

    Evaluating large language models (LLMs) on mathematical proofs is a rigorous way to assess their logical reasoning capabilities. This article outlines a comprehensive methodology for evaluating LLM math proof capabilities, covering dataset construction, multi-dimensional scoring, perturbation testing to separate reasoning from memorization, and maintaining consistency in human review. It also provides practical code examples, cost estimation strategies, and common pitfalls to avoid during evaluation.

    1. Why Use Mathematical Proofs to Test Reasoning

    Mathematical proofs require every step to be supported by established premises. A single skipped step or incorrect reference in the derivation chain renders the conclusion invalid. Compared to open-ended question answering, proof tasks directly expose the model’s structural logical capabilities, making them a high-difficulty scenario frequently used for reasoning evaluation.

    Before evaluating, two things must be clarified: whether the task is to “reproduce a known proof” or to “solve an unknown problem,” and whether the results can be independently verified. The evaluation methods for these two types of tasks differ significantly; mixing them for comparison will lead to misleading conclusions.

    2. Building a Reliable Evaluation Set

    2.1 Proposition Sources

    Prioritize propositions from public textbooks, lecture notes, and specialized literature. These propositions have clear conditions, conclusions, and verifiable sources. However, be aware that popular propositions may already exist in the training data, meaning the model’s answers could stem from memorization rather than actual reasoning.

    2.2 Difficulty Stratification

    Categorize propositions into three difficulty tiers:

    • Basic: Direct application of a single theorem;
    • Intermediate: Requires combining two to three known conclusions;
    • Advanced: Requires introducing auxiliary constructions or utilizing tools across multiple mathematical branches.

    Maintain a similar volume of questions in each tier to accurately compare performance differences across varying difficulties.

    2.3 Decontamination

    Process candidate propositions as follows:

    1. Remove questions that are highly duplicated with public answers;
    2. Rewrite the phrasing of conditions while keeping the mathematical content intact;
    3. Record the source and publication time of the questions for future traceability.

    3. Designing Scoring Dimensions

    Simply checking whether the conclusion is correct provides insufficient information. It is recommended to score across at least five dimensions:

    1. Conclusion Correctness: Whether the final proposition holds true;
    2. Premise Validity: Whether the conditions of each referenced theorem are satisfied in the current context;
    3. Logical Completeness: Whether there are skipped steps, and if so, whether they can be reasonably filled in;
    4. Notation Consistency: Whether the notation for the same object remains unified throughout the text;
    5. Presentation: Whether the structure of definitions, lemmas, and proofs is clear.

    Each dimension should use an integer scale from 0 to 2 to facilitate aggregation and horizontal comparison.

    4. Distinguishing Memorization from Reasoning

    To determine whether a model is genuinely reasoning, perturbation testing can be used. Specific methods include:

    • Modifying a single condition of the proposition to observe if the proof changes accordingly;
    • Providing an incorrect intermediate conclusion to see if the model can identify the flaw;
    • Replacing object names in the problem while keeping the structure intact to observe if the solution remains stable.

    If a model produces a fluent proof for the original question but loses coherence on a structurally identical but differently worded problem, it indicates a heavy reliance on memorization.

    5. Consistency in Human Review

    Automated scoring struggles to cover the nuances of mathematical proofs, making human review the primary method. In practice, pay attention to the following points:

    • Use double-blind review, where reviewers do not know which system generated the answer;
    • Have two reviewers independently score each question and calculate inter-rater reliability, such as Cohen’s kappa coefficient;
    • Refer questions with significant discrepancies to a third reviewer for arbitration and record the reasons for the dispute.

    When consistency is low, it usually indicates that the scoring rubrics are not specific enough. You should refine the standards first before considering averaging the scores.

    6. Code Example: Evaluation Pipeline Skeleton

    The following example demonstrates how to structure an evaluation task. Model calls and detailed scoring rules should be supplemented based on your actual environment.

    1. from dataclasses import dataclass, field
    2. @dataclass
    3. class ProofTask:
    4. task_id: str
    5. statement: str
    6. level: str # "basic" | "intermediate" | "advanced"
    7. reference_source: str
    8. @dataclass
    9. class ProofResult:
    10. task_id: str
    11. proof_text: str
    12. scores: dict = field(default_factory=dict)
    13. DIMENSIONS = [
    14. "conclusion",
    15. "premise_validity",
    16. "logical_completeness",
    17. "notation_consistency",
    18. "presentation",
    19. ]
    20. def score_proof(reviewer_scores: list[dict]) -> float:
    21. """Aggregate scores from multiple reviewers and return a normalized score between 0 and 1."""
    22. if not reviewer_scores:
    23. raise ValueError("At least one reviewer's score is required")
    24. total = 0.0
    25. for dim in DIMENSIONS:
    26. values = [r[dim] for r in reviewer_scores]
    27. total += sum(values) / len(values)
    28. max_total = 2 * len(DIMENSIONS)
    29. return total / max_total

    The score for each question is aggregated from the average of multiple reviewers and then normalized to a scale of 0 to 1. Fixing the scoring logic in code ensures that results remain comparable across different evaluation rounds.

    7. Cost and Efficiency Metrics

    Beyond capability, practical usage requires calculating costs. The cost per question can be estimated using the following formula:

    Cost per question ≈ Input token count × Input price + Output token count × Output price

    Long derivations typically consume more output tokens, meaning models with longer reasoning processes will often incur higher costs on the same batch of questions. In addition to cost, you should also record time-to-first-token and generation speed, as these two metrics directly determine the cycle time of batch evaluations.

    For on-premises deployment, inference throughput is affected by hardware configuration, batching strategies, and quantization methods. When comparing the speed of different models, hardware and inference parameters must be fixed, otherwise the data will not be comparable.

    8. Common Pitfalls

    • Equating “well-formatted” with “correct proof.” Fluent paragraphs can mask the absence of critical steps.
    • Relying on single-shot results. The results of multiple samples from the same model can vary greatly; you should take multiple samples for statistical analysis.
    • Ignoring question difficulty distribution. If the test set is dominated by simple questions, conclusions will be overly optimistic.
    • Using overall impressions instead of dimensional scoring. Conclusions drawn this way are difficult to reproduce and provide little guidance for model improvement.

    9. Practical Recommendations

    1. Define the task type first, then select problems, and finally design the scoring rubrics;
    2. For each evaluation, retain the questions, raw outputs, scoring records, and environment parameters;
    3. Annotate confidence intervals for each conclusion and specify the sample size.