How to Evaluate the Mathematical Reasoning of Large Language Models: Methods and Practices

    This article presents a practical framework for evaluating the mathematical reasoning of large language models. It explains why informal "which model is best" comparisons are unreliable, breaks mathematical ability into measurable subcategories, and covers benchmark construction, difficulty distribution, and contamination prevention. It also details how to quantify chain-of-thought complexity, apply multi-layer scoring with consistency checks, control prompting and decoding variables, and build an automated evaluation pipeline. Readers will find concrete metrics, data structures, pseudocode, and governance recommendations for reproducible model selection.

    1. The Problem: Why “Which Model Is Stronger” Is the Wrong Question

    The most common debate about model capability is a horizontal ranking of different models. A claim that one model is the only one capable of solving open-ended math problems while all others fall short has clear flaws from an engineering perspective: it treats subjective impressions as conclusions, extrapolates performance in a single scenario to overall capability, and provides no reproducible evaluation conditions.

    A more rigorous reframing is to ask: given a fixed problem distribution, a fixed prompting strategy, fixed scoring rules, and a fixed compute budget, what are the expected score and variance of each candidate model? Once stated this way, the discussion shifts from taking sides to an engineering problem that is measurable, comparable, and regression-testable.

    This article does not rank any specific model. Instead, it defines an evaluation framework, and any model—including model services available on Baidu AI Cloud—should be tested under the same framework.

    2. Capability Breakdown: Splitting “Math Ability” into Measurable Subitems

    A vague notion of “math ability” cannot be evaluated and must be decomposed. A widely accepted breakdown is:

    1. Arithmetic and numerical precision: multi-digit operations, unit conversion, scientific notation; checks for drift in intermediate steps.
    2. Symbolic and algebraic manipulation: solving equations, factoring, bounding inequalities; checks whether transformations preserve equivalence.
    3. Geometry and spatial reasoning: figure relationships, coordinate methods, auxiliary line construction; checks whether a correct model can be built without a diagram.
    4. Combinatorics and probability: counting principles, recurrences, expected value; checks for double counting or omissions.
    5. Open-ended problems: problems with insufficient conditions that require self-modeling or explicit assumptions; checks how explicitly assumptions are stated.
    6. Proofs and rigor: whether a verifiable reasoning chain is provided and whether circular reasoning occurs.

    Only after this breakdown does an evaluation report have diagnostic value. For example, a model with a perfect arithmetic score but a low open-ended score has a modeling weakness rather than a computational one, which points to a completely different optimization direction.

    3. Benchmark Construction: Difficulty, Distribution, and Contamination Control

    Benchmark quality determines how trustworthy the conclusions are. Three points matter.

    First, the difficulty gradient. A common split is basic, intermediate, and challenge tiers, for example 5:3:2. Avoid an all-easy set that causes a ceiling effect and an all-hard set that causes a floor effect; in both cases, differences between models are compressed.

    Second, align the distribution with real business needs. If the target is a math education application, increase the share of basic and intermediate items; if the target is research assistance, increase the share of open-ended and proof items.

    Third, prevent data contamination. Public problem banks easily end up in training corpora and inflate scores. Practical measures include: constructing isomorphic variants (changing numbers and wording while preserving the solution path), using private problems, introducing a time split (using only recent problems), and applying equivalent paraphrases to check answer consistency.

    A schematic problem structure can be abstracted as:

    1. {
    2. "id": "math-0421",
    3. "tier": "challenge",
    4. "category": "combinatorics",
    5. "prompt": "Problem statement (with explicit conditions)",
    6. "reference_answer": "Reference answer or checking script",
    7. "checker": "numeric | symbolic | proof",
    8. "is_open_ended": false
    9. }

    The checker field determines the scoring method and is the foundation for the automated pipeline described later.

    4. Quantifying Chain-of-Thought Complexity: Metrics More Fundamental Than Length

    Differences in chain-of-thought length and conciseness across models can be formalized. Counting tokens alone is insufficient; use multiple metrics:

    • Length: total tokens in the chain of thought, reflecting redundancy.
    • Depth: number of dependency layers among reasoning steps, computed as the longest path after building a directed graph from step references.
    • Branching: number of backtracks, overturned assumptions, and parallel attempts.
    • Efficiency: share of steps that ultimately lead to the correct conclusion, measuring how much detour occurs.
    • Self-check rate: frequency of explicit verification, boundary checks, and dimensional analysis.

    A practical rule of thumb: at equal accuracy, a shorter chain with higher efficiency usually indicates stronger abstraction ability and, in engineering terms, lower latency and cost. Conversely, an extremely long, highly branched chain may occasionally succeed on hard problems, but it has high variance and is hard to deliver reliably.

    5. Scoring and Consistency: Making Conclusions Reproducible

    Scoring is the most overlooked step and the one that most affects conclusions. Use three layers of validation:

    1. Automatic grading of objective items: numeric answers with tolerance comparison and symbolic answers with equivalence-class checking, avoiding false judgments from exact string matching.
    2. Rubric scoring for proofs: split a proof into necessary components (condition transformation, key lemma, derivation closure, conclusion back-substitution) and score each item to reduce overall impression bias.
    3. Multi-reviewer consistency checks: score with multiple reviewers or repeated sampling and compute a consistency coefficient; low consistency means the rubric is ambiguous and should be rewritten rather than trusted.

    Variance must also be reported. Score differences from a single run often fall within noise. Fix random seeds, sample repeatedly, report the mean and confidence interval, and test for significance instead of drawing conclusions from one run.

    6. Controlling Prompting and Decoding Strategies

    Cross-model comparison must control the prompting strategy; otherwise, you are measuring prompt engineering rather than the model. Fix the following: system prompt template, whether examples are provided, number of examples, temperature and sampling parameters, maximum output length, and whether self-checking is allowed. To study the effect of strategy, use an orthogonal experimental design and report two tables: cross-model comparison under the same strategy and cross-strategy comparison for the same model.

    For open-ended problems, explicitly require the model to output a list of assumptions and applicable conditions. This improves usability and gives scoring a clear basis.

    7. Engineering Implementation: An Automated Evaluation Pipeline

    Long-running evaluation must be pipelined. A recommended structure:

    1. Data layer: problems and reference answers stored in object storage with versioning; each evaluation run pins a dataset version number.
    2. Scheduling layer: a container platform runs evaluation tasks, sharded in parallel by model and problem, with task status written to a message queue for decoupling.
    3. Inference layer: unified access to different model services through a consistent calling interface, recording latency, token usage, and failed retries.
    4. Grading layer: combine rule-based and model-based grading, and archive grading results together with raw outputs for traceability.
    5. Observability layer: a logging service collects end-to-end logs, with monitoring and alerting thresholds for failure rate, timeout rate, and score drift.
    6. Reporting layer: automatically generate per-category radar charts, variance tables, and regression comparisons, with version diff support.

    Schematic pseudocode:

    1. def run_eval(dataset_version, model_id, strategy):
    2. items = load_dataset(dataset_version)
    3. results = []
    4. for it in items:
    5. out = call_model(model_id, render(it, strategy))
    6. score = grade(out, it) # rules + rubric
    7. results.append(record(it.id, out, score, usage(out)))
    8. return aggregate(results) # mean, variance, per-category scores

    8. Common Pitfalls and Governance Recommendations

    • Overgeneralization: inferring overall ability from a few hard problems; use stratified weighting instead.
    • Ignoring variance: treating noise as a difference; sample repeatedly and test for significance.
    • Inconsistent prompts: using different prompts for different models invalidates conclusions.
    • Data contamination: public problems entering the training set inflate scores; use private and variant problems.
    • Single metric: looking only at accuracy while ignoring latency, cost, and stability; build a multi-objective dashboard.
    • Non-traceable conclusions: missing archives of raw outputs make review impossible; log everything.

    9. Conclusion

    Evaluating the mathematical ability of large language models is not about finding a label for the “strongest model,” but about building a layered, controlled, reproducible, and traceable evaluation system. Once problems are stratified, chain-of-thought complexity is quantified, scoring consistency is validated, and the pipeline is automated, the capability boundaries of any model become clear in the form of data, providing a reliable basis for selection and optimization. General cloud product capabilities from Baidu AI Cloud can serve as the foundation for such an evaluation platform, turning evaluation from a one-off experiment into a continuously running quality engineering practice.