Local Deployment of Open-Source MoE LLMs: Cost Analysis and VRAM Estimation for Multi-GPU Setup
This article explains how to evaluate the economics of deploying open-source MoE (Mixture-of-Experts) large language models on your own servers instead of using token-billed APIs. It covers the full cost formula for self-hosting, the three bottlenecks to assess before deployment (VRAM capacity, inference throughput, and communication overhead), and a step-by-step method for estimating VRAM requirements on a single node with multiple GPUs, including weight quantization trade-offs and KV Cache sizing for long-context workloads.
1. First, Calculate What Local Deployment Actually Saves
Token-billed APIs can quickly generate monthly bills in the tens of thousands of dollars under high-frequency usage. Deploying models on your own servers converts pay-per-use spending into a fixed investment. However, this calculation cannot be based on hardware prices alone. The complete cost includes the following items:
- Hardware depreciation: Servers and GPUs are typically amortized over 3 to 5 years.
- Electricity and facilities: A fully loaded 8-GPU high-end server can draw several kilowatts or more, so power rates and cooling costs must be factored in.
- Operations staff: Model upgrades, driver maintenance, and troubleshooting all require dedicated personnel.
- Waiting cost: During the procurement-to-production cycle, the business cannot use the inference capability at all.
A simple formula can be used for an initial assessment:
Monthly self-hosting cost = Total hardware price ÷ Depreciation months + Monthly electricity + Monthly operations labor cost
Local deployment only makes economic sense if this value is lower than the monthly API bill for equivalent usage, and if the workload is stable. When business volume fluctuates significantly, the cost of idle periods must also be included.
2. Three Bottlenecks to Evaluate Before Deployment
- VRAM capacity: Model weights, the KV Cache, and activation values all consume GPU memory. Although MoE models activate fewer parameters per token, the total parameter count is still very large, so the weights alone require substantial VRAM.
- Inference throughput: Expert routing produces irregular memory access patterns. GPUs often wait for data, resulting in low compute unit utilization.
- Communication overhead: In multi-node parallelism, expert routing information and tensor synchronization depend on network bandwidth and latency. The network can become the performance ceiling.
3. Option 1: Single-Node Multi-GPU Quantized Deployment — How to Estimate VRAM
This section assumes a model with approximately 300B total parameters and about 13B activated parameters, running on a server with 8 GPUs of 80GB VRAM each (640GB total). For actual model selection, replace these figures with the real values from the target model’s config.json.
Step 1: Estimate weight footprint. Weight bytes equal the parameter count multiplied by bytes per parameter.
| Weight Precision | Bytes per Parameter | Weight Footprint | Remaining from 640GB (8 GPUs) After Weights | Conclusion |
|---|---|---|---|---|
| FP16/BF16 | 2 | ~600GB | ~40GB | After subtracting activations and framework overhead, long context is barely supportable. Not recommended |
| INT8 | 1 | ~300GB | ~340GB | Usable; suitable for medium context lengths |
| INT4 | 0.5 | ~150GB | ~490GB | Most headroom in VRAM, but highest precision risk |
In practice, reserve roughly 10% of VRAM for activations, CUDA Graphs, and the framework itself. Therefore, the usable KV Cache space under the INT8 plan is approximately 260GB.
Step 2: Estimate KV Cache. The KV Cache bytes per token are calculated as follows:
Bytes per token = 2 × Number of layers × Number of KV heads × Head dimension × Bytes per element
The factor of 2 accounts for the separate K and V caches. Assuming the model has 60 layers, 8 KV heads (grouped-query attention), a head dimension of 128, and FP16 caching, the per-token footprint is:
2 × 60 × 8 × 128 × 2 = 245,760 bytes ≈ 240KB
Based on this figure:
- A single 128K context consumes about 30GB. With roughly 260GB available under INT8 weights, about 8 such sequences can be served concurrently.
- A single 1M (one million token) context consumes about 240GB. Under INT8 weights, this essentially supports only a single concurrent request.
- If the KV Cache uses FP8 instead, the footprint is halved and concurrency roughly doubles, but precision must be verified as acceptable.
Step 3: Understand the role of PagedAttention. PagedAttention borrows the concept of virtual memory paging from operating systems, allocating KV Cache blocks on demand to reduce memory fragmentation and reservation waste. It improves utilization of available VRAM, but it does not reduce the total KV volume required by a single long sequence. Long contexts still demand sufficient memory.
Conclusion: An 8-GPU INT8 deployment can host a 300B-class model and support medium context lengths with moderate concurrency. If the goal is million-token contexts with concurrency greater than one, you need INT4 weights, FP8 KV Cache, or machines with larger memory capacity.
The precision and throughput risks introduced by quantization are as follows:
- INT8 typically incurs minor precision loss, but validation is still required.
- INT4 may show noticeable degradation on tasks such as code generation and mathematical reasoning. Use your own evaluation set to compare FP16, INT8, and INT4.
