Evaluating Large Language Models on Math Reasoning: A Practical Engineering Guide

    This article explains why math reasoning is hard to evaluate for large language models and how to approach it in production. It covers building a reproducible evaluation set with verifiable, proof-based, and open-ended tasks; prompt and decoding strategies such as structured output, mandatory self-checks, and sampling with voting; and the cost of long chain-of-thought reasoning in terms of quota, throughput, and capacity planning. It also lists common pitfalls and practical recommendations for teams that need to compare models and deploy reasoning services reliably.

    1. Why “Math Ability” Is Hard to Define in One Sentence

    In real model selection, many teams run into an awkward situation: the same model handles routine Q&A smoothly, but once you ask it to prove a mathematical proposition that has no publicly available proof, output quality drops sharply. The core observation from the original discussion is exactly this—what really separates models is not the general conversational experience, but the reasoning depth and self-verification ability on open-ended math problems.

    It is worth stressing that there is no absolute standard for ranking capabilities. Rankings depend heavily on the problem distribution, prompting style, decoding parameters, and evaluation criteria. So the more reliable engineering approach is to turn “which model is stronger” into “on my task distribution, which model has a lower error rate and more controllable cost per unit.”

    2. Building a Reproducible Math Reasoning Evaluation Set

    The first principle of evaluation is verifiability. Math answers are naturally suited to automated judging, but there are also plenty of “looks right, actually wrong” pseudo-proofs, so the evaluation set needs a layered design:

    1. Computation tasks: a unique final answer that can be compared directly as a string or numeric value;
    2. Proof tasks: require checking the completeness of the logical chain; formal verification or manual spot checks are recommended;
    3. Open-ended tasks: no existing reference solution exists, so you can only assess “whether the derivation is self-consistent and whether it cites non-existent results.”

    A simplified evaluation driver:

    1. def run_eval(model_client, dataset, k=4, temperature=0.7):
    2. records = []
    3. for item in dataset:
    4. samples = [model_client.solve(item.prompt, temperature=temperature)
    5. for _ in range(k)]
    6. passed = sum(1 for s in samples if item.verify(s))
    7. records.append({
    8. "id": item.id,
    9. "pass_at_1": passed / k,
    10. "avg_tokens": sum(s.tokens for s in samples) / k,
    11. })
    12. return records

    Two dimensions are deliberately kept here: pass_at_k and avg_tokens. The former measures the capability ceiling; the latter determines the bill. Looking only at the good and ignoring the bad is the most common mistake in model selection.

    3. Prompting and Decoding Strategies: Turning “Can Do” into “Does It Right”

    Open-ended proof tasks are extremely sensitive to prompt structure. Reusable key points include:

    • Specify the deliverable format: require output as a structured document and define the section skeleton (definitions, lemmas, main proof, boundary case discussion);
    • Enforce a self-check step: require the model to list the lemmas it uses and their sources before the conclusion, to avoid “citing out of thin air”;
    • Step-by-step with backtracking: first give a proof strategy sketch, then expand the details, and finally do a reverse check;
    • Sampling and voting: for hard problems, use multiple samples, filter candidate proofs by consistency, then do manual or formal review.
    1. Task: Prove the following proposition and output a structured document.
    2. Requirements:
    3. 1) First give a proof strategy overview (no more than 5 lines);
    4. 2) List all cited lemmas and indicate whether they are common standard results;
    5. 3) Expand the main proof step by step, explaining the basis for each step;
    6. 4) Self-check at the end: point out the step most likely to be wrong and why.

    The value of this structure is that it turns uncontrollable “inspiration” into an auditable process and makes failing samples easier to diagnose.

    4. The Cost of Long Chain-of-Thought: Quota, Throughput, and Capacity Planning

    The original discussion mentions that one high-quality proof consumes only a very small fraction of the monthly quota. This kind of empirical number points to a key engineering fact: the cost of advanced reasoning is driven mainly by output length and the number of retries, not input length.

    In self-hosted scenarios, throughput is strongly related to GPU memory, batching strategy, and context length. A common industry practice is to split requests into two lanes—“interactive short requests” and “offline long reasoning tasks”—with different batch sizes and timeouts for each. Offline tasks go through a queue, with object storage used to save intermediate artifacts, and logging services plus monitoring alerts to track failure rates and queue times.

    1. channels:
    2. interactive:
    3. max_batch: 8
    4. timeout_ms: 20000
    5. offline_reasoning:
    6. max_batch: 32
    7. timeout_ms: 600000
    8. queue: reasoning-batch
    9. artifacts: object-storage

    For capacity planning, it is recommended to work backward from “cost per 10k tokens + target concurrency” to estimate the required compute, and reserve 30% headroom for long-tail problems. If you use elastic scaling on a cloud container platform, set scaling metrics based on queue length rather than CPU utilization alone—the inference bottleneck is usually not the CPU.

    5. Common Pitfalls and Practical Recommendations

    • Only looking at leaderboard rankings: leaderboard problem distributions differ greatly from real business needs, so always build a small sample set for regression;
    • Ignoring output length cost: long chain-of-thought brings gains but also bills and latency, so set an upper limit;
    • No human fallback: open-ended proof tasks still require domain expert spot checks today;
    • No version pinning: both models and decoding parameters drift, so evaluations must record version and parameter snapshots.

    Overall, when facing high-difficulty math reasoning, the rational path is: first build a verifiable evaluation, then push the capability ceiling through prompting and sampling strategies, and finally use a queued, observable inference service to keep costs within a predictable range. Comparing capabilities is only the starting point; engineering implementation is what ultimately determines the payoff.