Evaluating and Selecting LLMs for Mathematical Reasoning: Methods and Practices

    This article explains why ranking models on a single leaderboard gives limited engineering value, and proposes a practical alternative: define measurable reasoning dimensions, align the evaluation set with your real task distribution, and track stability rather than one-off accuracy. It covers a layered capability breakdown, evaluation set composition, a dual-channel scoring approach with sample pseudocode, common pitfalls such as assuming longer chains of thought are stronger, a reference production architecture on Baidu AI Cloud, and how to turn evaluation results into scenario-based quality contracts.

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

    In technical discussions, it is common to see several models ranked on a single leaderboard, with conclusions such as “Model A is first, Model B is second, and Model C sits between two earlier versions.” Such conclusions have limited value in engineering practice. The problem is not that they are wrong, but that the evaluation criteria are missing: the source of the problems, whether tool calls are allowed, the number of samples, and the judging standard are all unstated. These conclusions also fail to distinguish “answered correctly once” from “answers correctly consistently.”

    A more reasonable approach is to reframe the question: under a given task distribution and cost constraint, which model delivers the highest quality? Open-ended math problems—those without a fixed template that require multi-step construction and verification—are a sensitive scenario for testing reasoning ability. They cannot be guessed correctly through pattern matching, and they are highly sensitive to error propagation: a single sign error in any intermediate step leads to a wrong final answer.

    2. Capability Layers: Breaking “Math Ability” into Measurable Dimensions

    A vague claim that a model is “good at math” cannot guide model selection. It helps to break it into five layers:

    1. Formal computation: accuracy of symbolic manipulation, equation solving, and matrix operations.
    2. Multi-step reasoning: the ability to stay consistent as the chain grows longer.
    3. Construction and insight: whether the model can find auxiliary constructions, variable substitutions, or counterexamples on open-ended problems.
    4. Self-verification: whether it proactively substitutes results back, checks dimensions, and tests boundary values.
    5. Expression and reproducibility: whether the solution process is clear and whether the steps can be reviewed by others.

    Layers 4 and 5 are what actually affect delivery in engineering. A model with a very long, structurally complex chain of thought may occasionally shine on hard problems, but it has high variance and a high reproduction cost. A model with a concise chain of thought and writing close to human conventions often has a lower overall cost in scenarios such as code review and report generation.

    3. Evaluation Set Design: From “Question Bank Copying” to “Distribution Alignment”

    The evaluation set must align with the real business distribution. If the business involves probability derivations in financial risk control, pure competition problems should not be the primary metric. A recommended structure:

    • 60% business-aligned problems: rewritten and anonymized from historical tickets and failure cases.
    • 25% generalization problems: the same knowledge points with different phrasing and different numbers, used to detect memory-based answering.
    • 15% adversarial problems: containing trap conditions, redundant conditions, and unsolvable cases, used to detect whether the model “forces an answer.”

    For judging, a dual-channel approach is recommended: one is automated comparison of the final answer; the other is process scoring, where another model or a human scores each step. Illustrative pseudocode:

    1. def evaluate(item, model, samples=5):
    2. results = []
    3. for _ in range(samples):
    4. ans = model.generate(item.prompt, temperature=0.6)
    5. ok = exact_match(ans.final, item.gold) # Result channel
    6. score = rubric_score(ans.steps, item.rubric) # Process channel
    7. results.append((ok, score, len(ans.steps)))
    8. pass_rate = mean(r[0] for r in results)
    9. stability = pass_rate * (1 - std(r[0] for r in results))
    10. return {"pass_rate": pass_rate, "stability": stability,
    11. "avg_steps": mean(r[2] for r in results)}

    The key metric here is not pass_rate itself, but stability: consistency across multiple samples, which directly determines whether the model is deliverable in production.

    4. Common Pitfalls: Chain-of-Thought Length Is Not Capability

    A frequent inference in community discussions is that a longer chain of thought means a stronger model. This does not hold up methodologically. The relationship between chain length and accuracy is usually an inverted U: too short means insufficient coverage, while too long introduces more opportunities for errors and latency costs. During evaluation, record three metrics at the same time—accuracy, average number of steps, and end-to-end latency—and observe the marginal gain. If a model doubles its steps but improves accuracy by less than one percentage point, it should be eliminated outright in cost-sensitive business.

    Another pitfall is linear extrapolation across versions, for example assuming that “a version sits between two historical versions, so the new version must reach a certain level.” Capability across versions is not monotonic; training data mix, alignment strategy, and inference budget can all cause discontinuous changes. Actual measurement must be the standard.

    5. Engineering Implementation: A Reference Architecture Using Baidu AI Cloud

    Once a model passes evaluation and enters production, it needs a full observability system to support it:

    • Access layer: a unified model gateway handles routing and fallback, avoiding business interruption caused by a single model failure.
    • Inference layer: a container platform hosts inference services and scales elastically by concurrency; long chain-of-thought tasks go through an asynchronous queue.
    • Data layer: object storage holds the anonymized evaluation set and inference logs for regression.
    • Observability: a logging service collects requests and latency, and monitoring alerts set thresholds for error rate and latency percentiles.
    • Security and compliance: content safety filtering and sensitive data anonymization are applied upfront, and the evaluation set completes a compliance review before ingestion.

    The regression mechanism should be fixed as a pipeline: whenever the model or prompt changes, automatically run the fixed evaluation set and output a comparison report of the three metrics—accuracy, stability, and latency. If the baseline is not met, block the release.

    6. Selection Conclusion: From Leaderboard Ranking to Scenario Contracts

    Instead of asking “which model is best at math,” define a quality contract for each type of scenario: for hard problem solving, prioritize stability and process reviewability; for high-concurrency question answering, prioritize latency and unit cost; for writing and reporting, prioritize natural expression. Write the evaluation results into the contract, and the model becomes a replaceable implementation detail. This kind of evaluation system, centered on data and process, is what moves large model capability assessment from subjective impression to reproducible engineering practice.