How to Evaluate LLM Math Reasoning and Long-Document Generation: A Practical Framework
Evaluating a large language model's mathematical reasoning from a single impressive demo can be misleading. This article explains why a one-off result is only a single sample and separates three variables that are often conflated: capability, cost, and price. It presents a practical framework for benchmarking math reasoning with a tiered problem set, data-contamination controls, a unified scoring rubric, formal verification, and reproducible experiment configuration. It then shows how to turn reasoning models into reliable long-document generators through structured prompts, segmented generation, and automated validation, and how to estimate the cost and budget of long reasoning chains. Finally, it describes how to move from one-off evaluation to engineering deployment through tiered routing, observability, and prompt engineering, so that teams can build a reproducible, comparable, and sustainable evaluation and scheduling system instead of simply chasing which model is strongest.
Introduction: Starting from a Single Case
A common pattern shows up in community discussions: someone asks a large model to reason about a proposition that has no published proof, requests an English lecture note in proper math typesetting, and observes that a single short instruction consumed roughly two percent of the monthly quota. From this, people draw conclusions like “the capability is solid and the value-for-money is good,” produce rankings of different models, or—because a membership’s points are about to expire—just spend the remaining quota “while they’re at it.”
This kind of firsthand experience is valuable, but strictly speaking it is only a single sample. From a one-line prompt to a complete lecture note, the model internally goes through at least several stages: understanding the request, retrieving or recalling relevant knowledge, constructing a proof, checking it repeatedly, and organizing the result into prose. If any stage goes wrong, output quality drops noticeably. So a single success only proves that “it got it right at least once”; it says nothing about the model’s overall level.
More importantly, three variables get mixed together—capability, cost, and price:
- Capability: whether the model can correctly understand the proposition and produce a correct, complete, and checkable derivation and proof;
- Cost: the tokens, compute time, and human review effort consumed to obtain a qualified result;
- Price: the monetary cost formed by usage-based billing from the service provider.
The community claim that “model X’s capability plus model Y’s price equals the rise of some country’s models” is, at its core, a judgment about value for money. This article does not rank specific products against one another. Instead, it answers two more general and more engineering-relevant questions:
- How can we scientifically evaluate a large model’s ability in math reasoning and long-document generation?
- How can we turn evaluation results into practical model selection, scheduling, and cost-governance decisions?
Evaluating Math Reasoning: Challenges and a Basic Approach
Why Math Reasoning Is Hard to Evaluate
Math reasoning is often treated as an important yardstick for a model’s “deep thinking” ability, for three reasons:
- Objective answers: the correctness of a proposition can be judged rigorously, without relying on the reviewer’s subjective preferences;
- Formalizable: a proof can be converted into a sequence of formal assertions and handed to a machine for step-by-step checking;
- Traceable process: if the model has reasoning output enabled (commonly called the “chain of thought” or “reasoning chain”), its thinking steps can be observed and analyzed.
Yet math ability is also among the easiest abilities to misjudge, for the following reasons:
- Randomness: sampling strategy, thinking budget, and context length all affect the output, so running the same problem multiple times may yield different results;
- Surface-level correctness: a step that looks obviously fine in a proof may quietly assume a wrong premise or omit a key case;
- Data contamination: widely circulated competition problems and textbook examples are very likely already in the training corpus, so a model remembering an answer does not mean it can reason;
- Prompt effects: the more standardized the problem statement and the clearer the constraints, the better the model tends to perform, so results fluctuate with how the prompt is phrased.
Designing a Tiered Problem Set
A practical approach is to divide problems into four difficulty tiers:
| Tier | Type | Characteristics | Scoring focus |
|---|---|---|---|
| L1 | Numerical computation and basic transformations | Solvable by direct formula substitution | Accuracy of the result |
| L2 | Standard theorem application and derivation | Requires correctly selecting and applying theorems | Step completeness; whether each condition is verified |
| L3 | Competition-level proofs and constructions | Requires constructing auxiliary objects or clever transformations | Validity of the construction; explainability of the approach |
| L4 | Research-level problems | No ready-made proof in the reference material; must organize the argument independently | Correctness and rigor of the proof; ability to organize the argument |
L4 is the tier with the most discriminating power. These problems force the model to “start from scratch” and organize an argument without a ready-made answer, so it cannot win by memory alone. Note that the reference answers for L4 problems are often long, making manual scoring expensive and subjective, so the scoring rules must be written down at the problem-design stage.
In addition, versions of the same proposition across different abstract structures can be treated as “probes at the same difficulty level.” For example, replacing an integer-coefficient polynomial with a polynomial over some class of Noetherian ring—and asking whether the conclusion still holds and what conditions the proof must add—reflects the depth of the model’s understanding of the general theorem, rather than a mechanical application to a specific case.
Guarding Against Data Contamination
- Prefer a self-built problem set, or problems that have been rewritten or turned into parameterized variants;
- Before evaluation, verify whether the problems and reference proofs might already appear in public corpora;
- Pay attention to each model’s knowledge cutoff and note it in the evaluation report;
- Periodically add new problems so the set does not “age” and lose its discriminating power.
Unifying the Scoring Criteria
Build a scoring sheet for each output. A 5-point scale is recommended, scored jointly by a reviewer model and human review:
| Dimension | Weight | 5 points | 3 points | 1 point |
|---|---|---|---|---|
| Correctness | 40% | Argument fully correct | Mostly correct, with a few minor flaws | Contains key errors |
| Rigor | 25% | Every claim is justified, no skipped steps | Some steps omitted but the conclusion still holds | Many “clearly follows” claims, even assuming unproven conditions |
| Completeness | 20% | Covers all cases and boundaries | Minor cases omitted | Key cases omitted |
| Traceability | 15% | Clear pointers (e.g., theorem number, page number) | References roughly traceable | Cannot be traced |
“Traceability” is often overlooked. If a model cites “a standard theorem” but provides no pointer, the reader cannot verify whether it is genuine. Asking the model to label where its supporting material appears—for example, “the proposition corresponding to a certain label in some math reference”—both reduces hallucination risk and makes it easy to automatically check whether the cited label actually exists.
Using Formal Methods
When conditions allow, natural-language proofs can be verified with formal proof tools or computer algebra systems. A common approach is to break the proof into a sequence of machine-checkable assertions and then hand them to a proof assistant or automated reasoning engine for step-by-step verification. The value here is turning “it sounds reasonable” into “the machine can verify it,” which sharply reduces the misjudgment rate. Of course, full formalization is costly and is better suited as a sampling-based cross-check than as a scoring method for the full set.
Ensuring Reproducible Experiments
Reproducibility is the lifeline of evaluation. If the prompt, sampling parameters, reasoning budget, and scoring rules are not all fixed, any ranking is meaningless. Example code:
# Example code: fix the prompt, sampling parameters, and scoring rules to ensure reproducible evaluation# 1. Fix the prompt template: define role, task, output format, and acceptance criteria up frontPROMPT_TEMPLATE = """You are a rigorous mathematician. Please prove the following proposition:[Proposition] {proposition}[Requirements]1. No proof is given in the cited public mathematical references; derive it independently;2. Produce an English lecture note in a standard math typesetting format;3. Structure it in this order: Introduction, Notations and Conventions,Main Result (with Proof), Remarks;4. When citing existing results, indicate the source (reference label or number);5. Use labels and a cross-reference mechanism for all cross-references so they resolve automatically;6. Do not skip key steps with unverified "clearly / obviously" claims."""# 2. Fix the sampling parameters, and record the model identifier and versionRUN_CONFIG = {"model": "<model-id>", # identifier only, to help locate the run when reproducing"temperature": 0.0, # use a low value for reasoning eval to reduce randomness"max_tokens": 8192, # note: this is the upper limit of the request parameter,"reasoning_effort": "high", # not the same concept as the max_tokens used in billing below}# 3. Fix the scoring rules (weights + level descriptions), and randomize output order to weaken reviewer biasRUBRIC = {"correctness": {"weight": 0.40, "levels": ["key error", "partial error", "fully correct"]},"rigor": {"weight": 0.25, "levels": ["multiple skipped steps", "some omissions", "every step justified"]},"completeness":{"weight": 0.20, "levels": ["misses key cases", "misses minor cases", "complete coverage"]},"traceability":{"weight": 0.15, "levels": ["cannot be traced", "roughly traceable", "clearly located"]},}
Long-Form Chain-of-Thought Documents: From a One-Off Success to Batch Deliverables
When using reasoning models for long-document tasks, being able to “write it right consistently and completely” matters just as much as being able to “write it right once.” A lecture note easily runs to several thousand words and involves multiple parts: abstract, notation conventions, main theorems, lemmas, proofs, and remarks. If the model runs short on space in the middle or later sections, its structure collapses, or it loses track of notation definitions, then no matter how good the first half is, the overall value drops sharply.
The Longer the Reasoning Chain, the More You Need Engineering Safeguards
A one-off successful output is a coincidence; a stable output is productivity. Engineering a long-document task requires at least four things.
(1) Structural constraints
In the prompt, explicitly define the section skeleton, the length proportion of each part, the symbol definition table, and the cross-reference method, and require the model to “list a proof outline first, then expand the details.” This significantly reduces structural drift.
(2) Segmented generation with state carry-over
Split the lecture note into several segment tasks, passing the already-fixed notation and theorem numbers as context into each segment to keep consistency across segments. Segmented generation also lets you rerun only the failed segment on a local failure, instead of rewriting the whole document.
(3) Automated validation pipeline
Run machine checks on the model output, for example:
- Attempt to compile with a standard math typesetting engine to catch syntax errors;
- Parse the section tree and verify continuity of numbering and completeness of cross-references;
- Extract symbol definitions and usages to check for symbols that are “used but never defined”;
- Validate citation labels for validity.
(4) Manual spot checks
Focus on high-risk points in the proof, such as key lemmas, boundary cases, and the exclusion of counterexamples.
Example code:
# Example code: an automated validation pipeline for long-document output (pseudo-code style)import redef validate_lecture(lecture_text):report = {}# 1. Structure check: are all sections present and numbered consecutively?sections = re.findall(r'\\section\{([^}]+)\}', lecture_text)required = ["Introduction", "Notations and Conventions","Main Result", "Remarks"]report["sections_ok"] = all(any(r.lower() in s.lower() for s in sections)for r in required)# 2. Cross-reference check: is every \ref label defined by a \label?labels = set(re.findall(r'\\label\{([^}]+)\}', lecture_text))refs = set(re.findall(r'\\ref\{([^}]+)\}', lecture_text))report["dangling_refs"] = sorted(refs - labels)# 3. Math typesetting compile check (calls a standard typesetting engine, pseudo-code)report["compilable"] = typesetting_engine.compile_ok(lecture_text)# 4. Symbol consistency check: symbols used in the text but never defined (illustrative; needs syntax-specific refinement)report["undefined_symbols"] = check_undefined_symbols(lecture_text)return report
The Cost Angle: Why Long Reasoning Chains Are “Expensive”
Many people are surprised the first time they use a reasoning model for a long-document task: the input is only a few hundred tokens, yet the consumption is substantial. There are three reasons:
- The reasoning process is also billed: a model’s internal reasoning is usually charged as output tokens. The harder the problem, the longer the reasoning and the greater the consumption;
- Large output volume: the lecture note itself is an output of several thousand tokens, plus any multiple rounds of revision;
- Retry on failure: truncated output, non-compliant structure, or reference errors all require a rerun, and retry costs are often overlooked.
So when evaluating cost, you cannot look only at input length; you have to look at “tokens consumed per unit of useful output.” A practical metric for a model’s value for money is: the total number of tokens consumed to complete a task at equal quality.
Methods for Cost and Budget Estimation
Billing rules vary by provider, but the general model is as follows:
Total task cost = number of calls × (input tokens × input price + output tokens × output price)where:number of calls = number of cases × (1 + retry rate)output tokens include both the model's reasoning tokens and the final answer tokens
Example code:
# Example code: cost estimation for an evaluation taskdef estimate_cost(cases, avg_in_tokens, avg_out_tokens,retry_rate, price_in, price_out):"""cases : number of evaluation casesavg_in_tokens: average input tokens (prompt + context)avg_out_tokens: average output tokens (including the reasoning process)retry_rate : expected retry ratio, e.g. 0.2 means 20% of cases must be rerunprice_in : input price (per 1,000 tokens)price_out : output price (per 1,000 tokens)"""calls = cases * (1 + retry_rate)return calls * (avg_in_tokens / 1000 * price_in+ avg_out_tokens / 1000 * price_out)
When estimating, you should also factor in the “quota headroom.” Some services grant monthly points or quotas, and different models have different consumption multipliers; when processing a large batch of long-document tasks at once, you can exhaust the quota in a short time. Reasonable practices include:
- Estimate tokens and cost per task, and set quota-warning thresholds;
- Prioritize assigning high-difficulty, high-value tasks to models with strong reasoning ability;
- Route routine tasks to lightweight models to form tiered scheduling;
- Watch for peak-hour queuing and rate limiting, and when necessary, make tasks asynchronous with retry backoff.
From One-Off Evaluation to Engineering Deployment
Tiered Routing: Matching Tasks to Models
After evaluation is complete, the most valuable output is not a ranking but a routing strategy:
- Light tasks (summarization, rewriting, extraction, classification): low-latency, low-cost lightweight models;
- Medium tasks (code generation, structured extraction, routine analysis): models with balanced general capability;
- Heavy tasks (complex proofs, long-document writing, deep reasoning): models with strong reasoning and support for long contexts.
Observability and Continuous Optimization
Once integrated into production, you need an observability system covering metrics such as request volume, success rate, latency, token consumption, and retry rate, and you should use logging and monitoring alerts to catch anomalies promptly. When a new model goes live, you can first validate it with a small-percentage canary release, then gradually ramp up traffic based on user feedback.
Prompts and Workflows Are Themselves “Capability Amplifiers”
An often-overlooked conclusion is that the same model can perform very differently under different prompt engineering. Upgrading a prompt from “a single sentence” to a structured template of “role + task + constraints + output format + acceptance criteria” often produces a more immediate improvement than switching to a different model.
For teams with limited budgets that cannot easily build a large-scale evaluation environment, a good starting point is to get directional references from public benchmarks and community discussions, then use a small, self-built private evaluation set to verify whether those findings apply to their own scenarios. Cloud model platforms such as Baidu AI Cloud provide unified access to multiple mainstream models along with supporting toolchains, which can help developers compare models, route requests, and control costs under a single interface and metering system, lowering the engineering barrier to selection and integration.
Conclusion
- A single case is not enough to evaluate a model. Math reasoning has randomness, surface-level correctness, and data-contamination risks, so reliable conclusions require a tiered problem set, unified scoring, and reproducible experiments.
- Long-document ability needs engineering support. Combining structured prompts, segmented generation, automated validation, and manual spot checks is what turns “occasionally right” into “reliably delivered.”
- Let data speak about value for money. Using “tokens consumed per unit of useful output” as the core metric, together with tiered routing and quota governance, is more meaningful than comparing unit prices or points alone.
- Evaluation is a continuous process. The problem set must be refreshed, parameters must be fixed, results must be reproducible, and models must be regression-tested after each iteration.
For developers, what is truly worth investing in is not asking “which model is the strongest,” but building a reproducible, comparable, and sustainable evaluation and scheduling system, so that every selection decision is grounded in evidence.
