Designing an Evaluation System for LLM Mathematical Reasoning
A high score on math problems does not mean a model can actually reason. This article presents a practical framework for evaluating mathematical reasoning in large language models. It defines a four-layer capability model, covers benchmark design with difficulty calibration and parameter perturbation for contamination resistance, lays out multi-dimensional metrics such as pass@1, pass@k, self-consistency, process validity, and reasoning cost, describes a layered grading pipeline that tolerates undecidable answers and reports confidence intervals, and closes with common pitfalls and how to turn evaluation results into production decisions like tiered routing and continuous regression.
1. Why “Solving Problems” Is Not the Same as “Reasoning”
A recurring mistake during model selection is treating surface accuracy on math problems as a direct measure of reasoning ability. This equation often holds for short answers and templated problems. But once a question requires the model to choose its own strategy, construct intermediate objects, or handle degenerate cases, the two clearly diverge.
There are three reasons. First, training corpora contain large volumes of worked solutions and problem banks, so a model may be memorizing the “shape of a solution” rather than the solution method itself. Second, most public benchmarks grade only on the final value; a correct answer can mask skipped steps, backward-fitted numbers, or circular reasoning along the way. Third, difficulty is distributed very unevenly across problem types. When easy problems dominate, differences among top models are compressed down to the noise level.
So the first step of evaluation is not finding problems but defining what capability you are actually measuring, then aligning problem types, metrics, and grading methods to it. Any evaluation that skips this step produces rankings that can only serve as reference signals, not as a basis for decisions.
2. A Four-Layer Model of Mathematical Reasoning
Breaking “math ability” into observable layers is the foundation of evaluation design. The four layers are related but not interchangeable, and mixing them together hides real weaknesses.
Layer 1: Reliability of numeric and algebraic execution. This covers arithmetic, carrying and borrowing, unit conversion, percentages, and approximation and precision control. The typical failure modes here are subtle: occasional carry errors in multi-digit arithmetic, computing “a drop of 30%” as inverting 0.7 after multiplying, or silently losing precision in intermediate steps with large numbers. This layer determines the lower bound, meaning how trustworthy the model is on simple steps.
Layer 2: Rule-based multi-step derivation. This includes solving equations and inequalities, sequences, routine integration and differentiation, and standard linear algebra procedures. Such problems have a defined algorithmic path and test the correctness and internal consistency of the step sequence rather than creativity. Evaluations should force intermediate steps to be shown; otherwise you cannot distinguish “computed correctly” from “guessed correctly.”
Layer 3: Open-ended mathematical problems. These require the model to choose a strategy, introduce auxiliary constructions, search for counterexamples, and reason by cases. The answer space is not closed, so pattern matching cannot converge, and this is the main battleground that separates top models. It tests two things at once: whether the model can propose a viable attack path, and whether it can backtrack effectively when that path fails.
Layer 4: Formalization and rigor of expression. This includes completeness of conditions (whether boundary and degenerate cases are missed), quantifier direction (the order of ∀/∃), verifiability of the conclusion, and consistency with the premises. This layer directly determines whether the output can be peer-reviewed, and in real engineering it often matters more than solving one extra problem correctly.
One practical conclusion: an evaluation covering only Layers 1 and 2 has almost no predictive power for Layer 3 and Layer 4 scenarios.
3. Benchmark Design: Distribution, Contamination Resistance, and Gradability
Layering and difficulty calibration. Build a subset for each of the four layers, and split each subset into easy, medium, and hard tiers. Difficulty should not rely on subjective labeling but should be derived from multi-model sampling pass rates: a pass rate above 0.8 across several representative models marks an item as easy, 0.3 to 0.8 as medium, and below 0.3 as hard. This calibration is reproducible and makes it easy to align across later versions.
Parameter perturbation and isomorphic variants. The most effective and lowest-cost anti-contamination technique is parameter randomization: keep the problem structure and solution path fixed, randomly replace values, variable names, and the order of condition statements, and generate dozens of isomorphic variants at once. If a model is only memorizing the shape of a solution, its pass rate on variants will be significantly lower than on the original; genuine generalization shows up as the two being close. A sketch of the implementation:
import randomTEMPLATES = [# (question template, closed-form answer from the generated parameters) -- fixed solution path, random values("An item originally costs {p} dollars, rises by {r1}%, then drops by {r2}%. What is the final price?",lambda p, r1, r2: p * (1 + r1 / 100) * (1 - r2 / 100)),("An arithmetic sequence has first term {a1} and common difference {d}. Find the {n}th term.",lambda a1, d, n: a1 + (n - 1) * d),]def make_variant(rng: random.Random) -> dict:tmpl, solver = rng.choice(TEMPLATES)params = build_random_params(tmpl, rng) # constrain value ranges, avoid degenerate solutionsquestion = tmpl.format(**params)return {"question": question,"reference": solver(**params),"template_id": id(tmpl), # used for grouping variant-consistency statistics"seed": rng.random(),}
The reporting should cover both the “original pass rate” and the “mean variant-group pass rate.” The difference between them is itself a useful metric: the larger the gap, the higher the suspicion of memorization.
Gradability first. When selecting problems, prioritize items with a unique final value or a conclusion that can be verified by machine (numbers, expressions, sets, intervals, counting results). For proof-type problems, do not expect automated grading to cover everything; design a rubric with deduction points that breaks scoring into independent items such as “conclusion correct,” “key lemma holds,” “boundary conditions handled,” and “no circular reasoning,” then calibrate with human spot-checks.
Isolating the held-out set. Use the public set for iterative tuning, and run the private held-out set only once before a release. Once the held-out set has been involved in prompt or pipeline adjustments, its ranking value immediately decays and it must be rebuilt.
4. Metric Design: From a Single Accuracy Score to a Multi-Dimensional Profile
A single accuracy score is the metric most easily misread. A usable evaluation profile needs at least six dimensions.
- Pass@1: single-sample success by default. Temperature and maximum generation length must be globally uniform, or cross-model comparisons are not meaningful.
- Pass@k: reflects the upper bound of ability. A large gap between pass@1 and pass@k means the model “can do it but is unstable,” which makes it well suited for use with voting and verification pipelines.
- Self-consistency: the rate at which final values agree across multiple samples of the same problem. Cross-referencing it with correctness yields a four-quadrant profile: consistent and correct (trustworthy), consistent and wrong (dangerous, a systematic bias that needs focused investigation), inconsistent with high correctness (good for voting ensembles), and inconsistent with low correctness (insufficient ability).
- Process validity score: a weighted pass ratio against the rubric, with particular attention to skipped steps, circular reasoning, boundary omissions, and unit errors.
- Reasoning cost: chain-of-thought length and token consumption. The empirical pattern is that length and correctness first rise and then saturate; beyond the saturation point, length keeps growing while correctness no longer improves, so longer reasoning is just cost at that stage. Report the “minimum cost needed to reach the target accuracy” rather than accuracy alone.
- Robustness and uncertainty expression: the magnitude of accuracy fluctuation under problem perturbations, and whether the model states clearly when it does not know instead of fabricating a derivation. The latter has very high engineering value, because a wrong answer that can be refused is far easier to handle.
5. Engineering the Grading Pipeline
The grader is the foundation of the evaluation system, and it is also the most easily underestimated part. In practice, layer it by priority and avoid falling back to model-as-judge:
- Numeric equivalence (with relative/absolute tolerance);
- Normalized string equivalence (unify full-width and half-width characters, remove redundant spaces and common math symbol variants, normalize case, sort set elements);
- Symbolic and set equivalence (compare after simplifying expressions, compare interval endpoints);
- Rule-based reference-answer spot-checks plus human review, feeding disagreement samples back as new normalization rules.
import mathimport redef try_parse_number(s: str):s = s.replace(",", "").strip()try:return float(s)except ValueError:return Nonedef normalize(s: str) -> str:s = s.strip().lower()s = re.sub(r"\\(left|right|,|!|)", "", s)s = s.replace("−", "-").replace("*", "*").replace("+", "+")s = re.sub(r"\s+", "", s)return sdef grade(answer: str, reference: str, tol: float = 1e-6) -> dict:"""Layered grading: numeric -> normalized string -> manual review."""num_a, num_r = try_parse_number(answer), try_parse_number(reference)if num_a is not None and num_r is not None:ok = math.isclose(num_a, num_r, rel_tol=tol, abs_tol=tol)return {"correct": ok, "level": "numeric"}if normalize(answer) == normalize(reference):return {"correct": True, "level": "string"}return {"correct": None, "level": "needs_review"}
The key is that correct is allowed to be None. Conflating “cannot be determined” with “judged wrong” makes scores systematically low and hides defects in the grader.
Aggregation and significance. The evaluation script must output confidence intervals; otherwise a two-decimal ranking difference often falls within the noise.
import randomfrom math import combdef pass_at_k(n: int, c: int, k: int) -> float:"""Unbiased estimate: probability of at least k correct out of n samples."""if n - c < k:return 1.0return 1.0 - comb(n - c, k) / comb(n, k)def bootstrap_ci(labels: list[bool], iters: int = 10000,alpha: float = 0.05, seed: int = 0) -> tuple[float, float, float]:rng = random.Random(seed)n, stats = len(labels), []for _ in range(iters):sample = [labels[rng.randrange(n)] for _ in range(n)]stats.append(sum(sample) / n)stats.sort()lo = stats[int(alpha / 2 * iters)]hi = stats[int((1 - alpha / 2) * iters)]return sum(labels) / n, lo, hi
After grading, do one grader self-assessment: hand-label a sample of needs_review items and measure the agreement rate between automated grading and human judgment. When this agreement rate falls below a threshold, fix the grader first, then look at model scores.
6. Common Evaluation Pitfalls
- Data contamination: public problem banks almost certainly enter the pretraining corpus. Parameter perturbation alone is not enough; you also need a “clean set” of self-authored, structurally novel problems.
- Answer leakage and format cues: an uneven distribution of options, numeric coincidences in the prompt that relate to the answer, or obvious length differences among options all let the model take shortcuts.
- Grading fragility: misjudgments caused by equivalent forms (fractions versus decimals, different levels of simplification) depress all models at once and hide real differences.
- Inconsistent sampling configuration: if temperature, top-p, maximum output length, or the system prompt differs in any way, cross-model comparison loses meaning.
- Insufficient sample size: pass rates on hard problems often sit in the 0.1 to 0.3 range, where the fluctuation of a few dozen samples far exceeds the true gap between models. Hard-tier problems need at least several hundred samples before discrimination is meaningful.
- Leaderboard-chasing tuning: repeatedly tuning prompts against the held-out set yields tricks on the evaluation set rather than generalization ability. The held-out set must be used once only.
7. Putting It to Work: Selection, Composition, and Continuous Regression
The endpoint of evaluation is not a ranking but a decision. Practical approaches include:
- Tiered routing: route by problem complexity. Execution-type problems go to small models or a result cache, while open-ended hard problems go through a reasoning-enhanced pipeline, controlling cost without sacrificing the upper bound. Routing thresholds should be calibrated from evaluation data, not set by intuition.
- Cascading and verification: escalate low-confidence samples to a second solve; use self-consistency voting for final-value problems; call external computation or symbolic-solving capabilities to verify subproblems that can be checked externally. Voting is only worthwhile when self-consistency data supports it; otherwise it just doubles the cost.
- Auditable traces: fully record problem variants, random seeds, sampling parameters, reasoning traces, grading levels, and their basis. Evaluation conclusions must be traceable to the original samples, otherwise you cannot locate regression points after a model version update.
- Infrastructure: datasets and reasoning traces suit object storage; batch evaluation jobs can be launched in parallel on a container platform; pipeline status can be monitored continuously through logging and alerting; large-scale asynchronous inference can be smoothed with a message queue to absorb peaks. Taking a general-purpose cloud platform like Baidu AI Cloud as a reference, all of the above steps can be covered by standard product categories without relying on proprietary interfaces.
- Continuous regression: fix a small, stable regression set and rerun it on every change to the model or pipeline to form a baseline curve. Regressions introduced by a version update usually need to be caught earlier than improvements from new capabilities.
8. Practice Checklist
- Define the capability layers first, then select problems, not the other way around;
- Keep an independent subset and an independent pass rate for each capability layer;
- Use parameter perturbation to generate isomorphic variants, and report both original and variant pass rates;
- Implement grading in layers, allow “cannot be determined,” and run grader self-assessment regularly;
- Attach confidence intervals to all metrics and specify the minimum sample size;
- Record accuracy, self-consistency, process validity, and reasoning cost together;
- Use the private held-out set once only, strictly isolated from the tuning set;
- Turn evaluation conclusions into routing thresholds, voting strategies, and regression baselines, not a single ranking table.
Turning “this model feels stronger” into “stronger by how much, on this class of problems, under this metric set and this sample size, and within what error range” is the real value of evaluation work. The former is not reproducible; the latter can enter engineering decisions and can be re-checked after every version update.
