LLM Token Efficiency and Cost Evaluation in Practice

    This article explains why a lower per-token price does not always lead to a lower bill, and how to evaluate the real cost of large language models. It introduces a reusable cost model, a sample cost measurement class, the factors behind token efficiency, and an engineering optimization checklist covering routing, thinking budgets, prompt compression, caching, and observability. Readers will learn a three-step approach to model selection based on task cost, effective cost, and success rate.

    1. The Problem: A Lower Unit Price Does Not Mean a Lower Bill

    As large language model applications move into large-scale production, model selection discussions are shifting from benchmark scores to cost per task. A common mistake is treating the input and output price per million tokens as the final cost conclusion. The real bill is the product of three variables: the total tokens consumed per task, the ratio of input to output tokens, and the price itself. Ignoring any one of them distorts the conclusion.

    A phenomenon worth studying has recently appeared in the industry: a general-purpose model matches another model with an order of magnitude more parameters on a public composite intelligence index, yet the two differ significantly in token consumption. The former has about 753 billion total parameters and about 40 billion active parameters; the latter has about 2.8 trillion total parameters and about 104 billion active parameters. The parameter counts differ by nearly four times and the active counts by more than two times, yet the evaluation scores are the same. This shows that post-training optimizations (data mixture, reinforcement learning strategy, and reasoning chain organization) can unlock considerable capability without enlarging the base model.

    The cost, however, is equally clear: the model with fewer active parameters averages about 41K output tokens per task, while its competitor uses about 25K. Converted to pricing, the former charges $1.40 per million input tokens and $4.40 per million output tokens; the latter charges $3.00 and $15.00. The unit price gap exceeds three times, but the per-task cost is only about 19% lower (about $0.68 versus $0.84). This is a typical case of token efficiency being eaten up by a unit price advantage.

    2. Calculating the Real Cost: A Reusable Model

    To judge whether a model is truly cheaper, you need a consistent measurement standard. The following formulas are recommended:

    1. Task cost = (input tokens × input price + output tokens × output price) / 1e6
    2. Effective intelligence cost = task cost / task success rate
    3. Intelligence output per 1K tokens = evaluation score / (input tokens + output tokens)

    The “output tokens” should include both the thinking process and the final response. This is the part most easily left out. In engineering, you can collect real usage through a unified wrapper layer:

    1. class CostMeter:
    2. def __init__(self, in_price, out_price):
    3. self.in_price, self.out_price = in_price, out_price
    4. def measure(self, usage, score=1.0, success=1.0):
    5. cost = (usage["prompt_tokens"] * self.in_price
    6. + usage["completion_tokens"] * self.out_price) / 1e6
    7. total = usage["prompt_tokens"] + usage["completion_tokens"]
    8. return {
    9. "task_cost": round(cost, 4),
    10. "cost_per_success": round(cost / max(success, 1e-6), 4),
    11. "score_per_1k_tokens": round(score / (total / 1000), 4),
    12. }

    The key is the “task success rate.” If a model thinks longer but has a higher first-pass rate, its effective cost may actually be lower; conversely, retries caused by long thinking can quickly inflate the bill.

    3. Why Token Efficiency Has Become a Standalone Metric

    Token efficiency refers to the number of tokens consumed to complete a task of equivalent quality. It is affected by four types of factors:

    • Post-training strategy: preference optimization and reasoning chain training change a model’s tendency in “how much it wants to say,” and verbose reasoning is a byproduct of capability spillover.
    • Task type: open-ended generation naturally consumes more output tokens than structured extraction.
    • Context management: stacking retrieval snippets, conversation history, and system prompts continuously raises input-side costs.
    • Sampling and decoding configuration: improper settings for thinking budget, maximum output length, and stop conditions cause wasted consumption.

    The evaluation system is therefore expanding from a single “intelligence index” to a two-dimensional view: the horizontal axis is the capability score, and the vertical axis is the token overhead per unit of capability. Over the past two years, some small-parameter models have also approached the full versions of large-parameter models on the composite index, but their token consumption is noticeably higher, which is a real-world footnote to this dimension.

    4. An Engineering Optimization Checklist

    • Tiered routing: send simple intents to small models or short-thinking configurations, and escalate only for complex reasoning, avoiding a one-size-fits-all high-consumption approach.
    • Thinking budget constraints: set output limits and timeouts for different tasks, and downgrade and retry when limits are exceeded.
    • Prompt compression: deduplicate retrieval snippets, trim history turns, and structure system prompts to directly reduce input tokens.
    • Cache reuse: cache results for stable prefixes and high-frequency questions to reduce repeated billing.
    • Observability: bring token usage, success rate, and per-task cost into logging services and monitoring alerts, forming dashboards and alert thresholds.
    • Elastic capacity: use a container platform for canary releases and load testing, a message queue for peak shaving, and object storage for accumulating evaluation datasets.

    When deployed in the cloud, these capabilities can be mapped to a combination of general product categories: a container platform hosts inference services, logging services and monitoring alerts handle cost observability, object storage stores evaluation samples, and message queues process asynchronous batch tasks. Baidu AI Cloud provides corresponding infrastructure support in these general categories, making it easier for teams to turn cost governance into a routine process.

    5. Conclusion

    Parameter scale determines the capability ceiling, post-training determines the efficiency of capability release, and token efficiency determines the bill. For model selection, follow three steps: first, use a consistent standard to calculate per-task cost and effective cost; second, validate the success rate with a real business dataset; finally, use routing, budgets, and caching to bring costs into the target range. Looking only at unit price or only at benchmark scores will both cost you in production.