Economic Evaluation and Optimization of LLM Inference on Heterogeneous Accelerators
This article explains why LLM inference should be judged by unit economics, not peak benchmarks. It outlines a three-stage maturity model, four metric families including goodput, latency–throughput–cache trade-offs, layered performance attribution, a minimal cost model, staged rollout gates, supporting engineering practices, and common pitfalls.
Economic Evaluation and Optimization of LLM Inference on Heterogeneous Accelerators
1. From “can it run” to “does it pay”
Over the past two years, the focus of large-model inference on domestic and heterogeneous accelerators has shifted. Early work asked whether a model could be deployed and produce correct outputs. Once inference carries real online traffic, the center of gravity moves to unit cost and output per unit time: given service-quality constraints, how much revenue can one accelerator-hour convert, and what does each million tokens cost.
Engineering implication: inference is not a one-off benchmark; it is a business that must be accounted for continuously. If unit economics are positive, the service can fund itself and form a loop of revenue, reinvestment, and capability growth. Even impressive peak performance is unsustainable if it cannot cover depreciation, power, and operations. Whether a design is production-ready is not leaderboard rank, but an auditable, reproducible, sustainable ledger.
2. Three-stage maturity: runnable, fully utilized, operable
Stage 1: Runnable (correctness first). End-to-end path: correct weight load, operator coverage, numerical alignment, reproducible output. Acceptance is correctness, not speed. Typical issues: graph fallback from missing operators, output drift from mixed precision modes, OOM on long context.
Stage 2: Fully utilized (utilization first). Extract theoretical peak. Work spans fusion and memory access, matching tensor/pipeline/expert parallelism to interconnect topology, hierarchical and paged KV cache, continuous batching and scheduling, graph compile and constant folding. Acceptance: hardware utilization (compute, memory bandwidth, interconnect) and max throughput under target SLOs.
Stage 3: Operable (economics first). Production traffic at scale with quantified commercial output. Added concerns: capacity planning, elasticity, canary and rollback, failure-domain isolation, observability, cost accounting. Acceptance: unit economics and availability under real traffic (input-length mix, hit-rate mix, peak-to-trough ratio).
Stages stack rather than replace one another. After stage 3, stages 1 and 2 still need regression; any upgrade can reverse economics.
3. Four metric families (collect together)
Talking optimization without metrics is empty. Capture all four in the same load test so one metric is not “best” while the system degrades.
| Category | Key metrics | Notes and traps |
|---|---|---|
| Latency | TTFT P50/P90/P99, inter-token latency (TPOT) | Means hide tails; P90/P99 drive timeouts and retry amplification |
| Throughput | Per-stream tokens/s, per-card decode throughput, cluster throughput | Stream speed is UX; per-card throughput is cost; they are often confused |
| Quality / effectiveness | Cache hit rate, goodput, SLO attainment | Low hit rate distorts cost models for long inputs |
| Cost | Revenue per card-hour, cost per million tokens, utilization-adjusted effective cost | Band idle vs busy hours; include idle waste |
Goodput is the most often ignored composite: it counts only tokens from requests that meet SLO. A config that raises throughput 30% but doubles P99 TTFT and causes 15% timeouts/retries can lower goodput.
4. Coupling: slow decode means less revenue
Inference cost is time cost, so output speed and economics are strongly correlated. During decode, a request occupies memory and scheduler slots; fewer tokens per unit time means fewer billable streams. Platforms with similar per-card throughput can still diverge in revenue if per-stream speed is low and concurrency under the same SLO is smaller.
Three couplings:
- Batch size ↔ latency: Larger batches raise per-card throughput but lengthen step time and TTFT/TPOT tails.
- Parallelism ↔ communication: Higher tensor parallelism fits larger models and longer context, but collective communication can drop utilization if interconnect is the bottleneck.
- Cache hit rate ↔ long-input cost: High hits skip prefix compute and cut prefill; falling hits make long-context compute grow nonlinearly.
Optimize as constrained extrema: maximize goodput and revenue per card-hour subject to P90 TTFT ≤ target and SLO rate ≥ target.
5. Layered attribution of performance gaps
When results miss targets, attribute by layer rather than blaming hardware.
- Operators: Unfused small-op chains amplifying memory traffic; attention/normalization using efficient kernels; consistent precision (e.g., low-precision compute + high-precision accumulate).
- Parallelism and communication: Sharding vs interconnect topology; overlap of collectives with compute; cross-node traffic on the critical path.
- Memory and cache: Paged KV, prefix reuse, tiered offload; fragmentation causing reallocations.
- Scheduling: Continuous vs static batching; length-bucket routing; preemption and priority.
- Compile and runtime: Full graph capture, host–device sync, fallback to generic kernels.
Reusable order: sampled profiling to locate compute vs memory vs communication, microbenchmarks on candidate operators, then parallelism and batch policy.
6. Minimal cost model (keep it in CI)
Encode the cost model and rerun it on every config change:
def evaluate(config, workload, slo):# 1) Constraint check: drop configs that miss SLOif config.ttft_p90 > slo.ttft_p90_ms or config.slo_rate < slo.min_rate:return {"admissible": False}# 2) Goodput: only in-SLO requestsgoodput = config.decode_tps_per_card * config.slo_rate# 3) Unit cost (depreciation, power, ops, idle waste)cost_per_card_hour = config.depreciation + config.power + config.opseffective_cost = cost_per_card_hour / max(config.utilization, 1e-6)return {"admissible": True,"tokens_per_card_hour": goodput * 3600,"cost_per_mtok": effective_cost / (goodput * 3600) * 1e6,"revenue_per_card_hour": goodput * 3600 * config.price_per_token,}
Practice value: utilization in the denominator exposes idle waste; SLO rate as a multiplier blocks trading violations for throughput; revenue and cost together shift comparison from “faster” to “more profitable.”
7. Phased rollout and gates
- Phase 0 (1–2 weeks): Correctness and precision regression baseline; freeze eval set and input-length mix.
- Phase 1 (2–4 weeks): Operator coverage and fusion; eliminate generic fallbacks; hit utilization thresholds.
- Phase 2 (3–6 weeks): Parallelism and cache; approach goodput ceiling under SLO.
- Phase 3 (ongoing): Canary, capacity, cost accounting; weekly unit-economics reports.
Hard gates: no correctness regression, no worse P90 tails, no higher unit cost. Any failure blocks release.
8. Engineering and ecosystem
Hidden cost of scale is supporting capability. Observability: metrics, logs, alerts; drill-down dashboards for TTFT, TPOT, hit rate, batch size, memory watermarks. Capacity: load models from length mix and peak-to-trough; elastic scale on a container platform. Data: request samples and eval sets in object storage with versions. Ecosystem: operator-library completeness, compiler and profiler maturity, and developer migration cost determine whether apps can land across platforms cheaply.
9. Common mistakes
- Peak throughput instead of goodput: Ignores violations and retries; charts look good, bills do not.
- Compute-only tuning: Decode is often memory-bound; wrong direction yields little gain.
- Ignoring input mix: Short-input eval does not transfer to long-context production.
- One-shot tuning: Model versions, traffic, and hit rates drift; need periodic regression.
- Treating ecosystem as a performance problem: High migration cost blocks scale even if a single point is fast.
10. Closing
A mature inference platform is not a winning benchmark run; it is continuous, auditable unit economics on real traffic, closing the loop of runnable → fully utilized → operable. Practical path: freeze metrics and the cost model, close operator/communication/cache/scheduler gaps by layer, and gate every change so tails and bills do not pay for the win. When the books are clear and the toolchain is mature, heterogeneous accelerators can independently carry production inference.
