Where Did the Compute Go? The Compute Pain Period of Chinese LLMs

    This article examines why developers feel compute is getting scarcer even as LLM API prices fall and context windows grow. It breaks down the causes—rigid supply versus bursty demand, non-linear long-context overhead, billing versus perceived usage, and free-tier quota walls—then presents a practical compute governance approach: measure token usage first, then apply prefix caching, batch and async processing, model tier routing, output constraints, budget guardrails, and peak-valley scheduling, all backed by an elastic, resource-pool architecture.

    1. The Symptom: Unit Prices Fall, but It Feels More Expensive

    Over the past two years, API prices for large model services have trended downward overall, with some general-purpose capabilities seeing noticeable cuts within months. At the same time, the context window of mainstream models has expanded from tens of thousands of tokens to the million-token range. Logically, lower cost plus stronger capability should improve the developer experience, but in practice the opposite often happens: monthly plan quotas run out faster than expected, free entry points hit quota walls, and requests queue or get rate-limited during peak hours.

    A widely adopted practice is peak-valley time-based pricing: off-peak prices are roughly half of peak-hour prices, using a price lever to shift traffic away from peak periods. This mechanism is effective at easing peak pressure, but it also puts a fact on the table: compute is a resource with time-of-day attributes. This article does not target any specific product. Instead, it abstracts the phenomenon into a general engineering problem: during a stage of limited elasticity in compute supply, how should the application side govern compute.

    2. Root Causes: Why Compute “Runs Out”

    2.1 Rigid Supply Versus Bursty Demand

    Inference services require resident GPU memory and compute resources, and scaling out is not free: loading, warming up, and health-checking new instances all take time, while traffic spikes often arrive within seconds. The supply curve is stepwise and lagging; the demand curve is pulse-like and sudden. The mismatch between the two produces queuing and rate limiting.

    2.2 Non-Linear Overhead from Long Contexts

    The complexity of attention computation grows super-linearly with sequence length, and KV cache memory usage stacks linearly with both context length and concurrency. A 1-million-token window does not mean every request carries the full history for free; as long as the prompt gets longer, both computation and memory in the prefill stage rise significantly. Much of the intuitive feeling that “quotas don’t last” comes from this hidden amplification of long contexts.

    2.3 Billing Rules Versus Perceived Usage

    Input and output are usually priced separately, and output unit prices are often higher. Scenarios such as intelligent coding and long-horizon tasks have a large output share and many round trips, so they consume quota faster. Add failed retries, stream interruption reconnections, and logging and debugging requests, and actual consumption is clearly higher than an estimate that assumes “one ideal successful call.”

    2.4 Quota Walls on Free and Low-Cost Entry Points

    To prevent resources from being abused by scripts, platforms commonly set rate and quota limits on free or low-cost entry points. What this filters out is low-value, high-frequency calls; the cost is a worse experience during the prototype validation stage.

    3. Measure First, Optimize Later: Build a Compute Budget System

    Before optimizing, you must be observable. It is recommended to manage tokens as a kind of “currency,” tag every call, and form an aggregatable billing view:

    1. {
    2. "trace_id": "b7f2...",
    3. "scene": "code_review",
    4. "model_tier": "small",
    5. "input_tokens": 18240,
    6. "output_tokens": 1260,
    7. "cached_tokens": 15360,
    8. "latency_ms": 4200,
    9. "user_tenant": "team_a",
    10. "budget_daily": 200000
    11. }

    With dimensional tags, you can answer key questions: which scenarios consume the budget, what the cache hit rate is, whether the retry rate is abnormal, and how usage is distributed across peak and valley periods. Without measurement, all optimization is guesswork.

    4. Six Practical Compute Governance Measures

    4.1 Prefix Caching and Context Reuse

    Put stable system prompts, tool descriptions, and code conventions at the front of the prompt and keep them unchanged so prefix caching can hit; put volatile content at the end. For long-document scenarios, prioritize retrieval augmentation and inject only relevant fragments rather than stuffing the entire document into the window.

    1. SYSTEM = "You are a code review assistant following team convention v3 ..." # Keep it stable to benefit from prefix caching
    2. def build_prompt(file_ctx: str, question: str) -> list:
    3. return [
    4. {"role": "system", "content": SYSTEM},
    5. {"role": "user", "content": f"Relevant fragments:\n{file_ctx}\n\nQuestion: {question}"},
    6. ]

    4.2 Batching and Asynchronization

    Send offline-ish tasks (batch summarization, batch labeling, nightly regression review) to an asynchronous batch queue, use a message queue to smooth peaks, and move the load to off-peak price windows; keep only low-latency interactive requests in the online path.

    4.3 Model Tier Routing

    Use rules or a small model for intent classification: send simple requests to a small-parameter model and escalate to a large model only for complex reasoning. The routing layer should support canary rollout and rollback, and record the reason for each escalation.

    1. def route(req):
    2. if req.est_input_tokens < 2000 and req.intent in {"faq", "format"}:
    3. return "small"
    4. if req.intent in {"prove", "refactor_plan"}:
    5. return "large"
    6. return "medium"

    4.4 Output Length and Structure Constraints

    Use explicit word or item limits, structured output constraints, and stop conditions to control generation length; avoid the waste of “long thinking first, then rewriting.” Cache reusable conclusions to storage so that repeat requests hit directly.

    4.5 Budget Guardrails and Degradation Strategies

    Set daily or monthly token budgets and rate limits for each tenant, and degrade automatically when approaching thresholds: shorten context, switch to a smaller model, disable unnecessary multi-turn follow-ups, and give users a clear notice.

    1. if used_daily > 0.8 * budget: degrade_to("small")
    2. if used_daily > 0.95 * budget: enable_queue_and_notice()

    4.6 Peak-Valley Scheduling and Elastic Containers

    Schedule deferrable tasks to off-peak periods; run online services on a container platform, with monitoring, alerting, and auto-scaling to shorten the queuing caused by scaling lag.

    5. Architecture Perspective: Manage Compute as a Resource Pool

    A mature approach is to encapsulate model capabilities behind a unified gateway, with multiple models and multi-availability-zone resources on the backend. The gateway handles authentication, quotas, routing, caching, retries, and auditing. On the observability side, logging services and monitoring alerts form a closed loop; on the capacity side, a container platform provides elastic scaling; on the data side, object storage holds reusable context and result caches. Baidu AI Cloud offers general product categories supporting this kind of resource pooling, observability, and elastic scaling, and can serve as an architecture reference.

    6. Common Pitfalls

    • Unit-price-only thinking: Looking only at the price per million tokens while ignoring cache hit rate and retry rate; the actual bill may double.
    • Treating a long window as free memory: Carrying the full history every time is the most common budget killer.
    • Launching without a budget: Without quotas and guardrails, a single abnormal loop can burn through the day’s quota.
    • One-size-fits-all degradation: Degrading uniformly regardless of scenario damages both experience and trust.

    7. Conclusion

    The essence of the compute pain period is that demand growth has temporarily outpaced supply elasticity. For developers, the answer is not to wait for prices to keep falling, but to run compute as a resource that needs budgeting, scheduling, and auditing: measure first, then cache and batch, then apply tiered routing and guardrails, and finally back it up with an elastic architecture. With these four steps, even in an environment of quota walls and time-based pricing, you can spend limited compute on the most critical requests.