LLM Selection: Calculate Token Costs, Not Just Benchmark Scores
When selecting Large Language Models, matching benchmark scores do not guarantee matching costs. This article explores how parameter scale, Mixture of Experts (MoE) architectures, and post-training affect token consumption. It introduces a four-layer evaluation framework and provides practical formulas and Python code to accurately calculate single-task and successful-task costs, helping developers make budget-conscious selection decisions.
1. Matching Scores Do Not Mean Matching Bills
In model selection, a tie in benchmark scores does not equate to a tie in costs. What dictates your budget is the single-task cost—the amount of money spent to complete a specific job. The price per million tokens is only one part of this equation.
A third-party evaluation report recently highlighted that a new model version achieved the same intelligence index score as a flagship model from another leading vendor. The new version’s API pricing remained consistent with its predecessor, and both were built on the same base model, with capability improvements primarily driven by post-training techniques like Supervised Fine-Tuning (SFT) and Reinforcement Learning (RL). Such news can easily lead to the conclusion: if the scores are identical, just pick the cheaper one.
However, the report also noted that the new version outputs an average of 41K tokens per task, while its competitor outputs around 25K tokens. Although the report did not specify the test tasks, sampling settings, or statistical methods, it illustrates a crucial point: when scores are identical, different output lengths result in different bills. Before finalizing a selection, you should always measure these numbers using your own business data.
2. How Parameters, MoE, and Post-Training Affect Token Consumption
What Parameter Scale Indicates
Parameter scale is often used as a proxy for cost, but it is essential to distinguish between two types of parameters. The total parameter count affects how many weights the model needs to store, which in turn impacts memory footprint and deployment difficulty. The activated parameter count determines how much computation occurs per token during inference.
Models utilizing a Mixture of Experts (MoE) architecture use a routing mechanism to select only a subset of experts to participate in computation for each token. As a result, the total parameter count can be massive while the computational load for a single inference remains manageable.
Are MoE Models Always Cheaper?
Not necessarily. Fewer activated parameters only mean less computation. The service provider still has to allocate memory for all experts and handle the cross-device communication and load balancing caused by expert routing. The table below outlines general patterns, though specific results depend on the provider’s deployment strategy.
| Comparison Dimension | MoE Models | Dense Models |
|---|---|---|
| Computation per token | Only activates a subset of experts, resulting in less computation | All parameters participate in computation |
| Memory footprint | All experts are resident, correlating with total parameter count | All parameters are resident, correlating with parameter count |
| Communication & scheduling | Expert routing causes cross-device communication; load may be uneven | Communication patterns are more regular |
| Batch utilization | Under high concurrency and large batches, expert load is more balanced, making it easier to reduce unit costs | Easier to amortize costs even at lower concurrency |
| Pricing factors | Deployment scale, load level, scheduling efficiency | Parameter count, computation volume, hardware specs |
Therefore, to determine whether a model is cheap, you should look at the single-task cost rather than just the number of activated parameters.
Why Post-Training Increases Inference Costs
Post-training can significantly enhance instruction-following, tool-calling, and complex reasoning capabilities without altering the base model. A common practice in recent years is using verifiable reward signals for reinforcement learning, such as checking whether math answers are correct or if code passes tests. To achieve higher rewards, models often learn to generate longer reasoning processes.
This means that accuracy improvements typically come alongside increased token consumption. The same base model, after post-training, might deliver better single-response quality, but its single-task cost might also be higher.
3. A Four-Layer Evaluation Method
During selection, it is recommended to evaluate models sequentially across four layers:
- Capability: Evaluate using your own business sample sets rather than relying solely on public leaderboards. Define acceptance criteria first, such as accuracy in field extraction, pass rates for code tests, or human scoring for customer service replies. Models that fail to meet these thresholds do not warrant a cost comparison.
- Efficiency: Record time to first token (TTFT), end-to-end latency, and throughput. Extended thinking processes prolong response times, which in real-time scenarios might matter more than price.
- Cost: Track input tokens, cached tokens, visible output tokens, and thinking tokens per API call to calculate both the single-task cost and the single-successful-task cost.
- Stability: Monitor format compliance rates, timeout rates, rate limiting, and retry counts. Observe the variance in results across multiple runs with the same input, and conduct regression tests after model version updates.
Once a model passes the capability threshold, compare costs and efficiency. Stability acts as the risk factor that determines whether it is ready for production.
4. How to Calculate Single-Task Costs
Calculating Single-Task Token Costs
The formula for a single API call cost is as follows:
Single Call Cost = [ (Input Tokens - Cached Tokens) × Input Price + Cached Tokens × Cached Input Price + (Visible Output Tokens + Thinking Tokens) × Output Price ] / 1,000,000
Single Successful Task Cost = Total Batch Cost / Number of Successful Tasks
The denominator is the number of successful tasks, while the numerator includes all costs from failures and retries. A model with a high failure rate might result in a higher single-successful-task cost even if its single API call is cheaper.
The following code implements these two calculations:
from dataclasses import dataclass@dataclassclass Pricing:input_price: float # Price per million input tokenscached_input_price: float # Price per million cached input tokensoutput_price: float # Price per million output tokens, thinking tokens billed at this rate@dataclassclass CallUsage:input_tokens: int # Total input tokenscached_input_tokens: int # Cached input tokensoutput_tokens: int # Visible output tokensthinking_tokens: int # Thinking tokensdef calculate_call_cost(pricing: Pricing, usage: CallUsage) -> float:non_cached_input = usage.input_tokens - usage.cached_input_tokenstotal_output = usage.output_tokens + usage.thinking_tokenscost = ((non_cached_input * pricing.input_price) +(usage.cached_input_tokens * pricing.cached_input_price) +(total_output * pricing.output_price)) / 1_000_000return costdef calculate_successful_task_cost(total_batch_cost: float, successful_tasks: int) -> float:if successful_tasks == 0:return float('inf')return total_batch_cost / successful_tasks
