Large-Scale Inference Cost Optimization: Breaking Down Throughput and Unit Economics
This article examines how large-scale inference systems reduce per-token costs through hardware specialization, E/P/D separation, KV cache reuse, parallelism choices, heterogeneous chip support, and tail-latency-aware scheduling. It also explains how to reconcile service throughput with compute throughput, estimate cache capacity, and build a practical benchmarking framework for capacity planning and unit economics.
1. Define the Problem First: Token Pricing Is Determined by the System
A model defines the limits of what an AI system can do, but the inference system determines how much each token costs to serve. This is the starting point for the entire analysis: as model capabilities converge, competition shifts from “can the model answer?” to how many requests can the same hardware serve at a lower cost.
A publicly discussed large-scale online inference system disclosed two significant figures: approximately 1.55 quadrillion tokens per day served by a single cluster, and overall revenue equivalent to roughly $38 per card-hour under a low-price assumption. The first number represents scale; the second represents unit economics. They must be considered together because the system is fundamentally optimizing serving efficiency, not merely model quality.
The system publicly defined three goals, which can be summarized as three cost-reduction strategies:
Support chips from multiple vendors
Run on both general-purpose accelerators and domestically produced accelerators while keeping utilization high. This reduces supply-chain and procurement risk and improves the usability of existing hardware.Organize hardware by inference stage
Use common eight-card machines for Prefill and 64–128-card supernodes for Decode. Matching hardware topology to the compute and communication characteristics of each stage reduces resource mismatch.Retain KVCache for more than 72 hours
Use a longer reuse window to eliminate repeated Prefill work, converting part of the compute burden into storage and bandwidth requirements.
Scope and Data Notes
The technical details in this article are based on the general engineering logic described in public technical blogs and related discussions. Figures such as 1.55 quadrillion tokens per day, $38 per card-hour, cluster size, cost, and gross margin are public disclosures or third-party estimates presented for illustration. When reproducing the analysis, replace them with results from your own benchmarks.
2. The Basic Math: Do 1.55 Quadrillion Tokens and $38 Reconcile?
Start with a simple calculation:
155 × 10^12 ÷ 86,400 ≈ 1.79 × 10^9 tokens/s # approximately 1.79 billion tokens per second1.79 × 10^9 ÷ 7300 ≈ 2.457 × 10^5 tokens/s/card # assuming approximately 7,300 cards2.457 × 10^5 × 3600 ≈ 8.85 × 10^8 tokens/card·hour
The key point is that 885 million tokens per card-hour represents service throughput, not compute throughput. The difference is explained by cache hit rate. If the cache hit rate is approximately 85%, only about 15% of Prefill work must actually be recomputed on the accelerators. Service throughput is therefore amplified significantly.
When evaluating an inference system, track at least these three metrics:
- Service throughput
- Compute throughput
- Cache hit rate
Without all three, the reported numbers cannot be reconciled.
Online efficiency is approximately 80% of offline benchmark performance. The gap comes from long-tail traffic, scheduling jitter, and load-balancing losses. This reduction should be included in capacity planning.
3. Architecture Strategy One: E/P/D Separation and an Independent Cache Layer
The system separates E/P/D—Expert, Prefill, and Decode—and connects them to an independent cache file layer:
- VE, or expert/routing logic, runs on a single card to avoid competing for device memory.
- Prefill runs on eight-card machines, relying primarily on intra-machine communication and minimizing cross-machine traffic.
- Decode runs on 64–128-card supernodes, using high-bandwidth intra-domain communication to distribute KV transfer costs.
- The independent cache layer persists Block KV and enables reuse across requests.
What does this save?
Prefill is compute-intensive and bursty, while Decode is memory- and bandwidth-intensive and highly latency-sensitive. Co-locating them causes their resource profiles to interfere with each other. Separating them allows each stage to scale independently according to its own performance curve.
The trade-off is additional cross-layer KV movement and one extra network hop. High-speed interconnects and zero-copy paths are required to keep this overhead within an acceptable range.
4. Architecture Strategy Two: Choosing the Right Parallelism
The system uses different parallelism strategies for Prefill and Decode:
- Prefill uses small Expert Parallelism (EP 2–8) to reduce the number of participants in all-to-all communication.
- Decode uses wide Expert Parallelism (Wide-EP, 64–128) to distribute expert weights across more cards and support a larger batch.
- Tensor Parallelism and Context Parallelism (TP/CP) are not currently used because, for this hardware configuration, their communication benefits do not offset the bandwidth cost.
A reusable decision rule is:
Choose parallelism dimensions based on the number of bytes that must be synchronized across cards at each step—not simply on the model architecture.
5. Architecture Strategy Three: Three-Tier KVCache and Capacity Estimation
HBM → Hot data for currently active sequencesLocal memory → Sliding Window Attention (SWA) stateCache file layer → Block KV for cross-request and cross-session reuse
Illustrative capacity assumptions:
- Block KV: approximately 528 B/token
- SWA: approximately 1.4 MB per sequence
The storage required for a 72-hour reuse window can be estimated as:
Required capacity ≈ daily active token volume × 528 B × retention days / deduplication rate
This formula is one of the most useful tools when benchmarking or building a system. It converts a storage-budget question directly into a cache-hit-rate target.
If the storage budget is insufficient, the retention window must be shortened. The cache hit rate will then decline, and Prefill computation will become a bottleneck again.
6. The Boundary Between Recomputation and Storage: Bounded Replay
Not every state is worth persisting. SWA state is not stored in the cache layer. When it is missing, the system uses bounded replay:
- Replaying only the final 128 tokens can provide an approximate reconstruction.
- Exact reconstruction requires replaying approximately 2,560 tokens.
This is a clear engineering trade-off: use a bounded amount of computation to avoid unbounded storage and bandwidth requirements.
When designing such a system, acceptable accuracy loss should be modeled explicitly as a parameter rather than being determined implicitly by the implementation.
7. Scheduling: Three Rules That Constrain One Another
1. Derive Prefill Chunks from a Time Budget
Set the per-step latency budget first, then calculate the appropriate chunk size. This prevents long prompts from blocking the Decode queue.
2. Balance Decode Along Two Dimensions
Balance both memory consumption and compute load. Looking only at batch size can create hotspots.
3. Balance Expert Load by Controlling the Maximum
The optimization target should be the maximum load, not the average load. The most heavily loaded expert determines the latency of the entire step.
Together, these rules show that the scheduling objective should be tail latency, rather than average throughput.
8. Heterogeneous Chips: Coverage and Utilization Are Different Curves
The challenge of supporting multiple accelerator vendors is not merely making the model run. It is making it run efficiently.
- Coverage—support for operators, data types, and distributed communication primitives—determines deployability.
- Utilization determines economics.
In practice, teams should maintain:
- An inventory of missing operators
- A list of communication-library differences
- Precision-alignment baselines
- Observable metrics for triggering fallback paths
Fallback behavior should be measured and monitored rather than assessed manually.
9. Benchmarking and Replication Checklist
| Metric | Illustrative value | Purpose |
|---|---|---|
| Service throughput per card | ≈2.46 × 10^5 tokens/s | Capacity-planning baseline |
| Service throughput per card-hour | ≈8.85 × 10^8 tokens | Unit-economics calculation |
| Cache hit rate | ≈85% | Reconcile service and compute throughput |
| Online/offline efficiency | ≈80% | Account for benchmark degradation |
| Block KV | ≈528 B/token | Estimate storage capacity |
| SWA | ≈1.4 MB/sequence | Estimate memory requirements |
| Replay window | 128 / 2,560 tokens | Balance accuracy and compute |
10. Common Mistakes
- Reporting service throughput without cache hit rate, making the result impossible to verify.
- Using offline benchmark results directly for capacity planning and ignoring the approximately 20% online-efficiency loss.
- Treating the cache layer as if it had unlimited capacity and overlooking the storage cost of a 72-hour retention window.
- Optimizing average load instead of maximum load, leaving tail latency unchanged.
Conclusion
The value of this system does not come from a single optimization technique. It comes from decomposing per-token cost into independently optimizable factors:
- Parallelism strategy
- Hardware topology
- Cache hierarchy
- Recomputation boundaries
- Scheduling objectives
When building an inference cluster, first establish your own cache-hit-rate and online-efficiency baselines. Then use capacity formulas to work backward from storage and compute budgets. This is more effective than copying any architecture diagram without validating it against real workload data.
