Evaluating LLM Math Reasoning: Methods, Metrics, and Cost Practices
This article explains how to evaluate a large language model's mathematical reasoning through reproducible experiments rather than anecdotal impressions. It breaks math ability into categories—computation, reasoning and proof, long-document handling, and code-based math—and walks through building a tiered question bank, automated checkers, and a regression and canary pipeline. Instead of a single accuracy figure, it proposes multi-dimensional metrics such as correctness, rigor, verifiability, cost efficiency, and stability. It also explains why long reasoning chains consume more tokens, how "cost per successful task" better reflects real spending, and offers practical engineering tips for task routing, context control, retries, observability, and data compliance.
1. The Problem: From “Is This Model Good?” to “How Do We Evaluate It?”
In community discussions, “How do you evaluate a given LLM?” comes up constantly, and most answers are based on a single personal experience. Someone had a model produce a long math handout and was struck by both the output quality and the amount of quota it consumed. Someone else compared word-of-mouth from different sources and produced a ranking of capabilities.
These discussions offer useful signals, but they are not enough to drive technical selection:
- Sample size is too small. A single task only reflects one model’s performance on one prompt and one problem, and it is hard to generalize to the full capability surface.
- Prompts vary widely. The same model can produce very different output quality under different prompts, so cross-model comparisons are often unfair.
- Reproducibility is missing. A reviewer’s subjective impressions cannot be quantified or shared across teams.
- Cost is ignored. Users tend to focus on “how well it did,” but engineering deployment also has to answer “how much does one run cost?”
So the more valuable question is not “which model is the strongest,” but “on the type of math task I care about, which model can reliably meet my quality bar at an acceptable cost and latency?”
2. Breaking Down Capabilities: Math Is Not a Single Dimension
In the math domain, “math ability” can be split into at least the following categories. Each differs markedly in difficulty, verification method, and applicable scenario:
| Capability | Typical tasks | Verification | Main risk |
|---|---|---|---|
| Computational solving | Equation solving, integration, optimization, numerical computation | Mostly automatable | Calculation errors, skipped steps |
| Reasoning and proof | Lemma derivation, combinatorics and number-theory proofs | Expert review or formal verification | Circular reasoning, citing nonexistent results |
| Long-document handling | Reading a textbook or paper, then locating, explaining, or proving a proposition | Expert spot-checking | Missing key conditions, referential errors |
| Code-based math | Numerical algorithm implementation, symbolic-computation scripts | Unit tests, comparison against known solutions | Boundary-handling errors, non-reproducible results |
Take open-ended math problems as an example. Such problems have no known answer, and the model must retrieve, combine, and construct arguments over a long context—far harder than the usual “given a problem, solve it.” Evaluation conclusions drawn around them cannot be simply generalized to other math scenarios.
It is also worth making clear: a longer chain of thought does not mean stronger reasoning. The intermediate reasoning a model outputs explicitly helps users check the logic, but it also significantly increases output length and runtime.
3. Designing the Evaluation System: From Question Bank to Regression Pipeline
3.1 Define the Target Scenarios
First, decide which tasks the system needs to support—for example, “solve math problems and verify results,” “read the literature and write a proof handout,” or “implement a numerical-computation program.” The target scenarios determine the composition of the question bank, the acceptance criteria, and the cost budget.
3.2 Build a Tiered Question Bank
The question bank should have two parts:
- Automatically judgeable basic questions: questions with a unique answer or a machine-verifiable result, used for fast regression;
- Open-ended questions that require expert review: including propositions with no reference proof, used to test complex reasoning and long-form organization.
The bank should record difficulty labels, sources, and judging rules, and add new questions regularly to avoid losing discriminative power when questions leak into a model’s training data.
3.3 Design Automatically Verifiable Checkers
For numerical problems, you can substitute the model’s answer back into the original expression, or recompute it with a high-precision library and compare—for example, whether the error is below 10⁻⁸. For proof problems, if the team has formal-verification capability, you can require the model to write its core argument as a machine-checkable formal proof; otherwise, at least extract the key lemmas and have domain experts check them one by one.
3.4 Run the Batch Evaluation Script
The example code below shows the basic skeleton of batch evaluation. The pseudocode is deliberately kept simple to illustrate the three-part structure of “prompt, judge, record”:
# Example code: batch evaluation with cost tracking (pseudocode)import asyncioPASS_AT_K = 3 # independent runs per case, to assess stabilityRETRY_ON_FAIL = 1 # retries after failure, off by default to reduce wasted spendREASONING_BUDGET = 8192 # max output tokens allowed per inferencedef verify(case, response) -> bool:"""Dispatch to the checker for the case type; return whether it passes"""if case["type"] == "numeric":err = numerical_compare(response["answer"], case["gold"], tol=1e-8)return err <= 1e-8elif case["type"] == "proof":return formal_check(response["proof"]) if case.get("formalizable") else Nonereturn None # cases requiring expert review are not judged hereasync def evaluate(case, model_client):attempts, tokens = 0, 0for _ in range(1 + RETRY_ON_FAIL):resp = await model_client.generate(prompt=case["prompt"],max_output_tokens=REASONING_BUDGET,)attempts += 1tokens += resp.usage.total_tokensif verify(case, resp):breakreturn {"case_id": case["id"], "passed": attempts > 0 and verify(case, resp),"attempts": attempts, "tokens": tokens, "latency_ms": resp.latency_ms}async def main(cases, model_client):tasks = [asyncio.create_task(evaluate(c, model_client)) for c in cases]results = await asyncio.gather(*tasks) # concurrency is bounded by client rate limitstotal_cases = sum(1 for r in results if r["attempts"] > 0)pass_rate = sum(r["passed"] for r in results) / max(total_cases, 1)success_tokens = sum(r["tokens"] for r in results if r["passed"])success_count = sum(r["passed"] for r in results)cost_per_success = success_tokens / max(success_count, 1)print(f"pass@1={pass_rate:.3f}, average {cost_per_success:.0f} tokens per successful task")
The script has three design points:
- Fixed parameters. Keep the prompt, output limit, random seed, and sampling parameters such as temperature consistent; otherwise, different models cannot be compared fairly.
- Separate the judgments. Count pass rate directly for judgeable questions, and record scores separately for expert-reviewed questions—do not mix them into one metric.
- Record cost data. Log token usage, latency, number of attempts, and pass/fail for each case, providing raw data for later cost analysis.
3.5 Establish a Regression and Canary Pipeline
After a model-version upgrade, a prompt change, or a question-bank update, rerun the same evaluation and retain the historical results. Before officially switching models, you can first run a canary comparison on a small share of live traffic, checking whether pass rate, latency, and cost meet expectations, and then gradually increase the share.
4. Scoring Dimensions: More Than Just “Accuracy”
A single accuracy figure is hard-pressed to reflect a model’s true level on math tasks. Multi-dimensional scoring is recommended:
| Dimension | Question it addresses | Suggested measure |
|---|---|---|
| Correctness | Are the final answer and key steps correct? | Automated check + expert review |
| Rigor | Does it skip steps or reason circularly? | Experts score against a rubric |
| Verifiability | Can the reasoning be independently checked or machine-verified? | Formal-verification pass rate |
| Cost efficiency | How much does one task cost on average? | Average tokens per successful task |
| Stability | Are repeated runs of the same task consistent? | pass@k, answer-consistency rate |
Take a task like “prove a math proposition that has no reference proof and output an English handout.” A qualifying handout should, at minimum, satisfy all of the following:
- The premises of the argument are clear, and every step of reasoning is traceable;
- The cited theorems genuinely exist and their conditions are met;
- Key lemmas can be verified independently;
- The writing is coherent and follows conventions, making it easy for others to review.
If any one of these falls short, the output cannot be delivered as-is and must go through human revision.
5. The Cost Perspective: Why Long Reasoning Chains Burn More Quota
Many platforms use a “subscription + quota” billing model. Quota is usually tied to the tokens a model actually consumes: inputting long documents consumes a large number of input tokens, while a longer reasoning process produces a large number of output tokens. A simplified formula captures this:
Per-task cost ≈ (input tokens + output tokens) × unit price + extra spend from failed retriesCost per successful task = total cost ÷ number of successful tasks
Assume one task inputs 1,000 tokens. The comparison across different output sizes (same unit price, illustrative only) is:
| Scenario | Output tokens | Tokens per task | Tokens per successful task at 60% success rate |
|---|---|---|---|
| Direct answer | 500 | 1,500 | 2,500 |
| Moderate reasoning chain | 4,000 | 5,000 | ~8,333 |
| Long handout + long reasoning | 20,000 | 21,000 | 35,000 |
So the per-task cost of a direct answer and that of a long handout can differ by more than tenfold. The lower the success rate, the higher the effective cost: failed tasks consume quota too, yet produce no usable output.
There are two common pitfalls here:
- Looking only at unit price. A model with more output tokens may end up costing more overall—even at a lower unit price—because of repeated attempts.
- Counting only successful tasks. When estimating a budget, ignoring failed retries and debugging spend easily leads to underestimating the actual expense.
So when selecting a model, it is advisable to look at “cost per successful task” together with “quality pass rate,” rather than comparing unit price or reputation alone.
6. Engineering Practice Recommendations
- Route by task tier. Send routine problems to a fast, low-cost general-purpose model; route high-difficulty proofs and long-form tasks to a model with long-chain reasoning capability, and set an output limit.
- Control context size. For long documents, retrieve and summarize first, then send only the fragments relevant to the question to the model to reduce wasted input tokens.
- Constrain the output structure. Require the model to return in a fixed structure, such as “conclusion—key steps—verification method—uncertainty note,” which eases both automated parsing and human review.
- Turn off blind retries by default. Retry only when the checker determines a definite error, to avoid wasting quota on sampling variance; when stability needs to be assessed, use pass@k to measure variance instead.
- Build observability. Log token usage, latency, success rate, and cost for each call; group statistics by model version and prompt version; and use monitoring and alerting to catch abnormal spending early.
- Pay attention to data compliance. When unpublished research content or sensitive data is involved, assess the risk of data leaving its region, and if necessary choose a cloud service that supports data isolation or private deployment.
7. Summary
Evaluating an LLM’s math ability is, in essence, using reproducible experiments to answer “on which task, at what cost, and to what quality.”
Concretely:
- First break tasks into types such as computation, proof, long-document handling, and code-based math, then design question banks and verification methods for each;
- Replace a single ranking with multi-dimensional metrics;
- Measure real spend with “cost per successful task.”
Building an internal benchmark with this workflow is what lets you make explainable, reusable, and regression-friendly technical decisions in an environment of rapidly iterating models.
