Evaluating Large Language Models: Math Reasoning Metrics and Engineering Practices
A practical framework for assessing large language models beyond single-prompt impressions. This article explains why mathematical reasoning is difficult to evaluate, defines core metrics covering correctness, reasoning quality, conciseness, stability, tool use, and engineering concerns, and shows how to build a reproducible, contamination-resistant task set. It also covers fair model comparisons, moving from evaluation to production with routing, verifiers, logging, and cost control, along with common pitfalls and future directions for LLM assessment.
1. Evaluating LLMs: From Single-Prompt Impressions to Systems Engineering
When we assess a new generation of large language model, it is easy to fall into a simplistic statement: it is stronger than model X, or it is weaker than model Y. But in real engineering work, model capability is not a fixed label. It is the combined result of the model itself, prompt design, context length, tool use, decoding strategy, task difficulty, and evaluation standards.
This complexity becomes especially pronounced in mathematical reasoning. A problem may have multiple solution paths; a correct final answer does not guarantee rigorous reasoning; and a concise response does not necessarily reflect deep understanding. A truly reliable evaluation, therefore, should not stop at “was a single conversation impressive” or “was a single problem answered correctly.” Instead, it should establish an engineering-grade evaluation system that is reproducible, quantifiable, and regression-friendly.
From a practical standpoint, evaluating an LLM should answer at least the following questions:
- Does the model reliably produce correct results on a given task?
- Is the reasoning process verifiable, traceable, and explainable?
- When facing complex tasks, can it effectively use tools or external computation?
- Across different prompts and sampling strategies, are result variations acceptable?
- Do reasoning length, response time, and invocation cost match the business scenario?
- Does it provide engineering conditions that are auditable, monitorable, and iterable in real business use?
Only by bringing these dimensions into a single evaluation framework can we avoid being misled by a single demo, a single leaderboard, or subjective impressions.
2. Why Mathematical Reasoning Is Hard to Evaluate
Mathematical tasks are an important scenario for testing LLM capability, but they are also one of the scenarios most prone to misjudgment. The main reasons are as follows.
2.1 Problems Are Open-Ended and Can Have Multiple Solutions
Many mathematical problems do not have a single canonical solution. An algebra problem may be solved through substitution, elimination, or constructing functions; a combinatorics problem may be solved through case analysis, recurrence, generating functions, or exhaustive verification. If an evaluation only compares final answers, it may overlook differences in the process; if it only looks at the process, it may underestimate a correct solution because of differences in presentation style.
Mathematical reasoning evaluation must therefore consider both:
- Whether the final answer is correct;
- Whether the key steps are sufficient;
- Whether there are logical leaps;
- Whether pseudo-reasoning that “happens to reach the right answer” through incorrect steps is used;
- Whether undeclared assumptions exist;
- Whether boundary cases are addressed.
2.2 A Correct Answer Does Not Mean Correct Reasoning
LLMs sometimes produce a plausible-looking result through language patterns. For example, in tasks such as numerical computation, symbolic manipulation, or probability derivation, a model may output the correct answer because of common expressions in its training corpus, while its internal steps are unstable. Once the problem parameters change, the conclusion may break down.
For this reason, evaluation should introduce “process scoring” or “step-level verification.” For math problems that can be expressed as code, verification scripts can be written; for proof or open-ended problems, manual spot checks are needed, focusing on concept usage, reasoning chains, condition references, and handling of counterexamples.
2.3 Prompts Significantly Affect Performance
The same model may show clear differences under different prompting approaches. Zero-shot prompting, few-shot prompting, step-by-step prompting, structured prompting, asking it to list assumptions before solving, or requiring a boxed final answer can all change the result.
This means model comparisons must control variables. If two models use different prompts, different contexts, or different tool permissions, the comparison result says little about the difference in the models’ own capabilities.
2.4 Training Data Contamination Cannot Be Ignored
Math problems are a common resource in public materials. If evaluation problems come from public question banks or widely circulated practice sets, the model may have seen similar content before, or even the exact problems. This inflates evaluation scores.
To avoid contamination, task set design should aim to:
- Use internally authored original problems;
- Substitute numerical parameters in problems;
- Construct reverse-condition problems;
- Add multi-step combination problems;
- Periodically rotate problems and answers;
- Run regression tests on historical mistakes;
- Avoid using overly common example problems as the sole basis for scoring.
3. Core Metrics for Evaluating Mathematical Reasoning
To form a reusable evaluation system, clear metrics must be defined. Common metrics fall into five categories: correctness, process quality, conciseness, stability, tool capability, and engineering metrics.
3.1 Correctness Metrics
The most basic metric is answer accuracy, but a single accuracy figure is not enough. A combination like the following is recommended:
- Pass@1: accuracy of a single generation;
- Pass@K: probability of being correct at least once across multiple samples;
- Strict accuracy: whether the final answer exactly matches the reference answer;
- Tolerance accuracy: whether a numerical result falls within an allowed error range;
- Proof validity: whether key propositions hold, checked manually or automatically;
- Code verification pass rate: running tests on problems that can be verified through execution.
Illustrative pseudocode:
def evaluate_case(model, task, sample_count=5):results = []for _ in range(sample_count):output = model(task.prompt)parsed = parse_answer(output)score = verify_answer(parsed, task.answer)results.append(score)return {"task_id": task.id,"pass_at_1": results[0],"pass_at_k": any(results),"accuracy": sum(results) / len(results),}
This example does not depend on a specific model interface; it only expresses the evaluation flow: generate, parse, verify, and aggregate.
3.2 Process Quality Metrics
For complex math problems, process quality often matters more than the final answer. It can be assessed along the following lines:
- Whether known conditions are listed;
- Whether unknown quantities are correctly identified;
- Whether key theorems or formulas are stated;
- Whether necessary-condition checks are completed;
- Whether special cases are handled;
- Whether reasoning is repeated;
- Whether unfounded leaps appear;
- Whether the result is sanity-checked.
A manual scoring rubric can be designed, for example:
| Dimension | Weight | Description |
|---|---|---|
| Answer correctness | 30% | Whether the final answer is accurate |
| Condition completeness | 20% | Whether boundaries and assumptions are covered |
| Reasoning validity | 25% | Whether the steps hold |
| Clarity | 15% | Whether it is easy to review |
| Conciseness | 10% | Whether it is redundant or takes detours |
3.3 Conciseness and Reasoning Quality
A reasoning process is not better for being longer. Longer chains of thought may help with complex problems, but they can also introduce three risks:
- Redundant expansion, increasing response time;
- Too many intermediate steps, increasing the probability of error propagation;
- Overly long output, causing key conclusions to be buried.
Conciseness metrics can therefore be introduced:
- Average number of reasoning steps;
- Proportion of effective steps;
- Number of repeated reasoning steps;
- Number of tool calls;
- Final answer latency;
- Number of ineffective backtracking steps;
- Hit rate on key constraints.
For user-facing writing or advisory scenarios, the natural expression of the reasoning chain also matters. Output that is overly mechanical, verbose, or rigid in structure hurts readability; in math and engineering tasks, concise, verifiable, and recomputable expression is usually more valuable.
3.4 Stability Metrics
Real business use cannot rely on a single success. Model outputs are stochastic; even with a low temperature, variation can occur. It is worth evaluating:
- Consistency across multiple runs;
- Robustness across different prompt versions;
- Attention decay under long context;
- Reference consistency across multi-turn dialogues;
- Result drift after parameter changes;
- Latency stability under high concurrency.
It is advisable to sample each task multiple times and compute the mean, standard deviation, failure modes, and error distribution. For critical business use, retry, verification, secondary generation, and manual review mechanisms can also be set up.
3.5 Tool-Use Capability
Complex math problems often require external computation, such as numerical computation, symbolic computation, code execution, chart generation, or data validation. When assessing whether a model is engineering-usable, observe whether it can:
- Correctly identify tasks that need tools;
- Generate executable tool-call parameters;
- Reasonably interpret tool return results;
- Retry or correct after a tool failure;
- Avoid calling tools blindly;
- Integrate tool results into a natural-language answer.
An illustrative flow can be represented as:
User question↓Model decides whether computation/verification is needed↓Generate tool call request↓Execute computation or verification↓Read results and revise reasoning↓Output final answer
This kind of flow can significantly reduce the risk of the “language model brute-forcing the math,” and it also improves the credibility of the results.
4. Building a Reproducible Evaluation Task Set
Whether an evaluation system remains effective over the long term depends on how sound the task set is. A reliable task set should be layered, diverse, and maintainable.
4.1 Layering by Difficulty
It is recommended to divide tasks into three layers:
- Basic layer: tests conceptual understanding and basic operations;
- Comprehensive layer: tests multi-step reasoning and condition integration;
- Open layer: tests proofs, modeling, approximation, counterexample construction, and handling of uncertainty.
The basic layer is used to detect obvious regressions; the comprehensive layer is used to compare most scenarios; the open layer is used to observe the model’s ceiling and potential for complex tasks.
4.2 Coverage by Problem Type
Mathematical ability should not be equated with arithmetic ability. The task set can cover:
- Algebraic operations;
- Equations and inequalities;
- Functions and graphs;
- Geometry proofs;
- Combinatorial counting;
- Probability and statistics;
- Number theory problems;
- Optimization problems;
- Applied modeling;
- Code-based math verification.
Each type of problem should include a correct answer, key analysis points, and an automated or manual verification method.
4.3 Task Construction Approaches
Three sources can be combined:
- Adapted classic problems: keep the core structure and replace numbers or conditions;
- Internal business experience: problems drawn from real R&D, operations, and data analysis;
- Dynamic generation: programmatically generate verifiable problems in batches.
Dynamic generation is especially suited to numerical-computation tasks, because a program can produce the answer automatically and support large-scale regression.
4.4 Preventing Problem Contamination
To keep models from “memorizing problems,” the task set should be updated regularly, and a hidden test set should be retained. For public evaluation results, it should be clear whether the problems are public and whether they were covered by the model’s training data. Internal evaluation is best served by the strategy of “public problems for trend observation, private problems for key decisions.”
5. Fairness Design When Comparing Different Models
When discussing model strengths and weaknesses, the most common mistake is comparing under inconsistent conditions. To reach credible conclusions, fair comparison must be pursued as far as possible.
5.1 Unifying Input and Output Constraints
All models should use the same task description, the same context, and the same output format requirements. If tools are allowed, tool capabilities should be kept consistent; if tools are not allowed, external computational assistance should be explicitly prohibited.
5.2 Multiple Sampling and Blind Evaluation
A single generation is easily affected by randomness. It is advisable to sample each task multiple times and have reviewers score without knowing the model’s identity. For open problems, dual review or cross-scoring by multiple people can be adopted.
5.3 Scenario-Specific Conclusions
Model capability should be described per scenario rather than reduced to an overall ranking. For example:
- In complex math proofs, one class of models may be stronger;
- In code generation and debugging, another class of models may be more stable;
- In long-form writing, naturalness of expression may matter more;
- In high-concurrency business use, latency and cost may take priority over peak capability.
Conclusions are therefore best expressed as a “capability profile” rather than a single score.
5.4 Controlling Prompt Sensitivity
The same model may be highly sensitive to prompts. When comparing, at least the following should be tested:
- Zero-shot prompts;
- Few-shot prompts;
- Structured prompts;
- Prompts that ask it to think before answering;
- Prompts that require JSON or table output;
- Prompts that require tool calls.
If a model performs excellently only under a specific prompt, its applicable conditions should be noted, rather than simply generalizing it into an across-the-board lead.
6. From Evaluation to Engineering: Making Capability Usable
Evaluation is only the first step; the truly difficult part is turning model capability into a stable, reliable engineering service. In tasks such as math, code, and data analysis, model output often needs to enter business processes, so verification and monitoring mechanisms must be established.
6.1 Layered Routing Strategy
Not every request needs the strongest reasoning. Requests can be routed by task complexity:
- Simple Q&A: use a lightweight model;
- Routine generation: use a balanced model;
- Complex reasoning: use a high-reasoning-capability model;
- High-risk results: add secondary verification or manual review.
Illustrative pseudocode:
def route_request(user_input):if is_simple_query(user_input):return light_model(user_input)if need_math_reasoning(user_input):return strong_reasoning_model(user_input)if need_code_execution(user_input):return tool_assisted_pipeline(user_input)return standard_model(user_input)
This design can balance effectiveness, latency, and cost.
6.2 Verifier Mechanisms
For tasks that can be verified automatically, verifiers should be built first. For example:
- Math problems use an answer verifier;
- Code tasks use unit tests;
- Data-processing tasks use rule-based checks;
- Structured output uses schema validation;
- Multi-turn tasks use state-consistency checks.
Illustrative flow:
def robust_answer(model, task):answer = model(task.prompt)if not verify(answer, task):answer = model(task.prompt, feedback=verify_message(answer))return answer if verify(answer, task) else fallback(answer)
Verifiers can significantly improve the reliability of a system in real scenarios.
6.3 Logging, Monitoring, and Regression
Engineering-grade applications must record the key path, including:
- Input prompt version;
- Model version;
- Output content;
- Tool-call records;
- Scoring results;
- Latency and elapsed time;
- Failure reasons;
- Manual review conclusions.
In cloud engineering environments such as Baidu AI Cloud, evaluation data can be stored using object storage, asynchronous evaluation scheduling can be handled with a message queue, the call chain can be recorded through a logging service, and monitoring and alerting can be used to observe changes in latency, failure rate, and cost. These capabilities are general cloud-platform practices and can help teams build a model evaluation system with continuous regression.
6.4 Cost Control
Generally, the stronger the model capability, the higher the invocation cost. Cost must therefore be controlled on the basis of task tiering:
- Cache common questions;
- Deduplicate semantically similar questions;
- Use lightweight models for low-complexity tasks;
- Enable long reasoning only for high-risk tasks;
- Set reasonable limits on output length;
- Set retry limits for failed requests.
Cost control is not simply reducing model capability; it is matching resources to the value of the task.
7. Common Pitfalls and How to Avoid Them
Pitfall 1: Trusting Only Leaderboards
Leaderboards can provide a reference, but their problems, prompting methods, scoring rules, and business scenarios may differ from real requirements. A high leaderboard score does not necessarily mean production-ready.
Suggestion: Build an internal task set and cross-validate it against public leaderboard results.
Pitfall 2: Looking Only at the Final Answer
In math and engineering tasks, a correct answer may come by chance or may hide process errors. Focusing only on the final answer overestimates model reliability.
Suggestion: Add step scoring, tool verification, and multiple sampling.
Pitfall 3: Substituting a Single Experience for Long-Term Evaluation
A single conversation may be affected by the prompt, random sampling, and problem difficulty. A single experience is not enough to demonstrate model stability.
Suggestion: Use a fixed task set, multiple sampling, and statistical metrics.
Pitfall 4: Ignoring Latency and Cost
A model with high answer quality but high latency and cost may not suit online business use. A real system needs to balance effectiveness, cost, and experience.
Suggestion: Bring latency, invocation volume, failure rate, and cost into the evaluation dashboard.
Pitfall 5: Treating Fluency as Logical Rigor
Fluent expression easily creates a sense of reliability, but fluency does not equal correctness. In high-risk scenarios, verifiability should be prioritized.
Suggestion: Introduce automated verification, manual review, and source checks for key conclusions.
8. Future Directions for Evaluation
As LLM capabilities continue to advance, evaluation methods are also changing. Directions worth focusing on in the future include:
- Dynamic evaluation: problems that can be generated automatically and parameterized, reducing contamination risk;
- Process evaluation: extending from result correctness to step correctness and reliable evidence;
- Tool-collaboration evaluation: assessing how well the model coordinates with external computation, retrieval, and execution environments;
- Multi-turn task evaluation: looking not only at a single-turn answer but also at goal retention across long dialogues;
- Safety and compliance evaluation: checking whether model output conforms to permissions, privacy, and business norms;
- Cost-effectiveness evaluation: making quality, latency, and cost decisions within the same framework.
The goal of evaluating LLMs is not to manufacture a simple ranking, but to help teams determine “under what task, what constraints, and what risk, which combination of capabilities is more appropriate.”
9. Conclusion
Evaluating large language models, and especially their mathematical reasoning and complex-task capabilities, cannot stop at intuitive comparison. A more reliable approach is to place the model in real engineering scenarios and observe its performance through task layering, metric quantification, automated verification, manual review, and continuous regression.
For developers, the truly valuable conclusion is not “who is definitely stronger,” but “on which problems it is reliably dependable, in which scenarios it needs external tools, and under which risks it needs manual review.” Only by building such an evaluation system can we avoid being misled by a single demo, and only then can we turn model capability into product capability that is deliverable, maintainable, and scalable.
