How to Calculate the Real Cost of Self-Hosting a Large Language Model
A practical cost framework for self-hosting large language models, covering the four variables that drive budget (weight size, activated parameters, context length, concurrency), why MoE cuts compute costs but not VRAM costs, how KV Cache sizing determines real concurrency, two reference budget tiers, and the hidden costs teams usually miss.
1. Define the Problem First: Where the Cost Boundary Actually Sits
When teams try to answer “how much does it cost to self-host a large language model,” they usually start with “how many GPUs do I need?” That framing oversimplifies the problem. Real cost is not determined by parameter count alone. It is determined by four variables working together: total weight size, the number of parameters activated per inference pass, context length, and the concurrency target. Change any one of them and the budget moves by a multiple.
Take the sample model used in this article. It is a Mixture-of-Experts (MoE) architecture with roughly 743B total parameters, but only about 39B parameters are activated per generated token, and it natively supports a 1M context window. Those three numbers map to three entirely different cost categories:
- The 743B total parameter count sets the VRAM floor, because all weights must be resident.
- The 39B activation count sets compute consumption and throughput, which drives GPU utilization and concurrency capacity.
- The 1M context sets the VRAM ceiling, because the KV Cache grows linearly, or worse, with context length.
The conclusion is straightforward: MoE makes the compute bill cheaper, but it does not make the VRAM bill cheaper. This is the single most commonly misjudged point when self-hosting any MoE model.
2. The VRAM Bill: Why Fitting the Weights Is Only the Entry Ticket
Self-hosting does not consume VRAM with weights alone. It also consumes it with the runtime framework, operator libraries, communication buffers, and most importantly the KV Cache.
The weight side is relatively easy to estimate. Stored at FP8 precision, 743B parameters need on the order of 743GB of VRAM. That single item already exceeds the total VRAM of a typical 8-GPU server, so the deployment has to span multiple machines. Lower precision or quantization schemes can reduce the footprint, but they introduce accuracy loss and extra dequantization overhead. Whether that tradeoff is acceptable depends on how much output quality the business can tolerate.
The KV Cache is what actually eats the budget. Its size scales with context length × concurrency × number of layers × hidden dimension. A 1M context means a single long request can consume tens of gigabytes of VRAM on its own. Add high concurrency on top of that and the VRAM requirement quickly exceeds physical limits.
A rough capacity calculation looks like this (values are order-of-magnitude illustrations, not product specifications):
available VRAM = total VRAM - weight footprint - framework and runtime overhead - communication buffersserviceable concurrency ≈ available VRAM / KV Cache per request (context length, layers, hidden dimension)
This formula explains the real reason a budget of roughly RMB 3.5 million may not support high-concurrency 1M context: it is not that there are not enough GPUs, it is that there is not enough headroom left for the KV Cache.
3. The Compute Bill: MoE’s “Cheapness” Is Conditional
Activating about 39B parameters per token means the compute per token is significantly lower than a dense model with the same total parameter count. But three caveats apply:
- Under high concurrency, MoE expert routing creates load imbalance. Some GPUs sit idle while others queue, so actual throughput falls below the theoretical number.
- In multi-node deployments, expert parallelism generates heavy inter-node traffic, and network bandwidth becomes a hard constraint.
- In long-context scenarios, attention computation complexity rises and partially cancels out the compute advantage.
So what MoE reduces is the cost per token, not the total compute budget. When budgeting, use worst-case concurrency and maximum context length, not averages.
4. Two Budget Tiers: Entry Ticket vs. Stable Service
The structure above supports splitting the budget into two tiers.
Tier one is the minimum runnable configuration. The FP8 version needs roughly one 8-GPU high-VRAM accelerator server, with an overall budget on the order of RMB 3.5 million. Its role is validation and trial: it runs and produces results, but under long context and high concurrency it will queue, time out, or force a lower context limit.
Tier two is stable service capacity. To sustain usable throughput at the full 1M context, plan for two nodes, meaning two 8-GPU high-VRAM servers plus a high-speed interconnect, for a budget of roughly RMB 7.3–8 million. The value of the second node is not just capacity. It is high availability: service continues when a single node fails, and rolling upgrades and canary releases only become possible at that point.
The difference between the two tiers essentially buys three things: KV Cache headroom, inter-node bandwidth, and availability redundancy.
5. Four Categories of Hidden Cost That Get Missed
- Networking: cross-node inference is sensitive to bandwidth and latency, so a high-speed interconnect is a requirement, not an option.
- Data center and power: high-VRAM accelerators demand significant power and cooling, so racks, power delivery, and cooling must be planned alongside them.
- Operations headcount: model adaptation, quantization tuning, monitoring and alerting, and capacity reviews all need dedicated people.
- Software stack adaptation: integrating and continuously upgrading the inference framework, operator libraries, scheduling layer, and monitoring system is a long-term investment.
Running on general-purpose cloud capabilities can convert part of that fixed spend into on-demand usage: a container platform for elastic scheduling, object storage for archiving models and data, and monitoring, alerting, and logging services for observability. That reduces the pressure of a large one-time capital outlay.
6. A Reusable Checklist for Decision Makers
- Define the goal: trial and validation, or production-grade high-concurrency long-context service.
- Set the precision: FP8 or lower, and assess whether the quality loss is acceptable.
- Calculate VRAM: weights + runtime + KV Cache, sized at maximum context length and peak concurrency.
- Leave redundancy: at least two nodes, to guarantee high availability and room for upgrades.
- Count the hidden costs: network, power, data center, headcount, software stack.
- Make the tradeoff: self-hosting buys data control and compliance; the cloud buys elasticity and low initial investment.
7. Conclusion
An open model is not the same as a cheap deployment. For an MoE model with 743B total parameters, 39B activated parameters, and a native 1M context, RMB 3.5 million is only the entry ticket; RMB 7.3–8 million is the realistic budget for stable full-long-context service. The genuinely professional approach is to first build a four-dimensional model covering weights, KV Cache, concurrency, and availability, and only then decide between self-hosting and elastic cloud capacity.
