The True Cost of Self-Hosting Large Language Models
A practical breakdown of self-hosting LLM costs across three layers: VRAM admission, parallel efficiency, and billing models. Learn how to estimate hardware requirements, calculate cost per token from real throughput, account for hidden expenses, and choose between on-demand and reserved capacity.
1. Ask the Right Question: Cost Is Price per Token, Not Price per GPU
When teams evaluate self-hosting a very large model, the first instinct is to look up a GPU price list and multiply by the number of cards. That math is almost always misleading. Three variables actually drive the bill: whether the model fits, how fast it runs once it fits, and how long you have to pay for that configuration. The first is an admission threshold, the second determines effective capacity, and the third determines your billing rate.
So this article breaks cost into three layers: VRAM and hardware admission, efficiency loss from parallelism and throughput, and billing-model cost over time.
2. Layer 1: VRAM Admission Decides Whether It Runs at All
VRAM usage during inference roughly splits into weights and KV Cache. Weight usage has a general estimate:
Weight VRAM (GB) ≈ Parameters (B) × Bytes per parameterFP16/BF16 → 2 bytes; FP8 → 1 byte; INT4 → 0.5 bytes
A model in the hundreds-of-billions parameter range may need several TB of VRAM for weights alone under BF16. A single 80GB-class card cannot hold it, so multi-card tensor parallelism is mandatory. KV Cache scales roughly linearly with sequence length and concurrency:
KV ≈ 2 × layers × KV heads × head_dim × sequence length × concurrency × bytes
A more practical engineering approach is to work backwards: fix your target concurrency and context length, calculate the KV budget, then use the remaining VRAM to decide how large a batch you can run. Many “deployment failures” are not about weights failing to fit — concurrency ramps up and KV alone maxes out VRAM.
3. Layer 2: Parallel Strategy and Efficiency Loss
Multi-card deployment does not scale linearly. The common combination is tensor parallelism (splitting matrices within a layer, frequent communication, suited to fast intra-node interconnect) plus pipeline parallelism (splitting layers, less communication but with bubbles). The rule of thumb: prefer tensor parallelism inside a node, pipeline parallelism across nodes, and align the parallelism degree with NIC and topology boundaries.
Efficiency loss comes from three places: communication overhead from cross-card all-reduce, pipeline bubbles, and idle compute caused by batch scheduling. So when evaluating cost, do not look at GPU-hours alone — look at effective throughput, meaning output tokens per second.
4. Layer 3: Billing Model, On-Demand or Reserved
Data-center-class accelerator cards are typically only available from cloud platforms, and pricing generally comes in two forms:
- On-demand / per-second billing: flexible, suited to load testing, validation, and short-term events, with the highest unit price;
- Monthly or long-term reserved: significantly lower unit price, but requires a commitment period, suited to stable production services.
The order of magnitude from the source material works as a reference: a cloud provider’s data-center-class accelerator card runs about $4.76 per card per hour on a 12-month reservation, or about $38.08 per hour for an 8-card node. That works out to:
Monthly cost ≈ 38.08 × 24 × 30 ≈ $27,417 per node per monthCost per token = node hourly cost ÷ (output tokens per second × 3600)At 2000 tokens/s → about $0.0053 per thousand tokens
The value of this formula: every doubling of throughput halves the unit cost. So optimizing the inference engine, improving batch utilization, and trimming unnecessary context saves more money than cutting configuration.
5. Hidden Costs That Are Easy to Miss
- Storage and data movement: model weights run to several TB, requiring object storage and high read bandwidth; load time directly lengthens scale-out time.
- Networking: multi-node deployment is bandwidth-sensitive, and cross-availability-zone communication can eat into parallel gains.
- Ops and observability: logging, monitoring and alerting, and container platforms are necessities, and labor cost is often underestimated.
- Redundancy and failure domains: a single 8-card node failure takes the whole node offline, so spare capacity must be reserved.
- Elasticity and trough waste: the biggest risk of the reserved model is still paying through the overnight trough.
6. A Decision Process You Can Actually Use
- Define the business SLA: time to first token, output rate, peak concurrency;
- Use the formulas above to compute VRAM and minimum card count, rounding up to whole nodes;
- Load test to get real throughput and plug it into the cost-per-token formula;
- Multiply real monthly call volume by cost per token and compare against the reserved monthly fee;
- If demand fluctuates, use a hybrid strategy of “reserved baseline plus on-demand for peaks”;
- If unit cost is still above the acceptable range, consider quantization, a smaller parameter-scale model, or a managed inference service first.
7. Conclusion
The core of self-hosting cost is not the hardware quote but the multiplicative relationship among VRAM admission × effective throughput × billing cycle. Work out the formulas first, then talk about model selection — that is the only way to avoid the triple waste of “can afford it, cannot run it, cannot fill it.”
