Cross-Node Inference Deployment for Large-Scale MoE Models: A Practical Guide
This guide explains how to deploy very large Mixture-of-Experts (MoE) models across multiple nodes for inference. It covers why cross-node deployment becomes necessary when model weights reach the terabyte scale, how to estimate memory capacity before selecting a parallelism strategy, and how tensor parallelism and pipeline parallelism divide responsibilities. It also discusses network topology and accelerator-plane checks, weight acquisition and verification, direct node-to-node transfer, container image and runtime consistency, and a configuration example for an inference service.
1. Why Very Large Models Require Cross-Node Deployment
Mixture-of-Experts (MoE) architectures route each token through only a small number of expert networks. This design separates the model’s total parameter count from its per-step compute cost. The total parameter count determines how much storage and GPU memory the weights require, while the number of activated parameters determines the compute overhead of each inference step.
As a result, the deployment challenge for MoE models is usually not compute itself, but three other factors: whether all weights fit in memory, whether they can be loaded within a reasonable time, and whether the partitioning scheme matches the hardware topology. When model weights reach the terabyte scale, a single server often cannot hold them in GPU memory, making cross-node deployment a necessary choice.
Context length also amplifies resource pressure. KV cache usage scales with context length and the number of concurrent requests. When supporting million-token contexts, GPU memory for the cache must be reserved during the planning phase.
2. Capacity Planning: Estimate Memory First, Then Choose Parallelism
Weight memory can be estimated with a simple formula:
Weight bytes ≈ number of parameters × bits per parameter / 8
With 4-bit quantization, for example, each parameter occupies about 0.5 bytes. For a model with parameters in the terabyte range, the quantized weights will also be in the terabyte range. This number determines the minimum number of compute units required.
The following example uses a set of assumed numbers to demonstrate the calculation. Assume each compute unit (die) has 64 GiB of memory, two servers have 32 units in total, and total memory is 2048 GiB, or about 2 TiB. If the total weight file size is about 1.47×10¹² bytes, or about 1.34 TiB after conversion, it accounts for roughly 65% of total memory. The remaining approximately 0.66 TiB is available for KV cache, activations, communication buffers, and runtime overhead.
Actual usable memory must also account for runtime reserved space and memory fragmentation, so planning should leave a 10% to 20% margin. If the margin is insufficient, the service may run out of memory under long-context or high-concurrency workloads.
3. Parallelism Strategy: How Tensor Parallelism and Pipeline Parallelism Divide Work
Multi-node deployments typically combine multiple parallelism methods, each with different communication requirements.
Tensor Parallelism (TP) splits matrix operations within a single layer across multiple devices. After each layer’s computation, collective communication is required to synchronize results. Communication frequency is high, and both bandwidth and latency are sensitive. Therefore, tensor parallelism groups should be placed within the same node whenever possible, using the node’s high-speed interconnect.
Pipeline Parallelism (PP) splits the model into stages by layer, with each stage placed on a group of devices. Only activation tensors need to be passed between stages, so communication frequency is lower than with tensor parallelism. This makes pipeline parallelism suitable for cross-node deployment.
The parallelism scale must satisfy the following relationship:
world size = number of nodes × devices per node = TP × PP (when data parallelism is not enabled)
In this example, each node uses 16-way tensor parallelism, and two nodes use 2-way pipeline parallelism, for a total scale of 32. The following script checks this constraint before startup:
def check_parallel_layout(nodes, devices_per_node, tp, pp):world_size = nodes * devices_per_nodeif tp * pp != world_size:raise ValueError(f"TP({tp}) x PP({pp}) must equal total devices {world_size}")if tp > devices_per_node:raise ValueError("Tensor parallelism group exceeds devices per node; cross-node communication overhead will increase significantly")return world_sizeprint(check_parallel_layout(nodes=2, devices_per_node=16, tp=16, pp=2)) # Output: 32
If the model uses an MoE structure, expert parallelism can also be layered on top by distributing different experts across different devices. Expert parallelism introduces all-to-all data exchange, and its communication pattern is more complex than the previous two methods. Its bandwidth requirements need to be evaluated separately during planning.
4. Network Topology and the Parameter Plane
Cross-node performance depends heavily on inter-node links. Before deployment, confirm the following points.
First, add the nodes participating in inference to the same accelerator network plane. Nodes within the same plane can communicate directly, reducing the number of hops through the general-purpose network.
Second, perform pairwise connectivity checks before placing instances, and record bandwidth and latency between node pairs. If any pair of nodes cannot communicate or has noticeably low bandwidth, investigate NICs, switch configurations, or driver versions before starting the model.
Third, during scheduling, prioritize node groups that are in the same network plane and have passed connectivity checks. This prevents instances from being placed on nodes with hidden link issues that could later cause intermittent communication timeouts.
5. Weight Acquisition and Distribution
5.1 Pin the Model Version
Repositories with the same name in model communities may be updated over time. During deployment, pin to a specific commit hash (revision) rather than using a branch name. This ensures that all nodes load the same weights when scaling out, rebuilding, or rolling back.
5.2 Verify Each File
Weights are typically split into hundreds of shard files. After downloading, verify the file count, total size, and each file against the hash manifest provided by the publisher.
# Count shards and total bytesfind /data/models/moe-w4a8 -type f -name "shard*" | wc -ldu -sb /data/models/moe-w4a8# If the publisher provides a hash manifest, verify each filecd /data/models/moe-w4a8 && sha256sum -c SHA256SUMS
5.3 Transfer Directly Between Nodes
The second node does not need to download the same weights from the public internet again. A more efficient approach is to copy directly from a node that has already downloaded and verified the weights. The following table compares the time required for two methods, assuming a total weight size of 1.47 TB:
| Transfer method | Assumed bandwidth | Theoretical time |
|---|---|---|
| Public internet download | 50 MB/s | About 8.2 hours |
| Direct node-to-node transfer | 490 MB/s | About 50 minutes |
Direct transfer also reduces public egress traffic and lowers the probability of failure caused by instability at the external origin. After transfer completes, verify the file count, size, and hashes on the destination node to confirm they match the source node.
6. Container Images and Runtime Consistency
Inference services depend on fixed versions of runtimes, drivers, operator libraries, and inference frameworks. If different nodes use different versions, the same model may produce inconsistent outputs or fail to start.
Two rules are recommended:
- Reference images by digest rather than by tag. Tags can be overwritten, while digests correspond one-to-one with image content.
registry.example.com/inference/runtime@sha256:<digest>
- Before startup, check the runtime version, driver version, and device visibility on all nodes, and confirm they are consistent before launching instances. This check can be placed in an initialization script and should abort on failure, preventing some nodes from participating in inference with an incorrect environment.
7. Inference Service Configuration Example
The following configuration shows the key parameters for the scenario in this article. Field names should follow the documentation of the inference framework in use:
model:path: /data/models/moe-w4a8revision: <pinned commit hash>quantization: w4a8parallel:tensor_parallel_size: 16
