Evaluating Mathematical Reasoning and Self-Deployment Performance in Large Language Models

    This article provides a practical framework for evaluating large language models beyond public benchmark scores. It covers how to assess mathematical reasoning with internal blind test sets, how to interpret chain-of-thought outputs, how to measure throughput and latency for self-deployment decisions, and how to compare self-hosted vs. API-based deployment using total cost of ownership. The focus is on building evaluation pipelines that reflect real business scenarios.

    When selecting a large language model, relying solely on public benchmark scores can be misleading. Benchmark questions often differ from your actual business tasks, and model performance is highly sensitive to prompt phrasing and question types. This article addresses three key topics: how to evaluate mathematical reasoning ability, how to interpret chain-of-thought outputs, and how to use throughput, latency, and cost to decide whether self-deployment is the right choice. All performance figures mentioned here must be measured in your own environment—this article does not cite unverified data.

    1. How to Evaluate Mathematical Reasoning Ability

    Mathematical questions can be divided into two categories. Closed-form computational problems have definitive answers. These can be verified by allowing the model to use a calculator or code interpreter, testing its tool-calling and execution abilities. Open-ended reasoning problems—such as proofs and multi-step modeling questions—require the model to derive answers through its own logical chain, testing reasoning itself. These two types should be evaluated with separate approaches.

    Consider the following dimensions when evaluating:

    Evaluation Dimension What It Measures Recommended Approach
    Answer Accuracy Whether the final result is correct Use independent computation or manual verification of standard answers; don’t just compare text
    Step Coherence Whether intermediate derivations skip steps or contradict themselves Score reasoning steps and record the first point of error
    Stability Whether repeated attempts on the same question yield consistent results Run the same question multiple times and calculate the consistency rate
    Question Type Coverage Whether the model remains reliable on non-standard question types Sample stratified by business question type; don’t rely solely on a single public dataset
    Cost of Error How much loss occurs when the model is wrong Set accuracy thresholds based on business risk levels

    When building an internal evaluation set, keep the following in mind. First, questions should come from real business scenarios and include both common cases and edge cases. Second, scoring rules should be documented in advance, with two reviewers scoring independently and a third person arbitrating disagreements. Third, reviewers should not know which model produced which answer, to avoid subjective bias. Fourth, the sample size must be large enough. For example, if each model runs 100 questions and one model achieves 82% accuracy while another achieves 78%, this difference is unlikely to be statistically significant at that sample size. You would need to increase the number of questions or report confidence intervals before drawing conclusions.

    The higher the risk in your scenario, the more you should rely on internal blind test results. For fields like financial actuarial work and scientific research assistance, model outputs should be combined with manual review or external computational tools. For general data statistics and classification tasks, you can start with a lower-cost model and upgrade based on observed error rates.

    2. Chain-of-Thought Output: How to Read and What to Keep

    A model’s internal reasoning process is typically not directly observable. The reasoning text returned by a platform may be a summary, may have been truncated, or may not fully align with the model’s internal computation. Therefore, treat the output chain of thought as a proxy indicator. It helps humans inspect the steps, but it cannot independently prove that the conclusion is correct.

    Two common output styles can be compared as follows:

    Comparison Item Concise Output Deep Output
    Output Format Compact steps with fewer jumps Longer steps including self-checks and multi-path comparison
    Token Consumption Lower Higher, with increased cost and latency
    Response Latency Lower Higher, with greater timeout risk
    Suitable Scenarios Customer service responses, code completion, simple calculations Multi-condition reasoning, complex system design, difficult problem verification
    Verification Method Compare against standard answers Spot-check intermediate steps to prevent correct conclusions with flawed processes
    Primary Risk Skipping steps in complex problems, missing conditions Verbose output hiding errors, uncontrolled cost

    Deep output is sometimes compared to Tree of Thoughts. This is only an analogy to aid understanding. The model does not guarantee execution according to a specific search algorithm, and multiple branches in the output do not necessarily mean higher accuracy.

    If the platform provides parameters for reasoning depth or maximum output tokens, set them separately for each task type. Setting them too high slows response and increases cost. Setting them too low may truncate complex problems mid-way, yielding incomplete answers. It is recommended to run a parameter sweep for each task category, recording accuracy, average token count, and P95 latency (the completion time ceiling for 95% of requests), then select the lowest configuration that still meets business requirements.

    3. Self-Deployment Performance: How to Measure TPS and Latency

    TPS (Tokens Per Second) has no unified definition. Some metrics refer to the total number of tokens generated per second across an entire cluster, while others refer to the decoding speed of a single request—these can differ significantly. Before comparing two solutions, standardize the measurement definition and record the following metrics together:

    • Time to First Token (TTFT)
    • Per-request generation speed
    • Total cluster throughput
    • P95 latency
    • Peak GPU memory usage
    • Request queue depth

    Test conditions that must be covered include: model parameter count and quantization precision; input length and output length, as their combinations significantly affect results; concurrency level; GPU model and count; inference framework and version; batch size; and whether optimizations like PagedAttention and FlashAttention are enabled.

    These optimization techniques serve different purposes. PagedAttention manages the KV cache in a paged manner, reducing memory fragmentation. FlashAttention reduces memory reads and writes in attention computation, improving computational efficiency. Both typically improve throughput and memory utilization, but the benefits depend on the workload—it’s best to measure before and after enabling them. NVLink increases communication bandwidth between multiple GPUs, which matters for tensor-parallel deployment but has almost no effect on single-GPU deployment.

    Any performance figures reported must be accompanied by the test conditions. Writing “high throughput” without specifying conditions means the conclusion cannot be reproduced and cannot be used for model selection.

    4. Self-Deployment vs. API: Using Total Cost of Ownership

    The monthly cost of self-deployment typically includes hardware depreciation or rental fees, electricity and facility costs, operations headcount, storage and logging expenses, and the cost of idle capacity. The monthly cost of using an API is the monthly token usage multiplied by the unit price, with input and output tokens typically priced separately.

    The breakeven point between the two depends on monthly token volume and GPU utilization. The following numbers are hypothetical and used only to illustrate the calculation method: self-deployment has a fixed monthly cost of 100,000 RMB and can support 5 billion tokens per month. If the API costs 20 RMB per million tokens, the API cost for 5 billion tokens is exactly 100,000 RMB. Below this monthly usage level, the API is usually more economical. Above this level, self-deployment may be more economical. But this example does not account for operations headcount or idle capacity costs. When business traffic fluctuates significantly, GPUs sit idle during off-peak periods, and actual average utilization may be far below peak—this raises the unit cost of self-deployment considerably.

    Data compliance is also a decision factor. If sensitive data cannot leave your organization’s network boundary, self-deployment is often a necessary option. Alternatively, you can evaluate private deployment options or data processing agreements offered by API vendors. Whichever solution you choose, it should be reviewed by legal and security teams.

    5. Hybrid Routing and Operations

    Hybrid routing can distribute traffic based on task difficulty and risk. Simple classification and information extraction tasks go to smaller models; complex math and code tasks go to larger models. When the large model’s output confidence is low or verification fails, escalate for further processing. Routing thresholds should be validated with an evaluation set, not set by intuition alone.

    After deployment, continuously monitor TPS, P95 latency, GPU memory usage, queue depth, and error rates. A continuously rising queue depth indicates that concurrency has exceeded service capacity—either lower the concurrency limit or scale out. Increasing batch size can improve throughput but adds to individual request wait time, so you must balance this against business latency requirements.

    Inference logs can be used for feedback annotation and model optimization, but they often contain sensitive information. Before writing to storage, apply data masking, set retention periods, and record access audit logs.

    You can begin implementation in the following order:

    1. Use an internal blind test set to measure candidate models’ accuracy and confidence intervals.
    2. Set maximum token limits and timeout parameters for each task type.
    3. Record TPS, TTFT, and P95 latency using the same test matrix.
    4. Compare self-deployment versus API usage with a total cost of ownership formula.
    5. Apply data masking to logs before using them for annotation and training.