How to Evaluate the Mathematical Reasoning of Large Language Models: A Practical Guide

    This article explains why informal comparisons of LLM math ability are unreliable and proposes building a structured evaluation system instead. It breaks mathematical capability into four measurable layers, outlines principles for constructing evaluation sets with controlled difficulty, shows how to quantify chain-of-thought complexity, and defines criteria for verifiable output quality. It also covers a reproducible evaluation workflow, common pitfalls, and how to run evaluation as a repeatable pipeline with offline sets and online sampling.

    1. Background: Why “Which Model Is Better” Comparisons Are Often Unreliable

    In technical communities, discussions about the mathematical ability of large language models often degrade into leaderboard-style verbal conclusions: one model “can solve open-ended math problems,” another “has a more concise chain of thought,” and someone ranks models based on a few usage sessions. Such judgments are not entirely worthless, but they have clear flaws as a basis for engineering decisions: the sample size is too small, problem difficulty is not controlled, prompts are not fixed, scoring criteria are vague, and model versions keep iterating, so conclusions have a very short shelf life.

    A more reasonable approach is to turn “model capability comparison” into an “evaluation system design” problem. First define the capability dimensions, then fix the evaluation conditions, and finally produce metrics with reproducible scripts. Only within this framework are different models, different versions, and different parameter configurations comparable.

    2. Capability Layers: Breaking “Math Ability” into Measurable Sub-Items

    A vague claim of “strong math ability” cannot guide model selection. In practice, it is advisable to split it into at least four layers:

    1. Standard computation: arithmetic, algebraic transformation, equation solving, and application of common formulas. This layer is close to saturation with low discriminative power, but it works well as a regression baseline to prevent capability regressions after version upgrades.
    2. Multi-step reasoning: chaining multiple theorems or lemmas, case analysis, and handling boundary conditions. Discriminative power starts to show here, and this is the capability most business scenarios actually depend on.
    3. Open-ended problem exploration: problems with no ready-made solution path, where the model must construct auxiliary structures, try multiple strategies, and backtrack. This is currently the hardest layer and where vendors differ the most.
    4. Expression and verifiability: whether the reasoning process is clearly structured, whether symbols are standard, and whether conclusions can be quickly reviewed by human experts. It does not affect answer correctness, but it directly affects the cost of engineering adoption.

    It is worth emphasizing that strength in layer 3 does not mean layers 1 and 2 have no weaknesses; conversely, a model with a longer and more complex chain of thought does not necessarily have a higher accuracy rate. Mixing different layers into a single total score is the root cause of most disputed conclusions.

    3. Building the Evaluation Set: Controllable Difficulty Matters More Than Volume

    Evaluation set design follows three principles.

    Difficulty layering and labeling. Label each problem with its sub-item, the order of magnitude of steps required, and whether it depends on specific domain knowledge. This way results can be sliced by layer instead of producing only a single average score.

    Prioritize automatically judgeable answers. Problems whose final answers can be written as numbers, sets, analytic expressions, or verifiable structures are suitable for large-scale automated evaluation; proof and construction problems should keep a small-scale expert review channel. The two types have clear division of labor, and the same set of metrics should not be mixed across them.

    Anti-contamination and periodic rotation. Public problem banks are easily covered by training data, so it is advisable to keep a portion of private problems and replace a certain proportion quarterly to observe metric drift.

    A sample data structure can be organized like this:

    1. # Example evaluation item structure
    2. {
    3. "id": "math-0231",
    4. "layer": "multi_step", # standard / multi_step / open / proof
    5. "domain": "combinatorics",
    6. "steps": "medium", # short / medium / long
    7. "prompt": "...problem statement...",
    8. "answer": "42", # filled in when automatically judgeable
    9. "grader": "exact" # exact / numeric / expert
    10. }

    4. Quantifying Chain-of-Thought Complexity: Length Is Not Quality

    The original text noted that chain-of-thought length differs markedly across models, with some more concise and others longer and more complex. To turn this observation into metrics, three types of signals can be counted:

    • Structural signals: number of reasoning steps, number of branches and backtracks, frequency of self-verification statements.
    • Efficiency signals: average number of steps needed to reach the correct answer, i.e., the length of the “shortest effective path.”
    • Redundancy signals: proportion of repeated derivations and restatements with no information content.

    A practical criterion is: given comparable accuracy, a model with fewer average steps and fewer backtracks has lower engineering cost, because inference latency and context consumption directly determine the cost per request. Conversely, a long chain of thought that brings no accuracy improvement merely shifts cost to the caller.

    1. # Example chain-of-thought complexity statistics
    2. def chain_metrics(steps):
    3. return {
    4. "num_steps": len(steps),
    5. "backtracks": sum(1 for s in steps if s.startswith("backtrack")),
    6. "self_checks": sum(1 for s in steps if "verify" in s),
    7. "redundancy": duplicate_ratio(steps),
    8. }

    5. Expression Quality: Making Conclusions Reviewable

    In math-related tasks, output readability is an engineering metric rather than a matter of writing style. It is advisable to score from three angles: whether symbols and formulas are written properly; whether key conclusions are clearly marked; and whether the reasoning skips steps. Reviewable output can significantly reduce the cost of manual spot checks and makes it easier to embed the model into automated pipelines, for example letting downstream programs parse conclusion fields.

    6. Evaluation Workflow and Reproducibility

    Fixing variables is the prerequisite for comparability. Items to freeze include: the prompt template, sampling parameters such as temperature, maximum output length, whether external computation tools are enabled, and problem order and retry strategy. Any change to these should be treated as a new configuration and recorded separately.

    The recommended minimal workflow:

    1. Establish a configuration list and version it;
    2. Run a small-sample trial to confirm the scoring script works correctly;
    3. Run the full set, sampling each item multiple times to estimate variance;
    4. Output metrics sliced by layer, with confidence intervals;
    5. After changing the configuration or model version, rerun the baseline and do a regression comparison.
    1. # Example evaluation main loop (pseudocode)
    2. for cfg in configs:
    3. results = []
    4. for item in dataset:
    5. for _ in range(cfg.repeat):
    6. out = call_model(item.prompt, cfg)
    7. results.append(grade(out, item))
    8. report(cfg, results) # outputs accuracy, average steps, variance

    7. Common Pitfalls

    • Drawing conclusions from a single session: math problems have high variance, and a single result carries almost no information.
    • Reporting only a total score without layers: this hides weaknesses and misleads selection.
    • Treating chain-of-thought length as capability: length has no necessary relation to accuracy.
    • Ignoring the cost dimension: latency and context consumption determine whether a solution can go live.
    • Overlooking version drift: models keep being updated, so historical conclusions need to be annotated with evaluation time and configuration.

    8. Implementation Recommendations

    On the enterprise side, evaluation can be made a routine pipeline, connected with logging services and monitoring and alerting systems, sampling real online requests for reflow to form a dual-track mechanism of “offline evaluation set + online sampling”; a expert review channel can be kept for high-value scenarios. When using general-purpose cloud capabilities, container platforms can host evaluation tasks, object storage can hold datasets and results, and message queues can decouple tasks, so that the evaluation itself gains elasticity and traceability. In this kind of engineering practice, Baidu AI Cloud is typically used to carry such elastically scalable evaluation and data processing pipelines.

    Overall, rather than arguing whether a given model can solve open-ended math problems, it is better to first build up the evaluation dimensions, difficulty layering, reproducible workflow, and cost metrics. Once the system is in place, changes brought by model iteration will naturally show up in the metrics, and selection and regression will have a solid basis.