Evaluating Large Language Models and Inference Costs: A Practical Guide

    Every year brings new large language models, and with them a fresh wave of comparisons. But these debates often break down because the evaluation setups differ in test sets, sampling strategies, engineering conditions, and model versions. This article proposes a reproducible, layered framework for evaluating model capability, explains why open-ended math problems are strong probes of reasoning, treats chain-of-thought behavior as both a cost and a quality signal, and breaks down the economics of throughput, latency, and inference cost. It then covers when to self-host versus use cloud inference, how to route requests across model tiers, and a practical roadmap from selection to production—shifting the discussion from "which model is stronger" to "which approach fits a given task, protocol, and cost constraint."

    1. Reframing the Problem: Why Model Capability Debates Get Distorted

    New large models ship every year, and the community’s comparisons multiply right along with them. Most arguments boil down to two kinds: first, “which model leads on some class of complex reasoning task, and by how much”; and second, “can open-weight inference deployment offer a real advantage on cost and self-controlled ownership.” Around the second kind, specific numbers circulate too—for example, the claim that a high-end accelerator rack cluster pushes a model’s per-request output speed into the hundreds of tokens per second.

    The debates themselves are not strange. The problem is that the comparison criteria are inconsistent:

    • Different test sets: question banks vary in difficulty, domain, and degree of contamination.
    • Different sampling strategies: some take a single result, others sample multiple times and keep the best.
    • Different engineering conditions: quantization precision, inference frameworks, and concurrency levels all differ.
    • Different versions: generational differences within a single model family are sometimes larger than differences between families.

    Even if we narrow the discussion to math, two task types need to be separated:

    1. Closed problems: with a unique or small set of definite answers, which can be checked automatically with a grading script.
    2. Open problems: with no ready-made solution, requiring the model to first form an approach and then produce a complete proof or derivation. Whether the answer is correct must be judged by a human or a formal tool.

    Mixing these two task types and drawing conclusions from a single score easily yields the simplistic judgment of “who is stronger,” while failing to answer what engineering actually cares about:

    • What capability does the target business scenario need?
    • Is self-hosting mandatory?
    • Are the throughput and cost of self-built inference controllable?
    • Within acceptable latency, how much concurrency and context length can it support?

    This article tries to move the discussion from “who is stronger” to “which approach is more appropriate under a given task, a given protocol, and a given cost constraint.”

    2. Layered Capability Evaluation: Building a Reproducible Benchmark

    2.1 Evaluation dimensions: decomposing “intelligence” into measurable metrics

    Model capability is not a single scalar. At minimum, evaluate it along four dimensions:

    • Correctness: whether answers are correct, proofs are rigorous, and reasoning contains no logical gaps;
    • Stability: how consistent the model is across repeated attempts at the same problem, best measured by pass rate over multiple independent samples;
    • Efficiency: the input and output tokens consumed to complete the same task. Longer output means higher inference time and cost;
    • Controllability: whether the model follows format constraints, cites given material, calls external tools, and stays honest about conclusions it is unsure of.

    2.2 Evaluation protocol: fixing conditions so results can be compared

    Reproducible evaluation at least requires fixing the following conditions:

    1. Fix the version and quantization: record the model version, quantization precision, and inference framework version for every evaluation.
    2. Fix the question set: stratify by question type, difficulty, and domain. It should include at least three categories—basic arithmetic and algebra, competition problems requiring multi-step derivation, and open problems at university level and above.
    3. Fix the sampling parameters: specify temperature, top-p, maximum output length, and repeat count. An example configuration follows:
    1. # Illustrative config: tune parameters per task; this is not a specific product's API
    2. EVAL_CONFIG = {
    3. "temperature": 0.0, # prefer deterministic output for closed problems
    4. "top_p": 1.0,
    5. "max_output_tokens": 32768,
    6. "n_samples": 5, # multiple samples to estimate stability
    7. "seed": 42,
    8. }
    9. def pass_at_k(results, k):
    10. """Pass if at least one of the k independent attempts is correct."""
    11. passed = sum(1 for r in results if r["correct"])
    12. return passed > 0
    1. Double-blind cross-evaluation: when scoring by hand, hide model names, shuffle output order at random, and have multiple reviewers score independently, to eliminate brand bias and position bias.
    2. Consistency checks on results: for numerical answers, use symbolic computation tools to verify equivalence; for proof answers, check whether key steps hold and whether there are skipped steps or circular reasoning.

    2.3 Moving from offline evaluation to real business evaluation

    Public question sets only demonstrate general capability; they cannot answer “is this model suitable for our business.” A more reliable approach is to sample a batch of typical requests from real business—such as math tutoring solutions, code review, technical document generation, and compliance review—build an internal evaluation set, and continuously track the following metrics after launch:

    • task success rate;
    • human correction rate;
    • average response latency;
    • token consumption per call.

    3. Open Math Problems: A High-Difficulty Probe of Reasoning Ability

    3.1 Why open math problems are so hard

    There are three reasons to use open math problems as a capability probe:

    • They require the model to combine knowledge, long-horizon planning, and rigorous logic at once, so it cannot bluff its way through with pattern matching in the short term.
    • They follow no fixed routine, so the model must genuinely “think it through” to produce a complete derivation.
    • They are closely tied to applications such as formal verification, theorem proving, and research assistance, which makes their evaluation value high.

    The difficulty can be broken down further into four stages:

    1. Understanding and modeling conditions: identifying implicit conditions from natural language and completing the mathematical modeling;
    2. Path planning: filtering a viable approach from a vast solution space;
    3. Long-horizon reasoning: maintaining logical consistency over dozens or even hundreds of reasoning steps without losing intermediate conclusions;
    4. Self-verification: spotting errors, backtracking, and correcting them, using external tools such as symbolic computation or numerical experiments to check key steps when necessary.

    Stages 3 and 4 are the most demanding on model capability. The higher the difficulty, the more easily subtle early deviations get amplified in later steps, and the final conclusion can drift as a result.

    3.2 Verification difficulty amplifies the evaluation challenge

    Open problems have no standard answer, so evaluators must judge:

    • whether the proof is rigorous;
    • whether any special cases are missing;
    • whether there is circular reasoning that “looks correct but is actually invalid.”

    As a result, there are two ideal evaluation approaches. One is to collaborate with domain experts in mathematics to build a question bank with reference solutions and scoring rubrics. The other is to use formal proof tools for machine verification of the parts that can be formalized. The latter gives objective judgments but places high demands on how the problem statement is expressed, and its deployment cost is not low.

    A common engineering compromise is “automatic grading plus expert spot-checks”: fully verify questions that can be checked automatically, and have experts sample and review the more subjective questions against a unified scoring rubric.

    4. Analyzing Chain-of-Thought Behavior: From “Longer” to “More Reliable”

    4.1 Models with similar capability do not necessarily share the same chain of thought

    Among comparable models, differences in chain-of-thought behavior mainly show up in three areas:

    1. Different length and complexity: some models lean toward lengthy, multi-branch thinking and repeatedly try several approaches; others go straight to the main line of reasoning with fewer intermediate steps.
    2. Different expression styles: some outputs read more like natural writing, with terminology and phrasing closer to human habits; others are more formulaic and template-like.
    3. Different error modes: some show calculation mistakes, some miss boundary conditions, and others misuse premises.

    4.2 Treating chain of thought as a cost and quality signal

    The key insight is: chain-of-thought length and final accuracy are not always aligned. Longer does not necessarily mean stronger, and shorter does not necessarily mean weaker. A better way to read chain-of-thought length is as:

    • A cost signal: output tokens are roughly proportional to inference time, so a longer chain of thought means a higher cost per request;
    • A quality signal: final-answer accuracy, consistency across multiple samples, and human review scores say more about quality than “how much it thought.”

    For open math problems, a phenomenon worth noting is that the “length–benefit” relationship is not linear: as the output budget grows, accuracy often rises noticeably at first and then gradually plateaus after reaching a certain level. So there are two engineering principles:

    • Set output length caps per task tier. Keep routine tasks within a shorter budget, and only relax it for high-difficulty tasks;
    • When resources are ample, let the model sample multiple reasoning paths in parallel and then select the final answer with a verifier or majority vote. This “generate–verify–select” pipeline is usually more cost-effective than simply lengthening a single reasoning chain.

    4.3 Evaluating writing style comes down to facts and logic

    In scenarios like copywriting and technical documentation, style directly affects readability and professionalism, and can be evaluated from four angles:

    • Structure: whether the arguments are clear and the paragraphs are coherent;
    • Accuracy: whether terminology is used correctly and whether there are factual errors;
    • Style consistency: whether it can keep producing output in a specified style;
    • Factual reliability: whether cited data and conclusions are traceable.

    When evaluating, score “fluent expression” separately from “reliable content” to avoid letting an ornate style mask factual errors. For content involving numbers, dates, and citations, bring in external retrieval or human verification.

    4.4 Error bars: do not over-interpret small gaps

    A single evaluation result has inherent randomness. For two evaluations, we can make the following estimate:

    1. import math
    2. def standard_error(accuracy: float, n: int) -> float:
    3. """Sampling standard error estimate for a proportion."""
    4. p = max(min(accuracy, 1.0), 0.0)
    5. return math.sqrt(p * (1 - p) / n)
    6. # Illustration: 200 questions at 80% accuracy gives a standard error of ~2.8 points.
    7. # The approximate 95% interval uses 1.96 * se, i.e. about ±5.5 points.
    8. p, n = 0.8, 200
    9. se = standard_error(p, n)
    10. print(f"Estimate: {p:.1%}, SE: {se:.2%}, ~95% interval: [{p - 1.96 * se:.1%}, {p + 1.96 * se:.1%}]")

    When the score gap between two models is smaller than the width of their confidence intervals, strictly speaking you cannot yet conclude which one is stronger. Therefore:

    • when comparing model quality, report both the score gap and the confidence interval;
    • when the question set is too small, the reliability of the conclusion is quite limited.

    5. Inference Economics: What Drives Throughput, Latency, and Cost

    5.1 Architecture: look at total and activated parameters separately

    In recent years, mainstream large models have widely adopted the Mixture-of-Experts (MoE) architecture: the model contains many expert subnetworks, and each token activates only a subset of them. A direct consequence is a separation between total parameter count and activated parameter count:

    • Total parameter count determines memory footprint and weight-loading overhead, which affects the hardware scale needed to hold the model;
    • Activated parameter count determines the compute per token, which in turn affects throughput and latency.

    This characteristic leads to two conclusions that are often overlooked:

    1. Generation speed cannot be judged by total parameter count alone. A MoE model with a very large total parameter count, if it activates only a smaller subset per step, may decode faster under the same hardware than a dense model with a smaller total parameter count where all parameters participate in computation.
    2. Concurrency capacity cannot be judged by generation speed alone. In batch inference, different tokens in a MoE model may route to different experts, causing load imbalance across experts and extra communication overhead. As concurrency rises, actual throughput growth is often non-linear.

    5.2 The two stages of inference serving and their key metrics

    Large-model inference is usually split into two stages:

    • Prefill: processing all input tokens in parallel. It is compute-intensive and mainly affects time to first token (TTFT);
    • Decode: generating output autoregressively, token by token. It is memory-bandwidth-intensive and mainly affects time per output token (TPOT) and end-to-end latency.

    Common service-level metrics include:

    • Throughput: total tokens processed per second, which determines the per-token cost;
    • TTFT: time from issuing a request to receiving the first token, which affects perceived responsiveness;
    • TPOT: average time to generate each token during the output stage, which affects the reading experience;
    • Tail latency: metrics such as P95 and P99 latency, which determine service stability at peak times.

    There are clear tradeoffs among these metrics. A single request can chase extremely low latency, but GPU utilization stays low; increasing batch size can significantly raise total throughput and dilute per-unit cost, at the price of higher per-request latency. So there is no universal “best solution”—only configurations that match the business SLA.

    5.3 Common techniques for raising throughput and lowering latency

    • Paged KV-cache management: split the cache into fixed-size blocks allocated on demand, reducing memory fragmentation and increasing the number of concurrent sequences that fit;
    • Continuous batching: requests dynamically join or leave the batch at each decode step, avoiding compute idling caused by waiting for the whole batch to finish its longest sequence;
    • Prefix caching: compute shared prefixes such as system prompts and long documents only once and reuse the result across requests, which can significantly cut prefill overhead;
    • Quantization: represent weights or cache at lower precision such as FP8, INT8, and INT4 to reduce memory footprint and improve memory-access efficiency, but the accuracy loss must be evaluated;
    • Speculative decoding: draft multiple candidate tokens with a small model or a specific strategy, then verify them in parallel with the large model, improving decode speed while keeping output quality essentially unchanged;
    • Parallelism strategies: tensor parallelism splits a single layer’s computation across multiple cards, while pipeline parallelism assigns different layers to different devices; both require balancing inter-card communication overhead against memory capacity.

    5.4 Converting from hardware to service throughput

    The industry claim that “a single-rack cluster accelerates model inference to hundreds of tokens per second” can be broken down into a verifiable estimation chain:

    1. Hardware conditions: a high-end accelerator rack cluster is typically equipped with high-bandwidth memory, large-capacity RAM, and high-speed inter-card interconnect;
    2. Model conditions: during decode, an MoE architecture only needs to read the selected experts’ parameters, easing the memory-bandwidth pressure of weight loading;
    3. Inference conditions: combined with optimizations such as paged caching, continuous batching, and speculative decoding, per-request decode speed can rise substantially.

    But two points must be stressed:

    • This number depends heavily on model size, quantization, batch size, and context length; a different configuration can change it dramatically, so it cannot serve as a general promise;
    • High per-request speed does not mean good overall economics. Chasing extreme per-request speed often requires more hardware, and the per-token cost may actually rise.

    When comparing options, look at two metrics at once: throughput per unit of hardware, and whether per-request latency meets business requirements.

    5.5 Cost estimation: doing the math properly

    1. def estimate_cost(
    2. qps: float, # average requests per second
    3. avg_input_tokens: int, # average input tokens
    4. avg_output_tokens: int, # average output tokens (including chain-of-thought)
    5. hourly_cost_per_card: float, # blended hourly cost per accelerator
    6. num_cards: int,
    7. utilization: float = 0.6, # effective utilization (batching efficiency, idle time, etc.)
    8. days: int = 365,
    9. ):
    10. """
    11. Illustrative estimate; all parameters must be calibrated against measured data.
    12. """
    13. total_tokens = qps * (avg_input_tokens + avg_output_tokens) * 86400
    14. annual_cost = hourly_cost_per_card * num_cards * 24 * days
    15. return {
    16. "annual_tokens": int(total_tokens),
    17. "annual_cost": annual_cost,
    18. "cost_per_million_tokens": annual_cost / total_tokens * 1e6,
    19. "effective_qps": qps * utilization,
    20. }
    21. result = estimate_cost(
    22. qps=5,
    23. avg_input_tokens=2000,
    24. avg_output_tokens=1500,
    25. hourly_cost_per_card=15.0,
    26. num_cards=16,
    27. )
    28. print(result)

    When estimating self-hosted cost, beyond the accelerator hardware itself, also account for:

    • electricity and data-center fees;
    • network and bandwidth fees;
    • operations and maintenance labor;
    • storage and logging fees;
    • repeated investment from model iteration and upgrades.

    6. Self-Hosted Deployment vs. Cloud Calls: How to Weigh Them

    6.1 When self-hosted inference makes sense

    Self-hosted inference usually offers better cost-effectiveness when the business meets the following conditions:

    • Large and stable request volume: predictable load with low fluctuation, so hardware utilization stays high;
    • Sensitive data: requirements that data stay within a domain, or that specific compliance needs be met;
    • Deep customization needed: fine-grained requirements on latency, throughput, or model behavior, such as a fixed model version or custom quantization and caching strategies;
    • The team has the capability: experience in inference deployment, performance tuning, and operations monitoring.

    Deploying the inference of open-source or open-weight models is essentially trading engineering effort for controllability. It brings benefits such as data residency, version locking, and custom optimization, but also carries the costs of hardware procurement, capacity planning, and ongoing tuning.

    6.2 When cloud calls make more sense

    Cloud inference services usually fit the following situations better:

    • request volume has clear peaks and troughs, so elastic scaling is more economical than fixed capacity;
    • the team lacks GPU-cluster operations experience and wants to validate business value quickly;
    • there is a need to use the latest model capabilities directly, without taking on model upgrades and deployment work;
    • the business is in an early stage, where usage patterns and shape are still uncertain.

    With a cloud approach, you can run inference services on a container platform, store models and datasets in object storage, collect request records with a logging service, and track latency and error rates with monitoring and alerting. Platforms such as Baidu AI Cloud also offer general cloud services for compute, storage, containers, and monitoring, and can serve as one infrastructure option.

    6.3 Hybrid architecture: tiered routing by task

    A more common practice is tiered routing:

    • Rule layer: simple Q&A and formatting tasks, handled by small models or templates;
    • Routine layer: everyday business requests, handled by tuned mid-sized models;
    • Hard layer: complex reasoning tasks, handed to the most capable model;
    • Fallback layer: when internal services are overloaded or unavailable, automatically switch to an external service.

    An example routing logic follows:

    1. from dataclasses import dataclass
    2. @dataclass
    3. class RoutePolicy:
    4. max_simple_tokens: int = 256 # input length limit for simple tasks
    5. complex_threshold: float = 0.6 # complexity score threshold
    6. def route_request(text: str, policy: RoutePolicy) -> str:
    7. """Illustrative routing: tune thresholds against offline evaluation and online monitoring."""
    8. complexity = estimate_complexity(text) # can be scored by a classifier or rules
    9. if len(text) <= policy.max_simple_tokens and complexity < 0.3:
    10. return "small_model"
    11. if complexity >= policy.complex_threshold:
    12. return "reasoning_model"
    13. return "mid_model"

    The benefits of this architecture are:

    • reserving expensive inference resources for tasks that truly need complex reasoning;
    • gradually validating the routing policy through staged rollouts and A/B testing;
    • finding a dynamic balance between cost and quality.

    7. A Practical Roadmap: From Selection to Launch

    1. Scenario breakdown: clarify the input length, output length, latency requirements, and accuracy targets the business needs.
    2. Evaluate first: build an internal question set, run offline evaluation of candidate models under a unified protocol, and record the error intervals.
    3. Small-scale validation: run a staged rollout on representative traffic and check whether online metrics match the offline conclusions.
    4. Inference tuning: based on measured TTFT, TPOT, and throughput data, adjust parameters such as batch size, quantization precision, and caching strategy.
    5. Cost review: compare actual token consumption, hardware utilization, and cloud service fees against the estimation model, and keep refining the parameters.
    6. Continuous iteration: re-evaluate periodically, because model version updates and changing business needs can both shift the optimal choice.

    8. Conclusion

    Discussions of large-model capability tend to stay at the surface-level argument of “who is stronger.” The truly valuable questions are three:

    • In the target scenario, can the model complete tasks reliably?
    • Is the inference cost affordable and scalable?
    • Does the deployment approach match the business’s data-compliance and elasticity requirements?

    Building a layered evaluation system, understanding chain-of-thought behavior, and mastering the basic logic of inference economics is what turns technical discussion into executable engineering decisions. For an enterprise, rather than chasing leaderboard rankings, it is better to turn evaluation, deployment, monitoring, and cost governance into a sustainable process. Models will keep iterating, but this process is the source of long-term competitiveness.