Why LLM Inference Costs Are Dropping by Orders of Magnitude

    This article rebuilds the cost model behind large language model inference from an engineering perspective and explains why bills for comparable capability can differ by several times. It breaks inference cost into four sources, covers the structural optimizations behind order-of-magnitude price differences, and provides a cost estimation snippet, a scenario-based routing skeleton, context and prefix caching practices, a joint performance-and-cost tuning checklist, and a four-step governance path for teams working under budget constraints.

    Over the past period, prices for large model services have fallen by orders of magnitude: output pricing has dropped from tens of dollars per million tokens to single digits, or even a fraction of a dollar. Many teams’ first reaction is “the vendor is subsidizing it,” but if you read the price cuts purely as marketing, you will make far more expensive mistakes in architecture selection. This article reconstructs the composition of inference cost from an engineering perspective, explains why the bill can differ by several times at the same capability level, and provides a calculation formula, an optimization checklist, and a load testing method you can apply directly, so developers can make rational model and deployment choices under a budget constraint.

    1. Break Down “Expensive” First: Four Sources of Inference Cost

    Before discussing price, you have to align on definitions. The bill for a single request is essentially four factors multiplied and then added together:

    1. Compute occupancy: determined jointly by parameter count, activation path, and context length;
    2. Effective throughput: the number of tokens a single GPU can produce per unit of time;
    3. Utilization: whether real business traffic can actually fill up GPU memory and compute;
    4. Billing basis: input and output are priced separately, and output is usually significantly more expensive than input.

    A schematic cost estimate can be written as:

    1. # Illustrates the cost structure only; does not represent any vendor's actual billing rules
    2. def estimate_cost(reqs, in_price, out_price):
    3. total = 0.0
    4. for r in reqs:
    5. total += r["in_tokens"] / 1e6 * in_price
    6. total += r["out_tokens"] / 1e6 * out_price
    7. return total

    The key insight is that output tokens are generated one by one and cannot be parallelized away, which is why the “output unit price” dominates the bill. Any business centered on long-form generation will be extremely sensitive to output pricing.

    2. Why Prices Can Differ by Orders of Magnitude

    Attributing “cheap” to subsidies ignores three types of real structural optimization.

    The first is sparsification. A mixture-of-experts structure activates only a subset of parameters for each token, so total capacity rises without a linear increase in compute per pass, which is effectively trading storage for compute.

    The second is low precision and quantization. Lower precision for weights and the KV Cache directly reduces pressure on memory bandwidth, and the decode phase is often bandwidth-bound rather than compute-bound, so the gains here are commonly underestimated.

    The third is serving efficiency. Continuous batching, paged KV Cache management, and prefix cache reuse can raise the effective throughput of the same GPU by several times. These gains do not show up on the model card, but they are genuinely reflected in the unit price.

    Put differently, the price difference is the multiplicative effect of “model structure x inference engine x scheduling strategy,” not a one-off price war.

    3. Select by Scenario: Don’t Fight Every Battle with One Model

    The mature approach is tiered routing, splitting requests by difficulty:

    • High-difficulty tasks (complex reasoning, long-chain code generation) go to a large-parameter model where capability comes first;
    • Low-to-medium difficulty tasks (classification, extraction, summarization, formatting) go to a small-parameter, high-throughput model;
    • Cacheable tasks (fixed prompts, repeated knowledge Q&A) go through the cache hit path.

    A minimal working routing skeleton:

    1. def route(req):
    2. if req["need_reasoning"] or req["in_tokens"] > 32000:
    3. return "large_model"
    4. if req["task_type"] in ("classify", "extract", "format"):
    5. return "small_model"
    6. return "cached_path"

    It is worth stressing that tiering is not cutting corners; it is spending the budget on the 10% of requests that genuinely need capability. In practice, the common gain is an overall cost reduction of more than half with no degradation in key metrics, provided you have an offline evaluation set acting as a gatekeeper.

    4. Context and Caching: The Two Easiest Places to Waste Money

    Long context is a cost amplifier. Input tokens grow linearly with length, and attention overhead grows faster. Workable measures include replacing full-context stuffing with retrieval augmentation, using sliding windows and hierarchical summarization, and structurally compressing conversation history.

    Prefix caching is the opposite: a free lunch. Put the system prompt, tool definitions, and few-shot examples in a stable prefix, and once that prefix is hit, this part of the input is almost never recomputed or re-billed. In engineering terms, you only need to keep the prefix byte-for-byte stable and avoid writing timestamps or random IDs into it.

    1. [stable prefix] system instructions + tool schema + few-shot
    2. [variable part] user question + retrieved snippets

    5. Joint Tuning of Performance and Cost

    Looking at unit price alone leads to misjudgment. The real metric should be “how many effective requests a given budget can support.” It is recommended to fix three load test profiles: short input with short output, long input with short output, and short input with long output, observing throughput, time to first token, and tail latency for each.

    Parameters you can tune, usually ordered by payoff: batch size, quantization precision, KV Cache strategy, concurrency limit, and timeout with retry backoff. Be sure to set a hard cap on output length; without it, a handful of abnormal requests can consume the entire month’s budget.

    6. Implementation Path and Governance

    A four-step approach is recommended: build a unified inference gateway for routing and rate limiting; connect logging and monitoring with alerting, tagging by business dimension to account for cost; use object storage to accumulate evaluation sets and call samples; and run elastic scaling on a container platform to recover utilization from the troughs.

    On Baidu AI Cloud, the capabilities above can map to a combination of the general container platform, object storage, logging, and monitoring and alerting offerings, forming a closed loop of “observable, attributable, optimizable.” Cost governance is not a one-time purchasing decision but a continuous engineering practice: quantify first, then tier, and only then negotiate unit price.