Evaluating Mathematical Reasoning in Large Language Models: A Framework and Practical Methods

    This article describes a framework for evaluating the mathematical reasoning of large language models. It explains why impression-based testing gives unreliable results and breaks evaluation into six dimensions: difficulty levels, answer correctness, rigor of derivations, reasoning length and efficiency, expression standards, and consistency across repeated samples. It then outlines a six-step reproducible workflow, a sample evaluation script, common misreadings of results, and engineering practices for running evaluations continuously.

    1. Why Mathematical Reasoning Needs a Systematic Evaluation

    Mathematical reasoning is a common way to test the logical ability of general-purpose language models. Math problems have clear standards for right and wrong, and each step of a derivation can be checked, which makes them a good starting point for measuring capability. Many teams, however, judge models by trying a few questions and deciding the results “look good.” This kind of impression-based judgment depends on the choice of questions, the way they are asked, and personal preference. Its conclusions are hard to reproduce and offer little guidance for model selection or iteration.

    For this reason, evaluation should be split into several observable dimensions. Each dimension needs a clear way to record results, and the same process should be repeatable.

    2. Breaking Down the Evaluation Dimensions

    1. Difficulty Levels

    A question bank should cover at least three levels: basic calculation and definition questions, intermediate questions that require multi-step derivations, and competition or research-level open-ended problems. Each level reflects a different ability. Basic questions mainly test computational accuracy. Intermediate questions test whether the reasoning chain is complete. Open-ended questions test whether a model can propose useful approaches and identify its own mistakes. A bank that uses only one level rarely produces conclusions that separate models well.

    2. Answer Correctness

    The final answer is the most direct metric. For questions with a unique solution, the answer can be compared directly with the reference. For proof questions, human judgment or formal verification tools are needed to confirm that the argument holds. A correct answer does not mean the reasoning is correct, so the two should be counted separately.

    3. Rigor of the Derivation

    During evaluation, check step by step whether each intermediate conclusion follows from its premises, and look for skipped steps, circular arguments, or concepts that shift in meaning. For each question, mark the key steps and verify whether each one appears and is correct. The key-step coverage rate is more granular than the overall accuracy rate. It shows where a model goes wrong.

    4. Reasoning Chain Length and Efficiency

    Two answers can reach the same result in very different ways. One may be short and direct, while the other tries repeatedly and runs long. Reasoning length affects response latency and usage cost, and it also affects how hard the answer is for readers to follow. During evaluation, record output length, time taken, and any obvious redundant backtracking. Length alone does not indicate ability, so it should be analyzed together with accuracy.

    5. Expression Standards

    Standard mathematical expression includes consistent notation, defining terms before using them, and clearly matching conclusions to their conditions. This dimension matters most for teaching and documentation scenarios.

    6. Stability and Consistency

    Whether a model gives the same result when the same question is sampled several times is an important measure of reliability. If only one of three samples is correct, the model has not mastered that question. Sample each question at least three times and calculate the pass rate, rather than relying on a single result.

    3. Building a Reproducible Evaluation Process

    The full process has six steps.

    1. Prepare the question bank. Draw questions from varied sources, and record each question’s origin, difficulty label, and reference answer.
    2. Control data contamination. If questions have been widely published, a model may have seen them during training, which inflates its results. Prioritize newly written or unpublished questions, and replace them regularly.
    3. Standardize prompts and parameters. Use the same system instructions, input format, and output constraints for all candidate models so that differences in prompting do not make the comparison unfair.
    4. Sample multiple times and save raw outputs. Run each question the planned number of times, and keep the raw outputs for later review.
    5. Combine automatic grading with human review. Use automatic grading for answers that can be compared mechanically. Have people with relevant background review a sample of proof-based outputs, and calculate their agreement rate.
    6. Aggregate and archive. Group results by difficulty level, evaluation dimension, and model version. Keep logs so that results can be compared across releases.

    Below is a sketch of an evaluation framework. The interface names are examples only. Replace them with your team’s own client and grading logic when you use it.

    1. from dataclasses import dataclass, asdict
    2. @dataclass
    3. class EvalItem:
    4. item_id: str
    5. level: str # basic / intermediate / open
    6. question: str
    7. reference: str # Reference answer or grading key points
    8. def judge_answer(response: str, reference: str) -> bool:
    9. # Illustrative only: suitable for simple questions with a fixed answer format.
    10. # For proof-based questions, replace this with normalized comparison or a dedicated grading module.
    11. return reference.strip() in response
    12. def run_eval(client, items, samples=3):
    13. records = []
    14. for item in items:
    15. for k in range(samples):
    16. output = client.generate(item.question) # Illustrative interface
    17. records.append({
    18. **asdict(item),
    19. "sample_index": k,
    20. "output_length": len(output),
    21. "correct": judge_answer(output, item.reference),
    22. })
    23. return records
    24. def pass_rate_by_level(records):
    25. stats = {}
    26. for r in records:
    27. s = stats.setdefault(r["level"], [0, 0])
    28. s[0] += int(r["correct"])
    29. s[1] += 1
    30. return {level: correct / total for level, (correct, total) in stats.items()}

    The key point of this code is its structure. Each question is sampled several times, the output length and grading result are recorded, and the pass rates are then aggregated by level. The substring check in judge_answer only fits closed-form simple answers. Proof-based questions require a more reliable grading method.

    4. Common Misreadings of Results

    Sample size is too small. A few questions are not enough to support a ranking. As the number of questions grows, fluctuations in the pass rate shrink. Results should generally rely on dozens to hundreds of questions, and reports should include confidence intervals.

    Confusing ability with prompting skill. A model that performs well under a carefully designed prompt may not be equally stable in everyday use. Evaluation reports should also include results under default prompts.

    Treating a single experience as a conclusion. Personal impressions come from small samples and are easily shaped by writing style. Fluent, neatly formatted answers are often mistaken for stronger reasoning. Judgments should rest on the results of process checks.

    Ignoring differences between tasks. Open-ended and closed-ended questions require different abilities. They should be reported separately rather than merged into a single overall score.

    Looking only at correctness and not usability. For teaching aids or documentation, whether an answer is easy for readers to follow and whether its steps can be traced also affect its practical value.

    5. Engineering Recommendations

    Include the evaluation process in continuous integration. After each model version update or prompt change, run the fixed question bank automatically, compare the results with historical data, and trigger an alert when a clear regression appears. The question bank, raw outputs, and grading results can be stored in object storage. Run logs can be managed centrally through a log service, and key metrics can be monitored with alert thresholds. These are general infrastructure components, so the choice should depend on your team’s existing stack.

    For permissions, if the question bank contains unpublished internal questions, limit access to it. Do not write reference answers to logs or send them to uncontrolled external services.

    The final purpose of evaluation is to inform specific business decisions. Teams should first define the use case, such as assisting with derivations, generating questions in bulk, or checking calculations. Then they can choose the evaluation dimensions and their weights to match. A comprehensive ranking that ignores the use case has limited value.