Deploying Ultra-Large-Scale MoE Models on Domestic AI Accelerators: A Dual-Node Practical Guide
This article walks through the practical steps of deploying ultra-large-scale MoE (Mixture-of-Experts) models across two nodes on domestic AI accelerators. It covers the core deployment challenges, GPU memory estimation, W4A8 quantization trade-offs, distributed parallelism strategies (tensor, pipeline, and expert parallelism), inference engine and container image preparation, a step-by-step deployment workflow, and performance tuning guidance. It is aimed at engineers who need to serve trillion-scale MoE models under constrained hardware.}
The Real Challenges of Deploying Ultra-Large-Scale MoE Models
In recent years, natively multimodal Mixture-of-Experts (MoE) models with trillions of total parameters and tens of billions of activated parameters have become a major direction in the evolution of large models. Unlike dense models, MoE architectures use a gating router mechanism to dynamically route each token to a small number of expert subnetworks for computation. As a result, each inference activates only around tens of billions of parameters while scaling total model capacity to the trillion level. This “large capacity, low activation” characteristic introduces several deployment challenges:
- Extremely high memory footprint: Even though each inference activates only a subset of parameters, all expert weights must remain resident in GPU memory. For a model with roughly 2.8 trillion total parameters stored in FP16, the weights occupy close to 5.5 TB — far beyond the capacity of a single machine.
- Extremely long context: A 1M-level context window means the KV Cache grows almost linearly with sequence length, further increasing memory pressure in long-text and multimodal scenarios.
- Multimodal coordination: The model must handle text, images, and other inputs simultaneously, making memory allocation and operator adaptation for the encoders and backbone network more complex.
Single-machine deployment is therefore nearly impossible. Two approaches must work together: model quantization/compression and multi-node distributed parallelism.
Estimating GPU Memory Before Deployment
In engineering practice, memory estimation is the first step. The following empirical formulas give a rough estimate:
Weight memory ≈ total parameter count × bytes per parameterKV Cache ≈ 2 × batch size × sequence length × layers × hidden dimension × bytes per element
Using a model with roughly 2.8 trillion total parameters as an example:
- FP16 (2 bytes/parameter): ~5.6 TB
- W8A8 / INT8 (1 byte/parameter): ~2.8 TB
- W4A8 (weights 0.5 bytes/parameter): ~1.4–1.5 TB
W4A8 quantization compresses the weights to about 1.47 TB. Assuming a domestic AI accelerator with 128 GB per card and 8 cards per server, a dual-node setup provides roughly 2 TB of total memory — enough to hold the weights while reserving about 0.5 TB for the KV Cache and activations. This is exactly why the “dual-node deployment” route exists.
All of the above are typical estimation ranges; actual values depend on the specific card memory, quantization implementation, and parallelism/sharding scheme.
W4A8 Quantization: Balancing Memory and Accuracy
W4A8 refers to a mixed-precision quantization scheme with 4-bit weights and 8-bit activations, one of the mainstream choices for deploying ultra-large models. Compared with FP16, it delivers roughly a 4× weight compression ratio; compared with the more aggressive W4A4 scheme, it retains 8-bit activation precision to control accuracy loss. Key selection considerations:
- Accuracy regression evaluation: Compare results on general benchmarks, long-text inference, and multimodal understanding to confirm the post-quantization metrics remain acceptable.
- Operator support: Not all matmul, attention, and MoE routing operators natively support W4A8; confirm compatibility between the inference engine and the domestic operator libraries.
- Quantization granularity: Finer granularity (per-channel / per-group) improves accuracy but adds a small amount of extra computation and storage overhead.
It is recommended to prioritize community-verified W4A8 quantized weights rather than quantizing from scratch, which significantly reduces accuracy risk and engineering cost.
Dual-Node Distributed Parallelism Strategy
Running a trillion-scale MoE model across two servers relies on combining parallelism strategies:
- Tensor Parallelism (TP): Shards a single layer’s weights across multiple cards, reducing per-card weight and compute load, but requiring frequent communication — suitable for deployment within the high-bandwidth intra-node interconnect.
- Pipeline Parallelism (PP): Splits layers across different machines with low inter-machine communication, suitable for cross-node deployment.
- Expert Parallelism (EP): An MoE-specific strategy that distributes different experts across cards, coordinated with global routing communication.
For a dual-node scenario, the common approach is intra-node TP + inter-node PP/EP: use the high-speed interconnect for tensor sharding within a node, and pass activations and KV over an RDMA network between nodes. High-speed RDMA networking (such as RoCE / InfiniBand-class solutions) is recommended for cross-node communication to prevent it from becoming the overall throughput bottleneck.
Preparing the Inference Engine and Container Image
Choosing an open-source inference engine that supports domestic AI compute backends is key to deployment. Most mainstream engines now offer adapted builds for domestic accelerators, and often ship with container images released alongside the model, containing pre-configured drivers, operator libraries, and engine code. Using the official matching image greatly reduces environment pitfalls:
# Pull the official adapted image released with the model (illustrative)docker pull <registry>/<inference-engine>:<model-tag># Start the container, mounting the weight directory and the network devices required for multi-node communicationdocker run -d --name node0 \--network=host \--device=/dev/<accel_device> \-v /data/models:/models \-e MASTER_ADDR=192.168.1.10 -e RANK=0 \<inference-engine>:<model-tag>
Because the weights are large (~1.47 TB), it is recommended to download them in advance to high-speed shared storage or local NVMe on each node, avoiding repeated pulls at startup.
The Complete Deployment Workflow
- Hardware and network validation: Confirm the accelerator card status, memory, and RDMA link connectivity on both machines; use the vendor’s diagnostic tools for a health check.
- Weight preparation: Download the W4A8 quantized weights to shared storage or a local disk, and verify file integrity.
- Launch the containers: Start the official image on each node, configuring distributed environment variables such as
MASTER_ADDR,WORLD_SIZE, andRANK. - Start the inference service: Load the model in a multi-node, multi-card setup, setting TP/PP degrees and the maximum context length.
Illustrative startup command:
# Node 0 (RANK=0); Node 1 only needs RANK=1 and the same MASTER_ADDRpython -m inference_engine.api_server \--model /models/llm-w4a8 \--tensor-parallel-size 8 \--pipeline-parallel-size 2 \--max-model-len 1048576 \--quantization w4a8
- Health check: Confirm the service is ready via the
/healthendpoint, and run a short-text completion test to validate the pipeline.
Performance Tuning and Troubleshooting
- OOM (out of memory): First lower
--max-model-lenand the memory utilization parameter, or increase parallelism to re-shard the weights. - Slow cross-node communication: Check the RDMA and NIC configuration; if necessary, adjust the underlying collective communication library parameters and NIC topology binding.
- Low throughput: Enable Continuous Batching and paged KV Cache management to improve memory utilization.
- High first-token latency: Check whether weight loading hits the page cache, and preheat the weights to keep them resident in memory.
- Long-context degradation: Adjust the KV Cache quantization strategy and sliding-window configuration.
Best Practices Summary
Deploying a trillion-scale MoE model on domestic AI compute can be summarized in four principles:
- Quantize first, then parallelize: Use W4A8 to compress the weights into a range that multiple nodes can hold, then design the parallelism strategy;
- Use the official matching image: Adapted images released with the model avoid a large number of operator and driver compatibility issues;
- Intra-node TP, inter-node PP/EP: Layered parallelism aligned with the hardware interconnect bandwidth is the most cost-effective optimal solution for dual-node deployment;
- Close the loop with monitoring: Use general capabilities such as container platforms, log services, and monitoring/alerting to continuously observe memory, throughput, and latency, forming a “deploy–observe–tune” loop.
If hosted on a cloud platform, its general capabilities — such as container platform, object storage, and monitoring/alerting (for example, the related foundational services offered by Baidu AI Cloud) — can be used for image management, weight storage, and runtime observability, reducing self-built operations cost and letting engineering focus return to model quality itself.
