How to Evaluate and Choose LLMs for Mathematical Reasoning: A Reproducible Framework

    Choosing a large language model for math-heavy workloads is difficult because vague "who is best" rankings depend on the prompt, sampling settings, and the person running the test. This article proposes a reproducible way to measure mathematical reasoning instead: splitting math into four independent sub-skills, scoring difficulty tiers separately rather than as a weighted average, tracking chain-of-thought complexity against accuracy, and preferring machine-verifiable answers. It includes a minimal Python evaluation skeleton with fixed sampling parameters and logged reasoning traces, plus common interpretation pitfalls and practical advice for building a regression loop. The framework is product-agnostic and applies to general-purpose LLM services.

    1. Why “math ability” resists a one-line answer

    A recurring argument in model selection is simply which model is stronger. Most ranking-style conclusions in such discussions are subjective impressions formed on a particular set of problems. They are not worthless, but they lack three key elements: whether the problem source is public, whether the scoring standard is consistent, and whether the reasoning process can be audited. Without those three, a ranking swings wildly with how the question is phrased, how the prompt is written, and what sampling parameters are used.

    A more professional approach is to stop asking “who is first” and reframe the question: under a given task distribution, how do you measure a model’s mathematical reasoning reproducibly, and make an engineering selection based on that? The framework below is independent of any specific product and applies to general-purpose LLM services.

    2. Capability layers: breaking “math” into measurable sub-skills

    A blanket claim of being “good at math” covers at least four independent capabilities. Evaluating them together inevitably produces contradictory conclusions:

    1. Arithmetic and symbolic manipulation stability: multi-digit computation, unit conversion, moving terms across an equals sign — this tests the reliability of low-level execution.
    2. Theorem and formula retrieval and reuse: whether the model correctly applies established results instead of “inventing” a wrong formula.
    3. Multi-step problem decomposition: splitting an open-ended problem into sub-problems and managing dependencies among intermediate quantities.
    4. Self-verification and error correction: substituting the answer back in, checking dimensions, and discussing boundary cases after reaching a result.

    Engineering experience shows that most complaints about a model “computing the wrong answer” occur at layers 1 and 4, not layer 3. This explains why a model with a longer chain of thought is not necessarily more accurate: a longer reasoning chain introduces more intermediate steps, each one an opportunity to err, and without a verification mechanism the errors are amplified rather than cancelled out.

    3. Three dimensions of the evaluation framework

    3.1 Difficulty tiers

    Divide problems into four tiers: single-step application, two-to-three-step combinations, problems requiring a constructive approach, and open unsolved or competition-level problems. Report pass rates per tier rather than a single weighted average. A weighted average hides fatal weaknesses: a model scoring 95% on the easy tier and 20% on the constructive tier may look close to another model in aggregate, yet the two are entirely different in production usability.

    3.2 Chain-of-thought complexity

    Quantifiable proxy metrics include the number of reasoning steps, branch backtracking events, self-correction events, and the share of verification actions taken before the final answer. The central question here is whether the relationship between complexity and accuracy is monotonic. If a model’s accuracy gains come mainly from longer reasoning chains, the benefit is unstable and cost rises linearly. If accuracy gains come with more verification actions, the capability structure is healthier.

    3.3 Answer verifiability

    Prefer problems with a unique answer that can be checked by machine, judged by exact match plus a numerical tolerance. For proof problems, use semi-automatic scoring based on key-point coverage, calibrated by human spot checks. Verifiability is a prerequisite for automated evaluation; otherwise the evaluation itself becomes a new source of error.

    4. A reproducible automated evaluation implementation

    The sketch below shows a minimal working evaluation skeleton. It emphasizes fixed sampling parameters, recording the full reasoning process, and persisting results so runs can be reviewed later:

    1. import json, math, hashlib
    2. # Fixed sampling parameters are a prerequisite for reproducibility
    3. GEN_CFG = {"temperature": 0.0, "top_p": 1.0, "max_tokens": 4096, "seed": 20260101}
    4. def grade(pred: str, gold: float, tol: float = 1e-6) -> bool:
    5. try:
    6. return math.isclose(float(pred.strip()), gold, rel_tol=tol, abs_tol=tol)
    7. except (ValueError, TypeError):
    8. return False
    9. def run_one(item, call_model):
    10. key = hashlib.sha256(item["prompt"].encode()).hexdigest()[:12]
    11. resp = call_model(item["prompt"], **GEN_CFG)
    12. ok = grade(resp["answer"], item["gold"])
    13. return {
    14. "id": key,
    15. "tier": item["tier"], # difficulty tier
    16. "steps": resp["reasoning_steps"],
    17. "self_check": resp["self_check_count"],
    18. "passed": ok,
    19. }
    20. def summarize(records):
    21. out = {}
    22. for tier in {r["tier"] for r in records}:
    23. sub = [r for r in records if r["tier"] == tier]
    24. out[tier] = {
    25. "pass_rate": sum(r["passed"] for r in sub) / len(sub),
    26. "avg_steps": sum(r["steps"] for r in sub) / len(sub),
    27. }
    28. return out

    Three supporting practices are also needed: put problems and gold answers under version control; write evaluation records to object storage while retaining raw model output; and build a regression set from failed samples, re-running it after every model or prompt change.

    5. Common pitfalls in interpreting results

    • Concluding from a single sample: math problems are sensitive to sampling randomness. Sample the same problem multiple times and use the pass rate rather than a single success or failure.
    • Looking only at the final answer: a correct answer reached through “coincidental correctness” in the reasoning will fail immediately on variant problems, so keep the process auditable.
    • Mixing tiers in one ranking: as noted above, a mixed ranking will almost certainly mislead the selection decision.
    • Ignoring cost: reasoning length directly determines latency and expense, so selection requires a Pareto comparison across accuracy, latency, and unit cost.

    6. Implementation advice

    On Baidu AI Cloud, the pieces can be combined into a closed loop: model services, a containerized evaluation job, object storage, log service, and monitoring with alerting. The container platform hosts the evaluation executor to keep the environment consistent, object storage holds the dataset and raw outputs, and the log service plus monitoring and alerting track pass-rate drift. When the online pass rate drops significantly, a regression evaluation is triggered, forming a continuous calibration mechanism.

    In short, instead of arguing about where a model ranks, build your own tiered evaluation set and verification mechanism. A reproducible measurement framework is the reliable foundation for model selection and continuous optimization.