LLM Mathematical Reasoning Evaluation and Self-Hosting vs. API Selection: A Practical Guide

    This article explains how teams should evaluate large language models for mathematical reasoning and choose between self-hosting open-weight models and using closed APIs. It covers tiered evaluation goals, representative and private test sets, Pass@k and step-level accuracy, compressed versus detailed chain-of-thought, reproducible throughput testing, total cost of ownership comparison, acceptance thresholds, rollback plans, and scenario-based recommendations for research, production, education, and high-risk financial modeling.

    1. Define Evaluation Goals Before Discussing Model Rankings

    Before selecting a model, teams should answer one question: what kind of mathematical problems does the model need to solve? Leaderboard scores come from someone else’s test conditions and may not match your problem types, input lengths, or tolerance requirements. Evaluation should start from the business need, not from a ranking.

    Mathematical ability falls roughly into three levels. The first level is basic computation and formula invocation, mainly testing knowledge from high school to early college. Standard problem sets are commonly used here. The second level is competition-style problems, which require auxiliary line construction, algebraic transformations, and the combined use of multiple theorems. The third level is open-ended problems, where the model must define intermediate quantities, build a proof framework, and sometimes propose new lemmas. Different businesses fall into different levels, so the evaluation set should be adjusted accordingly.

    When building an evaluation set, cover the following:

    • Data set: sample problems from real business scenarios and keep a portion of private, undisclosed problems.
    • Problem type distribution: sample according to the proportion of each problem type in the business. Avoid using only easy problems or only hard problems.
    • Pass@k: allow the model to generate k answers for the same problem. If any one answer is correct, count it as a pass. Report the value of k so results can be compared across models.
    • Step accuracy: check not only the final answer but also whether each derivation step holds.
    • Human audit criteria: define in advance what counts as a passing proof. Have at least two reviewers score independently and arbitrate when they disagree.
    • Contamination check: confirm that test problems did not appear in the model’s training data. Approximate deduplication or paraphrasing can be used for detection.
    1. Understand the Two Chain-of-Thought Styles

    Models often have very close accuracy rates on math problems. The real difference appears in the style of their chain-of-thought. One type of model generates highly compressed derivations and gives only the key steps. Another type produces detailed draft-style reasoning and writes out every step.

    Each style has trade-offs. Compressed reasoning is efficient and uses less context, making it suitable for automated tasks with frequent scheduling. But when the solution is wrong, users may find it difficult to locate the error in the shortened process. Detailed reasoning is easier to audit and useful for teaching explanations. Even if the conclusion is wrong, the specific step can be identified. The cost is higher latency, and long chains are more likely to accumulate context drift errors.

    Neither style is absolutely better. Automated grading and batch solving can favor the compressed style. High-value decisions that require human review, or scenarios that need to explain the process to students, are better suited to the detailed style.

    Mid-sized models also deserve attention. They perform stably on most standard tests, but in multi-hop reasoning they may show “intermediate-state hallucination”: local calculations are correct, but the overall strategy is wrong. Such issues are easily missed in conventional evaluations, so multi-hop problems should be specifically designed into the evaluation set to expose them.

    1. How to Measure Inference Throughput

    The industry often hears claims such as “a rack can reach hundreds of tokens/s.” This number usually comes without the hardware model, model parameter count, batch size, sequence length, quantization precision, and inference engine version. It cannot be reproduced and is difficult to use directly for selection. During procurement or planning, ask the vendor or internal team for complete test conditions. If these conditions are unavailable, do not cite the number.

    Teams can run their own stress tests as follows:

    1. Fix the hardware, drivers, and inference engine version, and record the version numbers.
    2. Set the batch size and input/output sequence lengths to cover typical and peak business values.
    3. Record output tokens/s and P95 latency. P95 latency reflects the user experience better than average latency.
    4. Repeat each condition three times and take the median as the result.
    5. Record memory usage and GPU utilization at the same time to help identify the bottleneck.

    Stress test results sometimes show that the bottleneck is not the compute unit. Under some engine and model configurations, the bottleneck may shift to network bandwidth, memory capacity, or request scheduling policy. Such judgments must be confirmed through profiling, not concluded from experience alone.

    1. Self-Hosting or API: Compare with Total Cost of Ownership

    The value of self-hosting comes from a change in cost structure, but it does not materialize automatically. APIs charge by call volume and carry low operational burden. Self-hosting requires hardware purchase or rental, electricity, data center space, operations labor, and work on model upgrades and security patches.

    When comparing the two, calculate total cost of ownership (TCO):

    API monthly cost = monthly tokens × unit price + other fees

    Self-hosted monthly cost = hardware depreciation or rental + electricity and data center fees + allocated operations labor + other fees

    Self-hosted unit cost = self-hosted monthly cost ÷ actual effective output tokens produced per month

    The key variable is hardware utilization. If the average daily call volume is not enough to keep the hardware fully loaded for long periods, the self-hosted unit cost will rise significantly and may exceed the API cost. Only when call volume, context length, and hardware utilization all reach measurable levels can self-hosting potentially have a cost advantage. Use your own real usage data rather than applying someone else’s conclusions.

    The following table compares the two models:

    Dimension Closed API Self-hosted open-weight model
    Initial investment Low High; requires hardware and deployment work
    Unit cost Grows approximately linearly with call volume Depends on utilization; may decrease at scale
    Data compliance Depends on provider terms and regional deployment Data can remain in the internal environment
    Controllability Model version and behavior are determined by the provider Can be fine-tuned and model version can be pinned
    Operational burden Low High; includes monitoring, scaling, and security updates
    Licensing Used under service terms Must check commercial conditions of the open-weight license
    Exit cost Migration requires interface changes; prompts and results must be revalidated Model can be retained, but the inference deployment stack must be migrated

    The spread of open-weight models may also change the pricing landscape. When open models approach closed models on specific capabilities, cloud providers and hardware vendors can offer managed inference services, giving users more choices. Whether this happens depends on model performance, license terms, and the team’s operational capability; it cannot be generalized. Selection should also consider community activity. An active community can support private adaptation and secondary development when official iteration slows.

    1. Acceptance Thresholds and Rollback Plans

    Model selection is not a one-time decision. Before launch, set clear acceptance thresholds and prepare a rollback path.

    At minimum, set the following metrics:

    • Accuracy degradation limit: use a baseline model or human results as the reference and set an acceptable drop. The business side should determine the threshold based on the cost of errors.
    • Unit request cost limit: calculate cost per thousand tokens or per request. Exceeding the limit should trigger review.
    • P95 latency limit: beyond this value, user experience will noticeably degrade.
    • Throughput floor: must meet peak-hour request volume.
    • Error rate and refusal rate: monitor failures in model output.

    Launch in three steps. First, use a small percentage of traffic for a canary release and observe metrics for one to two business cycles. After metrics are stable, expand the scope gradually. Keep the old solution at every stage so you can switch back quickly.

    Rollback conditions should be documented in advance. For example, if accuracy remains below the threshold for consecutive periods, P95 latency consistently exceeds the limit, or the provider changes the API, switch back to the old model or old API immediately and record the cause of the incident for the next selection cycle.

    1. Conclusions and Selection Recommendations

    Mathematical reasoning capability should be evaluated from three dimensions. Benchmark scores reflect static capability, chain-of-thought quality reflects the reliability of the reasoning process, and inference throughput reflects engineering cost. No model currently leads on all three dimensions. The core of selection is trade-offs.

    Recommendations by scenario:

    • Research and advanced theoretical validation: focus on whether the model can generate proof steps that experts can verify. The chain-of-thought should be detailed for auditing.
    • High-concurrency production environments: first build an evaluation set that matches the problem distribution and confirm that accuracy degradation is within acceptable business limits. Then compare tokens/s and P95 latency across candidate models and choose the option with the lowest unit cost.
    • Education applications: prioritize models with complete derivation chains and clear logic so teachers can demonstrate the problem-solving process.
    • Financial modeling and other high-risk scenarios: in addition to evaluating accuracy, check data compliance and audit requirements, and include human review in the workflow.

    As inference costs fall, mathematical reasoning capability will become more widespread. At that point, the metrics that distinguish models may shift to robustness on long-tail problems and fused reasoning over multimodal information such as charts and geometric figures. Teams should establish a sustainable approach as early as possible.