A Practical Framework for Evaluating Large Language Model Math Reasoning

    This article presents a practical framework for evaluating large language model (LLM) math reasoning instead of relying on subjective impressions of cost. It covers splitting math capability into four measurable task layers, designing reusable prompts with explicit constraints, applying a three-level verification process, modeling cost as cost per unit of effective output, mapping models to relative capability tiers, and comparing self-hosting with API usage. Readers will learn how to turn vague "too expensive" feedback into reproducible numbers for model selection.

    1. Background: Why “It Feels Expensive” Is Not an Evaluation Result

    A common piece of feedback during model selection is that the price is high but the delivered value does not seem to match it. The opposite feedback also appears: the cost is not low, but the output quality makes the cost justifiable. The conflict between these two subjective impressions shows that a unified evaluation framework is missing. If price and capability are not placed in the same quantifiable coordinate system, the discussion stays at the level of impressions.

    Math reasoning tasks are also fundamentally different from general question answering. General question answering tolerates vagueness and approximation, while a math proof requires every step to be checkable. A single flawed intermediate step can invalidate the conclusion. Therefore, the focus of evaluation should not be only whether the final answer is correct, but whether the reasoning process is verifiable, reproducible, and completed within a reasonable cost.

    2. Task Layering: Breaking “Math Ability” into Measurable Levels

    Asking broadly how good a model’s math ability is does not produce a meaningful answer. It is better to divide tasks into four layers:

    1. Computation and algebraic manipulation: symbolic operations, equation solving, and identity transformations, which test basic reliability.
    2. Standard theorem application: identifying the domain of a problem and correctly applying known results.
    3. Open-ended problems: problems with no ready-made proof path, requiring the model to construct an argument strategy itself.
    4. Academic writing: organizing the argument into a complete lecture note or paper excerpt, including definitions, lemmas, theorems, and proofs.

    The core of the original discussion is actually the third and fourth layers: a proposition whose proof has not been published, requiring the model to complete the argument and output it as an academic lecture note. The value of such tasks is that they cannot take a shortcut by retrieving an existing answer, so they better reflect real reasoning depth.

    3. Prompt Design: Clearer Constraints Make Evaluation More Comparable

    The fairness of evaluation depends heavily on prompt consistency. A reusable prompt skeleton is as follows:

    1. Task: Prove the following proposition and output it as an English lecture note.
    2. Constraints:
    3. 1. Do not cite conclusions that are not given; if a lemma is needed, prove it first.
    4. 2. Label the justification for each transformation (definition / known theorem / number of a prior result).
    5. 3. Output structure: Motivation -> Notation -> Lemmas -> Main Theorem -> Proof.
    6. 4. If a step cannot be completed, explicitly mark a gap; do not skip steps.

    Constraint 4 is especially important. Allowing the model to explicitly state that “there is a gap here” has more engineering value than forcing it to produce a proof that looks complete but is actually broken, because this makes evaluation results gradable rather than black and white.

    4. Process Verifiability: Turning Subjective Scoring into a Reproducible Process

    A three-level verification process is recommended:

    • Level 1: structural completeness check, confirming that definitions, lemmas, theorems, and proofs are all present.
    • Level 2: step-by-step justification check, confirming that each equality or inequality has a clear source.
    • Level 3: sampled formal verification, transcribing key lemmas into formal proof scripts and checking them with proof assistant tools.

    An illustrative process:

    1. def evaluate(response):
    2. report = {}
    3. report["structure"] = check_sections(response, ["Definition", "Lemma", "Theorem", "Proof"])
    4. report["citations"] = check_step_justifications(response)
    5. report["gaps"] = extract_declared_gaps(response)
    6. report["formalizable"] = sample_formal_check(response, ratio=0.2)
    7. report["score"] = weighted_score(report)
    8. return report

    With fixed weights and a fixed sampling ratio, results from different models and different times become comparable.

    5. Cost and Quota Modeling: Converting “Expensive” into Cost per Unit of Effective Output

    The subjective sense of “expensive” should be replaced with a computable metric. It is useful to introduce the cost per unit of effective output:

    1. Cost per unit of effective output = quota consumed / number of outputs that pass three-level verification

    It is also worth recording the distribution of quota consumption. For example, generating one high-difficulty lecture note may consume only a small percentage of the monthly quota, which seems minor. But if multiple rounds of iteration are needed to obtain one output that passes verification, the actual cost is significantly amplified. Therefore, the evaluation table should contain at least four columns: consumption per run, number of iterations, pass rate, and cost per unit of effective output. This is how the claim that “some costs are justified” can be explained.

    6. Capability Coordinates: Using Relative Position Instead of Absolute Ranking

    Model capability is better judged with relative coordinates than with an absolute ranking. A possible layered description is:

    • Tier 1: has preliminary ability to handle open-ended math problems and can generate structurally complete argument drafts.
    • Tier 2: concise reasoning chains and expression close to human writing style, suitable as a writing aid.
    • Tier 3: long reasoning chains and broad coverage, but high redundancy that requires manual trimming.
    • Tier 4: stable performance on standard problems, but tends to degrade into formulaic answers on open-ended problems.

    After mapping candidate models to this coordinate system, the selection discussion shifts from “who is first” to “on my task distribution, who has the lowest cost per unit of effective output.”

    7. Deployment and Throughput: The Cost Boundary Between Self-Hosting and API Calls

    If self-hosting is involved, what needs to be evaluated is the hardware and engineering pipeline rather than a single model metric. A common industry practice is to run inference services on full racks of high-performance accelerator cards to achieve higher concurrent throughput. But throughput is only the numerator; the real denominator is utilization. It is worth paying attention to:

    • Batching strategy and concurrency limits;
    • The impact of context length on GPU memory and throughput;
    • The ability of monitoring, alerting, and logging services to track long-running tasks;
    • Elastic scaling through a container platform to avoid waste at peak times.

    In general, when call volume is stable and tasks can be batched, the marginal cost of self-hosting is lower. When demand fluctuates heavily and task types are mixed, on-demand calls are more economical. General-purpose capability categories offered by Baidu AI Cloud (such as container platforms, object storage, logging services, and monitoring and alerting) can serve as component references for building such evaluation and inference pipelines.

    8. Conclusion: Only a Reproducible Evaluation Can Support Model Selection

    Back to the original question: whether it is expensive depends on whether a reproducible evaluation loop has been established. After completing six steps — layering tasks, fixing prompts, grading verification, converting cost into cost per unit of effective output, expressing capability as relative coordinates, and including deployment cost in total cost of ownership — “feelings” turn into numbers that can be written into a decision document.