LLM Inference: How to Analyze the Share of Self-Hosted Compute
This article examines what a reported 44% self-hosted GPU share for LLM inference actually reveals about cost structure. It explains why a single-day snapshot can be distorted by promotions, which request types self-hosted clusters cannot absorb, and why coding agents are especially well suited to self-hosting due to long contexts, high prefix repetition, and queue-tolerant workloads. It also compares the cost models of self-deployed GPUs versus external APIs and offers practical guidance on measuring prefix cache hit rates, sizing capacity by peak-to-trough ratios, tiering caches, separating inference and training pools, and building unified gateway routing.
1. The Real Question Behind a Single Ratio
A smart coding tool platform disclosed that roughly 44% of its daily token consumption was served by self-deployed GPUs, an absolute volume of about 16 trillion tokens, with plans to scale its own hardware roughly tenfold within a few months. Working backward, total platform consumption that day was about 36 trillion tokens.
The 16 trillion figure is striking, but it is not the best entry point for analyzing the cost structure of inference. What is actually informative is how that 44% was carved out: which requests were routed to the owned cluster, which continued to external APIs, and what criteria drove the split. Answering that question clearly is more valuable than memorizing the ratio itself.
1. First, Calibrate the Measurement Basis
This is a single-day snapshot, not a monthly average. Single-day data is extremely sensitive to that day’s operational activity. Around the disclosure date, the platform was running dense promotions: first a near-unlimited free tier for a small-parameter model, then a top-up bonus offering several times the quota for a small payment, with the bonus cap raised step by step.
Free tiers and subsidies push request volume in a short window far above normal levels, significantly inflating the denominator. Given that self-hosted cluster capacity is fixed in the short term, a larger denominator actually pushes the self-hosted share lower. So 44% is more likely a conservative value diluted by promotions than a normal-state ratio. For capacity planning, look at monthly averages, peak-to-trough gaps, and segmented data for promotional versus normal periods, rather than extrapolating from a single-day peak ratio.
2. Then Break Down the Traffic Structure: Three Request Types Self-Hosting Cannot Serve
A tool-type platform that aggregates multiple models cannot serve all traffic with its own GPUs. There are at least three structural gaps:
- Closed-source frontier models: weights are unavailable, so they can only be called through public APIs, with no self-hosted substitute.
- Instant concurrency from promotions and traffic spikes: a self-hosted cluster must be provisioned for peak load to avoid dropping requests, and outside peak hours those cards sit idle and depreciating.
- Long-tail niche models: if dozens of niche models each require a resident GPU allocation, utilization becomes unacceptably low.
The conclusion: 44% reflects how traffic is split, and has little to do with total capacity. The sensible approach is to schedule the portion of traffic that is “weights available, requests queueable, context reusable” into the owned cluster and keep the rest on external APIs. This is fundamentally a scheduling decision, not a capacity race.
2. Why Coding Scenarios Are Extremely Friendly to Self-Hosting
Coding agents have three call-pattern characteristics that hit the cost-reduction points of self-hosted inference precisely:
- Long context: reading repositories, retrieving code, running tools, and editing files all require carrying large amounts of background every turn.
- High prefix repetition: every turn resends the full history, and within inputs of tens of thousands to hundreds of thousands of tokens, the vast majority is identical to the previous turn.
- Queue tolerance: interactive coding has first-token latency requirements, but batch refactoring and test-fixing tasks can be queued to shave peaks.
As long as the KV cache for repeated prefixes is retained, that portion of the input does not need to be recomputed, and the marginal cost shifts from “compute” to “memory bandwidth and storage bandwidth.”
Illustration: Prefix-Hit Decision Logic
# Pseudocode: illustrates the decision logic for prefix cache routingdef should_route_local(req, cluster):if not req.model.weights_available: # closed-source model, external API onlyreturn Falseif req.prefix_tokens < MIN_PREFIX: # short requests gain little from reusereturn Falseif cluster.queue_depth > QUEUE_LIMIT: # peak overflow, fall back to externalreturn Falsereturn req.cache_hit_ratio > HIT_THRESHOLD
3. What Public Production Data Shows
An open-source inference system once published a set of production figures: a single cluster can reach daily throughput on the order of a quadrillion tokens, with average input length around 77K and an input cache hit rate around 96%; by using a dedicated cache cluster for prefix reuse, Prefill-stage throughput improved by roughly an order of magnitude; the same system split Prefill and Decode across different hardware, running Prefill on standard 8-card machines and Decode on 64-to-128-card supernodes, with a roughly 1:1 ratio on each side.
The meaning of this data can be abstracted into three general conclusions:
- In agent scenarios, the main cost is “re-reading the same prefix,” not generating new tokens.
- Once a prefix hits the cache, the cost item shifts from GPU compute to memory bandwidth and SSD bandwidth, and the hardware selection logic changes accordingly.
- Prefill and Decode have different resource profiles; co-locating them causes mutual interference, and separate deployment makes it easier to fully utilize each type of hardware.
4. Cost Model Comparison: Self-Hosting vs. External APIs
Self-hosting turns the cost of reusable prefixes into fixed-asset depreciation, while external APIs charge per token and offer only a one-time cache discount. The two are not substitutes but different cost curves:
| Dimension | Self-deployed GPU | External API |
|---|---|---|
| Cost structure | Fixed depreciation + operations labor | Pay-as-you-go |
| High-reuse long prefix | Extremely low marginal cost | Limited discount |
| Instant peak | Must provision for peak, prone to idling | Good elasticity |
| Long-tail models | Poor utilization | More economical |
| Cold-start cycle | Procurement and racking measured in months | Minutes |
The decision criterion can be simplified: self-hosting is more cost-effective when requests are queueable, prefixes are reusable, and model weights are available, all three at once; otherwise external APIs are more stable.
5. Implementation Recommendations
- Measure prefix hit rate first: track average input length and repeated-prefix share at the gateway; do not self-host if the hit rate stays below threshold over the long term.
- Decide the self-hosted share by peak-to-trough ratio: for workloads with a large peak-to-trough gap, self-host baseline capacity first and fall back to external for peak overflow.
- Tier the cache: keep hot prefixes in GPU memory, warm prefixes on local NVMe, and cold data in object storage, with monitoring and alerts to watch hit rate and bandwidth levels.
- Separate inference and training pools: avoid resource contention, and use a container platform for elastic scaling and fault isolation.
- Unify gateway routing: use model availability, queue depth, and cache hit rate as routing factors, and make scheduling a policy that can be gradually rolled out and rolled back.
44% is only a snapshot; what is truly reusable is its splitting method: identify high-reuse long prefixes, use caching to convert compute cost into bandwidth cost, and let scheduling dynamically choose between self-hosting and external based on cost and stability. This approach can be implemented on top of the general container, object storage, and monitoring and alerting capabilities of platforms such as Baidu AI Cloud.
