The True Cost of Self-Hosting Large Language Models On-Premises
A practical breakdown of the real cost of deploying large language models in a private environment, covering GPU memory beyond weights, KV Cache scaling, three configuration tiers, the variables that amplify spending, hidden operating costs, and workload-first procurement advice.
1. Why “Open Source” Does Not Mean “Zero Cost”
When teams see that a model’s weights are openly available, the first instinct is often “just download it and run it.” In an enterprise environment, however, the weight files are only the starting point of the cost chain. Three questions actually determine the budget: whether the model fits in memory at all, how many users it can serve once loaded, and who absorbs the stability and operational burden while it runs.
Take the sample model discussed in this article. It uses a Mixture-of-Experts (MoE) architecture with roughly 743B total parameters, yet each generated token activates only about 39B parameters, and it natively supports a context window of up to 1M tokens. Each of these three numbers maps to a different cost category: total parameters set the minimum VRAM requirement, activated parameters determine compute and latency characteristics, and context length governs how fast the KV Cache expands.
2. VRAM Is More Than Weights: Four Consumers to Count Together
In a private deployment, GPU memory is claimed by at least four components:
- Model weights: converted directly from the precision in use. At FP8 this is on the order of 743GB; with 4-bit quantization it can be squeezed under 400GB, but that introduces trade-offs in accuracy and throughput.
- Runtime and framework overhead: drivers, communication libraries, the inference engine’s memory pool, graph caches, and temporary buffers typically require a few GB to a dozen or so GB of headroom.
- KV Cache: roughly proportional to “concurrency × context length × number of layers × key/value head dimension,” and the largest variable in long-context scenarios.
- Redundancy and fault-tolerance margin: tensor-parallel splits rarely divide evenly, and once failover and memory fragmentation are added, real planning should reserve 10%–20% extra.
One easily overlooked conclusion: weights determine whether you can start at all, while the KV Cache determines how many requests you can serve.
3. Two Practical Tiers: Running It vs. Serving It Reliably
Tier 1: Minimum Viable
At FP8 precision, a single flagship accelerator node with 8 cards and 141GB of VRAM per card (about 1128GB total) can hold the weights and baseline overhead on paper, with a whole-machine budget on the order of RMB 3.5 million. This tier generally supports only low-concurrency, medium-context validation workloads (for example, within 200K) and struggles to carry high-concurrency, million-token context serving.
Tier 2: Stable Support for the Full 1M Context
To maintain usable throughput at the full 1M context, planning needs two nodes (16 cards), plus high-speed interconnect, parallel storage, and redundant power, putting the budget on the order of RMB 7.3–8 million. The price difference is not “buying more cards”; it buys context capacity, concurrency headroom, and fault-domain isolation.
Tier 3: The Cost-Performance Compromise
An 8-card node with 96GB of VRAM per card, paired with a quantization scheme of 4-bit weights plus FP8 activations, can run about 200K of context. Once multi-token prediction (MTP)-style speculative decoding is enabled, single-stream generation speed can improve several times over, and with a dozen or so concurrent streams overall throughput enters the range of several hundred tokens per second, which suits agent-driven workloads. This path pushes the budget below the first two, at the cost of limited context length and peak concurrency.
4. What Amplifies the Cost: Three Sensitive Variables
- Context length: the KV Cache grows roughly linearly, so going from 200K to 1M inflates cache usage by about 5×.
- Concurrency: concurrency and cache compete for the same VRAM, so the two trade off against each other.
- Output length and generation strategy: speculative decoding, prefix caching, and paged cache management can significantly improve output per unit of cost.
An illustrative capacity-estimation logic (showing the method only, not specific product parameters):
kv_bytes ≈ 2 * layers * kv_heads * head_dim * seq_len * batch * bytes_per_elemrequired_vram ≈ weight_bytes + runtime_overhead + kv_bytes + safety_margin
5. Don’t Miss the Hidden Costs
Data center space and power (an 8-card whole machine typically needs kW-class power delivery and matching cooling), high-speed networking, parallel file storage, monitoring, alerting and logging services, model operations staff, and depreciation plus spares over 3–5 years. Once these are factored in, the hardware purchase price often accounts for only 60%–70% of total cost of ownership.
6. Decision Advice: Ask About the Workload First, Then Choose Hardware
- Define the P95 context length and peak concurrency rather than just noting that the model “supports 1M.”
- Trade cost through quantization tiers: 4-bit weights plus FP8 activations is currently the more pragmatic compromise.
- Enable prefix caching and speculative decoding, and prioritize optimizing cost per token.
- If the workload is highly elastic and peaks are not sustained, evaluate general-purpose capabilities such as container platforms, object storage, and monitoring and alerting on Baidu AI Cloud, using them elastically on demand to avoid a one-time heavy-asset investment.
- Run a small-scale benchmark before deciding the purchase quantity, and work backward from real throughput data to the number of cards.
The conclusion is straightforward: for private deployment of this class of very large MoE model, RMB 3.5 million is only the entry ticket, and genuinely high-concurrency, long-context serving requires nearly double that budget. Most workloads, however, do not need the original precision or a fully loaded context window—choosing the right tier and the right optimizations is what keeps cost under control.
