Local Deployment of MoE Large Models: VRAM Estimation and Architecture Selection
Deploying a Mixture-of-Experts (MoE) model locally requires planning around memory capacity, concurrency targets, and hardware topology. This guide breaks deployment needs into three performance tiers, walks through VRAM estimation for model weights and KV Cache, compares GPU super-node clusters with CPU-GPU heterogeneous setups, and provides a selection checklist plus a cost comparison between self-hosting and cloud deployment.
1. Define Three Deployment Tiers First
Before deployment, you need clear performance targets—otherwise there is no way to judge whether your hardware is sufficient. This article divides local deployment requirements into three tiers:
| Tier | Goal | Measurement Notes |
|---|---|---|
| Basic usable tier | The model loads and produces correct outputs; speed is not a requirement | Suitable for functional validation, algorithm testing, and offline batch processing |
| Smooth single-user tier | Single-user output speed reaches roughly 25 tokens/s | Specify input length, output length, and the test environment |
| Enterprise concurrency tier | Supports 10+ concurrent requests while keeping single-user speed above 25 tokens/s, with quantization no lower than 4-bit | Specify the definition of concurrency, P95 or P99 latency, and context length |
The 25 tokens/s figure is an experience-based target for interactive use, not a universal standard. Metrics for the concurrency tier likewise depend on the specific workload. For example, if 10 concurrent requests each carry a long context, memory pressure and latency will be noticeably higher than with short inputs. Therefore, you should stress-test with request lengths from your real business before deciding on hardware scale.
2. VRAM Estimation: Weights First, Then KV Cache
VRAM usage is determined by two parts: model weights and runtime state. A key characteristic of MoE models is that VRAM usage depends on the total parameter count, not on how many experts each token activates. Even if each token activates only 16 experts, all experts’ weights must be loaded into VRAM or memory at inference time—otherwise they cannot be called on demand.
This article uses a hypothetical configuration as an example: 2.8 trillion total parameters, 896 expert networks, with each token activating 16 experts. This configuration is used to demonstrate the calculation method, not the official specs of any released model. For actual deployment, always rely on the model card or configuration file.
Weight VRAM is calculated as:
Weight VRAM = parameter count × effective bits per parameter ÷ 8
With MXFP4 format, every 32 4-bit elements share one 8-bit scale, giving an effective width of 4.25 bits per parameter. Substituting the example:
2.8×10¹² × 4.25 ÷ 8 ≈ 1.4875×10¹² bytes ≈ 1487.5 GB
If you count only the raw 4-bit data, the result is about 1400 GB. That is the theoretical floor for weights. Real deployments add the following overhead:
- Unquantized tensors, such as some embedding layers or normalization layers
- Alignment padding and metadata
- Framework runtime working memory
KV Cache VRAM grows with context length and concurrency, per the formula:
KV Cache = 2 × layers × KV heads × head dimension × context length × concurrency × bytes per element
Using example values: 60 layers, 8 KV heads, head dimension 128, BF16 format (2 bytes per element), 32K context, and 10 concurrent requests yields roughly 80.5 GB. This formula applies to standard multi-head or grouped-query attention architectures. If the model uses a compressed cache mechanism such as MLA, cache size must be recalculated according to that architecture’s actual form.
As a reference point, a model with about 671B parameters requires roughly 671 GB of weight VRAM in FP8. The example configuration has about 4.2 times as many parameters, so even with both quantized to 4-bit, the larger model’s weight VRAM will be significantly higher.
3. Two Main Deployment Approaches
Option 1: GPU Super-Node Cluster
The core challenge of all-GPU deployment is communication. In MoE inference, after routing, each token’s activations must be sent to the accelerator hosting the target experts, then the results sent back. The more cards the experts are spread across, the more frequent this All-to-All communication becomes.
For this reason, enterprise concurrency scenarios typically use super-nodes composed of multiple accelerators, relying on NVLink or similar high-speed interconnects to enlarge the communication domain. Common configurations use dozens of accelerators; the exact count depends on weight VRAM, KV Cache, and concurrency targets. Super-nodes offer controllable latency, but come with high acquisition costs and demanding power and cooling requirements.
Option 2: CPU-GPU Heterogeneous Deployment
For the basic usable or smooth single-user tiers, expert weights can live in large-capacity system memory while attention and routing stay on the GPU. Attention is compute-intensive but has few parameters, so it fits well in VRAM. Expert layers carry most of the parameters, but each token only uses a few of them, so they fit well in CPU memory.
The key limitation of this approach is PCIe bandwidth. If every token requires copying the selected experts’ weights from CPU to GPU, the transfer volume far exceeds that of activations, and decode speed becomes bandwidth-bound. A more sensible approach is to compute experts directly on the CPU and transfer only activations over PCIe. With PCIe 5.0 x16 offering roughly 64 GB/s of theoretical bandwidth, the amount of weight you can move per second is limited—keeping weights resident on the CPU is the better trade-off.
The following is a logical sketch and is not runnable as-is:
def moe_layer_forward(hidden, layer):# 1. Attention and routing run on the GPU; KV Cache stays in VRAMh = attention(hidden, layer.attn_weights)logits = h @ layer.router_weight # [batch, num_experts]topk_idx, topk_w = topk_softmax(logits, k=16) # select 16 experts per token# 2. Group tokens by expert so tokens using the same expert are batched togethergroups = group_tokens_by_expert(topk_idx) # {expert_id: (token indices, weights)}# 3. Expert weights stay in CPU memory; compute on CPU and transfer only activationsx_cpu = h.to("cpu", non_blocking=True)y_cpu = zeros_like(x_cpu)for expert_id, (tok_idx, w) in groups.items():y = cpu_expert_ffn(x_cpu[tok_idx], cpu_experts[expert_id])y_cpu.index_add_(tok_idx, y * w)# 4. Send results back to the GPU and merge with shared expert output (if the model has one)out = y_cpu.to("cuda", non_blocking=True)return out + shared_expert_forward(h)
A production framework must also handle the following:
- Prefetching and caching: Keep frequently used experts in GPU cache, evicting entries by LRU or usage frequency when the cache is full.
- Batching: The prefill phase can process many tokens in batches, while the decode phase processes only a few tokens per step, limiting throughput.
- Overlapping compute and transfer: Use asynchronous copies so the next layer’s data transfer runs in parallel with the current layer’s computation.
- Dependency versions: CUDA, drivers, the inference framework, and the model implementation must be compatible; version mismatches can change both results and performance.
When comparing the two options, rely on your own stress-test data. Speed figures in public materials often lack complete test conditions and should not be used directly for selection decisions.
| Item | GPU Super-Node | CPU-GPU Heterogeneous |
|---|---|---|
| Suitable tier | Enterprise concurrency | Basic usable, smooth single-user |
| VRAM and memory | Weights distributed across multiple accelerators | Attention and KV Cache on GPU; experts in CPU memory |
| Main bottleneck | All-to-All communication | PCIe bandwidth and CPU compute capacity |
| Hardware cost | High; requires supporting power and cooling | Relatively low, but needs a large-memory server |
| Main risks | Long procurement cycles; wasted cost if utilization is low | Slow decoding; low concurrency ceiling |
4. Selection Checklist
Before settling on an architecture, confirm each of the following:
- Have target concurrency, input/output lengths, and latency requirements been measured with real requests?
- Does the combined total of weight VRAM, KV Cache, and framework overhead leave sufficient headroom?
- Is the model’s quantization format supported by your chosen inference framework?
- Can the data center’s power, cooling, and networking meet the hardware requirements?
- Are there operations staff who can maintain drivers, frameworks, and monitoring systems?
If many of these questions remain unanswered, validate at small scale first.
5. Self-Hosting vs. Cloud: Cost Comparison
Self-hosting costs mainly include hardware depreciation, electricity, facility expenses, and operations staffing. Cloud costs are driven primarily by instance pricing
