Evaluating LLM Mathematical Reasoning: Objective Methods and Practical Workflows
A reliable assessment of an LLM’s mathematical reasoning requires more than a few successful answers. This article explains how to define mathematical capabilities, build evaluation datasets, grade different answer types, run reproducible tests, and interpret results using pass@k and confidence intervals. It also outlines common evaluation pitfalls and practical considerations for model selection.
1. Why Personal Experience Is Not Enough
Large language models are often judged on the basis of a handful of interactions. This approach has four clear limitations:
- Too few samples. One or two problems cannot represent a model’s overall ability.
- Unclear difficulty and task coverage. Strong performance on simple calculations does not establish competence in complex proofs.
- Sensitivity to evaluation settings. Prompt wording, sampling temperature, and context length all affect outputs. Rephrasing a question may produce a different result.
- Potential training-data contamination. Publicly available problems may appear in training data, so a correct answer does not necessarily demonstrate reasoning.
Evaluating mathematical reasoning therefore requires moving from subjective impressions to repeatable, verifiable measurements.
2. Define What “Mathematical Ability” Means
Mathematical ability is not a single dimension. Before evaluating a model, separate it into specific capabilities:
- Basic computation: Arithmetic, algebraic simplification, and numerical precision.
- Symbolic derivation: Integration, differential equations, and formula transformations.
- Theorem proving: Complete arguments without missing logical steps.
- Competition mathematics: Problems requiring constructive insights and combinatorial techniques.
- Open research problems: Questions with unknown answers, where assessment must focus on the plausibility and verifiability of the reasoning.
These capabilities require different scoring methods. Combining them into one overall score can hide important strengths and weaknesses. For example, a model might achieve nearly perfect results on computation while frequently skipping essential steps in proofs. Its average score could look strong even though it is unsuitable for proof-based tasks.
3. Design the Evaluation Dataset
The quality of the dataset limits the credibility of the conclusions. Use the following principles when building it:
- Maintain traceable sources. Record each problem’s source, year, and original answer.
- Define difficulty levels. Classify problems by the number of solution steps, required knowledge areas, and availability of published solutions. Possible levels include introductory, intermediate, and difficult.
- Check for contamination. Look for evidence that problems appear in publicly available training material. String matching and semantic similarity searches can identify close matches, which should be removed or flagged separately.
- Reserve a blind test set. Keep development problems separate from those used for the final report to avoid tuning against the evaluation set.
- Version the dataset. Assign a new version whenever the problem bank changes, and include that version in every results report.
An evaluation item can use a structure such as:
{"id": "algebra-0231","domain": "algebra","level": "intermediate","question": "Problem statement","answer_type": "numeric | expression | proof","reference": "Reference answer or scoring criteria","source": "Source details","contamination_check": "passed"}
4. Establish Scoring Rules and Automation
Scoring is one of the most error-prone parts of evaluation. Choose the method according to the answer type:
- Numeric answers: Normalize units and formatting, then compare values using a defined tolerance.
- Expressions: Use a symbolic computation system to check equivalence. Direct string comparison can incorrectly reject equivalent expressions.
- Proofs: Automated scoring has limitations. Proofs generally require human assessment against a rubric, or independent scoring by multiple reviewers followed by agreement on the result.
A simplified grading workflow looks like this:
function grade(item, model_output):answer = extract_final_answer(model_output)if item.answer_type == "numeric":return abs(answer - item.reference) <= toleranceif item.answer_type == "expression":return is_equivalent(answer, item.reference)if item.answer_type == "proof":return score_by_rubric(model_output, item.reference)
The extract_final_answer function must handle different output formats. If the model presents a derivation before stating its conclusion, the extraction rules must be fixed and documented.
Count parsing failures separately. Do not automatically treat them as incorrect answers or silently exclude them.
5. Build a Reproducible Evaluation Workflow
Reproducibility is essential to trustworthy conclusions. Fix and record the following:
- The exact model version, invocation time, and service configuration.
- The prompt template, applied consistently without problem-specific adjustments.
- Sampling parameters, including temperature and maximum output length.
- The number of samples generated per problem, retaining every raw output.
- Execution logs and random seeds, where supported by the API.
Reasoning results can vary substantially across individual attempts. Generate multiple samples per problem and calculate the success rate or an unbiased estimate of pass@k.
If a problem has (n) sampled outputs, of which (c) are correct, the unbiased pass@k estimator is:
[
\widehat{\mathrm{pass@k}}
=
1-\frac{\binom{n-c}{k}}{\binom{n}{k}}
]
In other words, subtract from 1 the probability that all (k) outputs selected from the (n) samples are incorrect.
Object storage can hold datasets and raw outputs, while a logging service records each run’s parameters and execution time for later review.
6. Report Statistics and Interpret Results Carefully
Report confidence intervals alongside accuracy. With small datasets, random variation may exceed the difference between two models.
For observed accuracy (p) and sample size (n), the Wilson confidence interval has the following center and half-width. Setting (z=1.96) gives a 95% confidence level:
[
\text{Center}
=
\frac{p+\frac{z^2}{2n}}
{1+\frac{z^2}{n}}
]
[
\text{Half-width}
=
\frac{
z\sqrt{\frac{p(1-p)}{n}+\frac{z^2}{4n^2}}
}{
1+\frac{z^2}{n}
}
]
The interval is the center plus or minus the half-width.
When two models’ confidence intervals overlap substantially, avoid asserting that one is stronger based on the reported accuracy alone.
Also report results by difficulty level and mathematical capability. If two models have similar overall scores but one performs much worse on proofs, that distinction may be more useful for model selection than the aggregate score.
7. Common Evaluation Pitfalls
- Reporting only the best output. Reasoning evaluations should show average performance and variability.
- Equating a correct answer with correct reasoning. An answer may result from memorization or guessing. Inspect a sample of derivations.
- Tuning and reporting on the same problems. This inflates measured performance.
- Comparing models with different prompts or resource limits without disclosure. Comparisons should use equivalent conditions.
- Treating one success on an open problem as evidence of general capability. Report success rates and describe failures as well.
8. Practical Recommendations for Model Selection
Organizations can use the following workflow:
- Build an internal dataset from real tasks. Problems drawn from actual business use are more relevant than public leaderboard scores alone.
- Standardize the evaluation process. Rerun it after each model update and track changes across versions.
- Require human review for high-risk applications. Financial calculations and engineering design should not depend on a single model output.
- Evaluate cost and latency alongside capability. When models perform similarly, inference cost often determines the final choice.
For an evaluation service deployed on Baidu AI Cloud, object storage can manage datasets, a container platform can run evaluation jobs, and monitoring and alerting can track unusual failure rates. These are general infrastructure capabilities; consult the official documentation for specific configuration details.
