Deploying Very Large MoE Models Across a Multi-Node Cluster: Key Practices
This article walks through the practical considerations for deploying very large Mixture-of-Experts (MoE) models on a private multi-node cluster, covering memory budgeting, KV cache estimation, expert pre-fetching, RDMA/RoCE networking, and inference engine setup. It uses a four-node example cluster to illustrate capacity planning and configuration checks, with all numbers serving as adjustable references for your own hardware and workload.
1. Scope and Prerequisites
This article is aimed at technical teams that need to deploy very large MoE models on their own infrastructure. All figures and parameters used here are examples; actual values depend on the model specification, hardware, and business workload. Before reading further, confirm three things: whether the model license permits local deployment and commercial use, whether your data meets the compliance requirements of your industry, and whether your team can maintain multi-node networking and inference services.
The example cluster used in this article consists of four compute nodes, each equipped with unified memory or large-capacity VRAM, interconnected over high-speed Ethernet with RDMA support, and each with local NVMe SSDs. If your hardware scale differs, the same calculation methods apply—just substitute your own parameters.
2. Deployment Architecture and Memory Boundaries
The basic idea behind multi-node inference is to shard the model weights across multiple machines so they collectively complete each forward pass. Users see a single inference endpoint, while sharding, communication, and scheduling are handled by the inference engine and a unified gateway.
Capacity is only the first hurdle. Three other factors also determine performance:
- Memory bandwidth: During decoding, every generated token requires reading the currently activated weights from memory. When per-node available bandwidth is low, generation speed per request is limited even if capacity is sufficient. A rough lower bound for per-token latency can be estimated as: the bytes of activated weights each node must read, divided by that node’s available memory bandwidth.
- NUMA and cross-node access: On multi-socket CPUs or multi-chiplet packages, memory access differs between local and remote. Inference processes should be pinned to the corresponding NUMA node to avoid weights being read across nodes.
- Cross-node communication: Synchronization after each layer’s computation introduces network round trips. With small-batch decoding, network latency is often more noticeable than compute.
Complete the following checks before deployment:
- Confirm the model license, data storage location, and access auditing policies;
- Ensure free disk space on each node exceeds the total size of the weight files, with headroom for logs and caches;
- Record each node’s NUMA topology, driver versions, and kernel parameters;
- Define a rollback plan for failures, such as keeping the previous model directory and service configuration;
- Restrict each node’s unified memory to that node only, isolate service processes from each other, and promptly clean up sensitive data after shutdown.
3. Weight Layering and KV Cache Budgeting
Deploying a very large MoE model is fundamentally a memory budgeting exercise. Divide memory into three parts: resident model weights, KV cache, and runtime overhead.
1. Estimating Resident Weights
Weight bytes are approximately the parameter count multiplied by bytes per parameter. For example, with 671B total parameters stored in FP8, all weights come to roughly 671GB. This is the theoretical value when all experts are resident in memory. If experts are tiered off to NVMe, the resident portion should include shared layers, attention layers, and high-frequency experts, with the remaining experts pre-fetched from SSD on demand.
2. Estimating KV Cache
For models using standard multi-head attention (MHA) or grouped-query attention (GQA), the KV cache bytes per token can be estimated as:
KV bytes = 2 × number of layers × number of KV heads × head dimension × bytes per element
Total KV cache usage equals per-token bytes multiplied by “concurrent requests × average context length.” For models using Multi-head Latent Attention (MLA), the cache structure differs—follow the formula given in the model documentation.
3. Pre-fetching and Alerts
Cold-expert pre-fetching can be driven by routing statistics. During offline stress testing, record each expert’s activation frequency, pin the most frequently activated experts in memory, and queue the rest for pre-fetching based on historical frequency. Parameters such as the pre-fetch window should be tuned during stress testing, starting from conservative values. Trigger an alert when memory usage exceeds roughly 85%, and reduce the maximum concurrency when it exceeds roughly 92% to avoid runtime OOM.
These thresholds are empirical starting points only—re-validate them against your peak production load.
4. Network Design and RoCE Configuration
At a four-node scale, a switched star topology is easier to manage than direct node-to-node connections. Each node connects to a single high-speed switch through one or more links, and fault isolation focuses on switch ports.
Tensor parallelism communication volume depends on the number of model layers, hidden dimension, and batch size. When selecting hardware, verify three items: switch port speeds, per-node RDMA NIC bandwidth and port count, and switch buffer sizes.
A lossless RoCE network relies on PFC and ECN working together. A typical configuration approach is as follows—for exact commands, refer to your switch and NIC vendor documentation:
- Assign RDMA traffic a dedicated priority and enable PFC on that priority;
- Enable ECN marking on the switch, with thresholds set according to buffer size and link speed;
- On the hosts, configure DSCP-to-priority mappings consistent with the switch, and confirm the congestion control algorithm is enabled;
- Before going live, measure bandwidth and latency for both single links and all-node concurrent traffic.
For validation, run ib_write_bw or ib_send_bw between nodes, and use NCCL’s built-in all_reduce_perf to check collective communication bandwidth. If PFC counters keep growing or retransmission counts are abnormal, troubleshoot the congestion point and priority mappings first rather than simply increasing buffers.
5. Inference Engine Configuration
The first step in multi-node deployment is getting all nodes’ inference processes into the same communication group. Using vLLM as an example, start a Ray cluster on the head node, have the other nodes join it, then launch the service from the head node. The following example illustrates the meaning of the parameters—actual parameter names should follow the documentation for your version:
# Head noderay start --head --port=6379# Worker nodesray start --address=<head-node-IP>:6379# Launch the service on the head nodevllm serve <model-path> \--tensor-parallel-size 4
Once all nodes join the same communication group, the engine handles weight sharding and cross-node synchronization automatically, presenting a single endpoint to clients.
