Inference Cost Engineering for AI Applications at 100M+ Daily Active Users

    This article breaks down why inference cost rises as AI applications scale to 100M+ daily active users, and how to bring it back under control. It covers a token-based cost estimation model, the shift in demand from short chat requests to compute-dense multimodal and agentic tasks, and three layers of optimization: sparse activation with Mixture-of-Experts (MoE), KV caching with PagedAttention, and scenario-based routing across a multi-tier model matrix. It also outlines the observability metrics needed to close the cost governance loop without degrading user experience.

    1. The Scale Problem: What 100M+ DAU Means for Compute

    When a general-purpose AI assistant crosses the 100M daily active user mark, it stops being just a product milestone. It pushes large model inference into an engineering extreme zone defined by high concurrency, long contexts, and mixed modalities. Publicly reported figures put daily token consumption at leading platforms in the tens of trillions, with year-over-year growth typically in the range of several times to ten times. A sizable number of enterprise customers also report cumulative annual consumption above one trillion tokens. Converted into resource requirements, these numbers explain why inference cost has become the top concern for engineering teams.

    A simple estimation model makes this concrete. Assume an input-to-output call ratio of 5:1, an input price of roughly CNY 0.0008 per 1K tokens, and an output price of roughly CNY 0.002 per 1K tokens. The weighted blended rate comes to about CNY 1 per million tokens. At 25 trillion tokens per day, the theoretical cost is around CNY 2.5 million per day. This figure is usually treated as an upper bound, because real systems compress it substantially through architecture and engineering.

    Note that these prices and volumes are industry-scale reference points drawn from public discussion. Actual billing varies widely across vendors, model specifications, and context lengths, so engineering decisions should be based on your own load test data.

    2. Why Cost Is Not Constant: Structural Increases from Rising Demand

    A common but wrong assumption is that larger scale always means lower unit cost, so the cost curve only goes down. In reality, if technical progress stalls, cost rises as users learn to do more with the system. The reason is a shift in the demand mix.

    • Stage one: conversation, Q&A, summarization, and writing refinement. Short inputs, medium outputs, limited context, high prefix repetition, and naturally high cache hit rates.
    • Stage two: text-to-image, speech and video generation, code generation, and deep research tasks. Token consumption per task jumps by one to two orders of magnitude, often with multi-turn tool calls and long planning chains.

    In other words, the more capable the user becomes, the higher the compute density of each request. Cost governance has to be modeled per scenario rather than smoothed over with a single average.

    3. Layer One: Sparse Activation Architectures

    Mixture-of-Experts (MoE) is one of the mainstream architectures for reducing cost. The core idea is a very large total parameter count, while each token is routed to only a few expert networks. Common sparse activation designs activate roughly 10% of parameters at inference time, which in theory saves close to 90% of inference compute compared with full-parameter activation.

    Three engineering points matter:

    1. Routing balance. Load skew turns some experts into hotspots and pushes actual throughput below the theoretical value. This requires load balancing loss and capacity factor control.
    2. Expert parallelism communication overhead. Fewer parameters does not mean less communication. All-to-All communication can become the new bottleneck.
    3. Memory and bandwidth. Sparse activation lowers compute demand, but the weights still have to reside somewhere. Memory capacity and access bandwidth determine the concurrency ceiling.

    The routing logic can be abstracted as:

    1. # Pseudocode: core flow of sparse routing
    2. logits = router(x) # score experts
    3. topk_idx, topk_w = topk(logits, k=2)
    4. gate = softmax(topk_w)
    5. y = sum(gate[i] * expert[topk_idx[i]](x) for i in range(k))

    4. Layer Two: KV Caching and Paged Attention

    The real bottleneck in autoregressive generation is often not compute but memory fragmentation and repeated computation. KV caching retains the key and value tensors of historical tokens to avoid redundant forward passes. PagedAttention borrows the paging concept from operating systems, splitting the cache into fixed-size blocks allocated on demand, which significantly improves memory utilization. Publicly reported figures commonly cite GPU utilization improvements of more than 3x.

    Supporting practices include:

    • Prefix cache reuse: content-addressed reuse of system prompts, knowledge base snippets, and few-shot examples. Every point of hit rate improvement translates directly into cost reduction.
    • Continuous batching: dynamically batching requests of different lengths to cut idle time.
    • Quantization and speculative decoding: weight quantization reduces memory access, while a draft model plus verification raises tokens produced per unit time.
    1. Request A: [system_prompt(2k)] + [user_turn]
    2. Request B: [system_prompt(2k)] + [user_turn]
    3. After reuse, the 2k prefix is computed only once, saving about 50% of prefix compute

    5. Layer Three: Scenario-Based Routing and a Multi-Spec Model Matrix

    Serving every scenario with a single model is the most expensive option. The mature approach is a model matrix: lightweight models handle high-frequency short requests, standard models handle regular conversation, and heavy models serve only complex reasoning and multimodal tasks, with confidence-based fallback and escalation paths. Combined with context length trimming, retrieval in place of long contexts, and result and semantic caching, this can bring average cost down to 60-80% of the theoretical upper bound without sacrificing experience.

    6. Observability and the Cost Governance Loop

    Cost optimization has to be measurable. Four metrics are worth tracking: cost per token, cache hit rate, batch fill rate, and P99 time to first token. Putting all four on the same dashboard is what prevents the hidden loss of “lower cost, worse experience.” If you rely on general cloud capabilities, you can combine a container platform for elastic scaling, object storage for models and datasets, a message queue for request peak shaving, and logging plus monitoring and alerting to close the loop.

    7. Conclusion

    The real lesson from 100M+ DAU is not that compute is expensive. It is that inference cost has become a first-class engineering metric alongside latency and quality. Practice at platforms such as Baidu AI Cloud points the same way: sparse architectures, systematic caching, a model matrix, and a closed observability loop. Stacked together, these four bring the cost curve back into a controllable range. For developers, the earlier you build a token-level cost view, the more control you hold when demand escalates in the next stage.