MoE Multi-Node Deployment: Memory Sizing, Network Topology, and a Go-Live Checklist

    Deploying a Mixture-of-Experts (MoE) model across multiple GPU nodes comes down to three questions: where the weights live, how nodes communicate, and how the serving layer orchestrates everything. This article walks through resource estimation, network topology selection, expert placement, inference serving parameters, load testing and troubleshooting with rollback, plus a pre-launch checklist. All model parameters in the worked examples are assumed values—replace them with your actual numbers before going live.

    1. Resource Estimation and Per-GPU Budgeting

    1.1 Weight Footprint

    Weight memory (GB) ≈ total parameters (billions) × bytes per parameter. Always use the total parameter count when calculating weights. Although a MoE model only activates a subset of experts per token, the weights of all experts must reside in GPU memory—so never estimate weights based on activated parameters.

    For example, a 100B-parameter model requires roughly 100GB in FP8 (1 byte per parameter), or about 50GB of pure weights at 4-bit quantization (0.5 bytes per parameter). These figures exclude quantization scale factors (scales, zero-points) and memory alignment overhead, so actual usage will be slightly higher.

    1.2 KV Cache Footprint

    The KV cache stores attention keys and values for tokens already processed, avoiding recomputation. The KV cache per token is:

    2 × number of layers × number of KV heads × head dimension × bytes per element

    The factor of 2 accounts for K and V caches.

    Worked example (assumed parameters): 60 layers, 8 KV heads (GQA), head dimension 128, FP16 KV cache (2 bytes).

    • Per token: 2 × 60 × 8 × 128 × 2 = 245,760 bytes ≈ 0.25MB.
    • Worst case at full context: each request spans 32K tokens (32,768), with 16 concurrent requests totaling 524,288 tokens.
    • Total KV cache: 245,760 × 524,288 ≈ 128.8GB (decimal).

    This is the worst case at full context. Real-world request lengths vary, so recalculate using P95 or P99 lengths rather than the average. KV cache grows linearly with concurrency and context length. If the model uses MHA, the number of KV heads equals the number of attention heads and the cache grows proportionally. KV cache quantization (e.g., FP8) can halve this footprint, but output quality must be validated with real traffic.

    1.3 Summary and Headroom

    Weights (100GB) plus KV cache (~129GB) totals roughly 229GB. Add activation memory, runtime overhead, and communication buffers. With 20–30% headroom reserved, total demand comes to about 275–298GB.

    1.4 Per-GPU Budgeting

    This article assumes one model instance spans four 80GB GPUs with tensor parallelism of 4. The table below lists three accounting bases—do not mix them.

    Basis Total (GB) Per GPU (GB)
    Weights + KV cache only 229 ~57
    With 20% headroom ~275 ~69
    With 30% headroom ~298 ~74

    With 80GB per GPU, the per-GPU requirement with headroom (69–74GB) already exceeds 85% of memory capacity (68GB), so the configuration must be downgraded before launch. The remaining headroom must also absorb the CUDA context, communication buffers, and framework overhead, so actual sustainable concurrency will be lower than theoretical values.

    Capacity Checklist

    • Confirm total parameter count, precision, maximum context length, and maximum concurrency.
    • Compute weights and KV cache separately, then add 20–30% headroom.
    • If per-GPU usage exceeds 85% of memory capacity, adjust the configuration before launch. The 85% figure is the conservative threshold used in this article to leave room for the CUDA context and burst peaks—it is not an industry standard.
    • If the threshold is exceeded, downgrade in this order: first reduce maximum context length, then reduce maximum concurrency, then consider lower-precision weights or KV cache, and finally add GPUs.

    Downgrade example: reducing maximum context from 32K to 16K roughly halves the KV cache to ~64.4GB, bringing the total to ~164GB. With headroom, per-GPU usage drops to ~49–53GB, below the 68GB threshold.

    Verification Method

    After loading the model, trust actual memory readings rather than theoretical values.

    1. nvidia-smi --query-gpu=index,memory.used,memory.total,utilization.gpu --format=csv -l 5

    Record peak memory during sustained load tests, and monitor memory and utilization via DCGM (dcgmi dmon) or framework-native metrics. Verification conditions should match production: same model version, same precision, same context distribution (P95 or P99), and same concurrency. If peak usage exceeds 85%, return to the downgrade sequence.

    2. Network Topology Selection

    Four nodes is a common starting scale. Assume each node has one 400Gb/s NIC. Note that 400Gb/s is nominal line rate—after protocol overhead, effective throughput must be measured with ib_write_bw or nccl-tests.

    Oversubscription ratio is the ratio of downstream to upstream aggregate bandwidth. 1:1 means no aggregation bottleneck; 2:1 means upstream bandwidth is half of downstream.

    Topology Ports and Bandwidth Oversubscription Cost and Cabling Failure Domain Scalability
    A: Single fully connected switch 1× 400G port per node; switch needs 4× 400G ports 1:1 Lowest cost, 4 cables Switch is a single point of failure; a switch failure halts all inter-node communication Limited by switch port count; requires hardware replacement to scale
    B: Dual Leaf, dual Spine 2× 400G ports per node, each connecting to a different Leaf; each Leaf has 4 downstream ports 1:1 Moderately high cost, more cabling If one Leaf fails, nodes communicate via the other; if one Spine fails, bandwidth is halved Good; more Leafs can be added
    C: Two directly connected Leafs Each Leaf connects 2 nodes; 1× 400G interconnect between Leafs 2:1 Low cost, minimal cabling The interconnect is a bottleneck; cross-Leaf traffic is constrained Moderate; switch to B when interconnect bandwidth is insufficient

    Recommendation: In this article’s scenario, tensor parallelism involves frequent cross-node communication, so global bandwidth matters a lot. For validation environments, choose A—lowest cost with no oversubscription. For production environments requiring redundancy, choose B. C only suits scenarios with low cross-node traffic and is not recommended for the 4-GPU tensor parallel setup described here.

    Verify links before launch:

    1. ib_write_bw -d <nic> -s 1048576 -n 5000 # run once on server and once on client

    For RoCE networks, also confirm that PFC and ECN settings match the switch configuration.

    3. Expert Placement Checklist

    A MoE model has multiple routed experts per layer, and experts are distributed across GPUs. Uneven placement turns some GPUs into bottlenecks.

    Verify each item before launch:

    1. The number of experts per layer is divisible by the expert parallelism degree, and each GPU holds the same number of experts. For example, with 64 experts and expert parallelism of 4, each GPU hosts 16.
    2. Shared experts (if the model has them) keep one copy per GPU and are excluded from routed-expert placement.
    3. Collect per-layer routing hit rates and compute the token count received by each GPU. The ratio of maximum to average is the key metric—start with a threshold of 1.2 and calibrate it against real traffic.
    4. Do not concentrate high-frequency experts on the same node. If one node hosts too many hot experts, cross-node all-to-all traffic will pile up on that node’s NIC.
    5. Run routing statistics with real samples, not just random inputs. The distribution of random inputs usually differs from production traffic.
    6. Record the placement table for every layer as a baseline before changes, to enable comparison during rollback.

    4. Inference Serving Parameters

    The parameter names below follow vLLM conventions; substitute the equivalents for other frameworks. Parameter names change between versions—defer to the official documentation of your version.

    • tensor-parallel-size: 4, matching the GPU count in this article.
    • enable-expert-parallel: enable expert parallelism.
    • max-model-len: 16384 or 32768, consistent with the maximum context used in capacity calculations.
    • gpu-memory-utilization: 0.85, aligned with the memory threshold.
    • max-num-seqs: match the maximum concurrency from capacity calculations; start conservatively.
    • kv-cache-dtype: keep FP16 by default. Switch to FP8 only after quality validation passes.

    At the serving layer, also configure request timeouts, maximum queue length, and rate-limit thresholds. The rate-limit threshold should sit below the concurrency inflection point measured in load tests, preventing latency from growing unbounded under overload.

    5. Load Testing, Troubleshooting, and Rollback

    Monitor four categories of metrics during load tests:

    • Latency: time to first token (TTFT), time per output token (TPOT), P95 and P99 end-to-end latency.
    • Throughput: output tokens per second and completed requests.
    • Memory: peak GPU memory usage, threshold 85%.
    • Network: NIC packet drops, error counters, and retransmissions. Any packet loss on an RDMA network should be treated as abnormal.

    Check NIC counters with:

    1. ethtool -S <nic> | grep -iE "drop|err|discard"

    Suggested troubleshooting order:

    1. If GPU memory is near the threshold, first check KV cache configuration and maximum concurrency.
    2. If one GPU’s utilization is clearly higher than the others, revisit the expert placement checklist and inspect routing skew.
    3. If cross-node latency rises, measure collective communication bandwidth with nccl-tests and check NIC counters.
    4. If packet loss appears, check cables, switch ports, and PFC/ECN configuration.

    Changes and rollback:

    • Before any change, back up the current configuration files, model weight versions, container image tags, and the expert placement table.
    • Canary new configurations with 10% of traffic first, watching P99 latency, error rate, and peak memory. The canary duration should match your business traffic cycle—it is not a fixed value.
    • If any metric degrades, immediately switch back to the old configuration. The rollback method depends on your deployment platform, e.g., kubectl rollout undo deployment/, or restoring the backed-up configuration and restarting the service.
    • After rollback, confirm metrics return to baseline, and retain logs and NIC counter snapshots for post-incident analysis.

    Pre-Launch Checklist

    • Total parameter count, precision, maximum context length, and maximum concurrency confirmed with real values.
    • Per-GPU memory requirement with headroom does not exceed 85%, verified against actual memory readings.
    • Network topology selected, and link bandwidth measured with ib_write_bw or nccl-tests.
    • Expert placement table generated, with the max-to-average token load ratio calibrated.
    • Inference serving parameters consistent with capacity calculations, and rate-limit thresholds below the load-test inflection point.
    • Backup, canary, and rollback procedures rehearsed.