Deploying a Trillion-Parameter MoE Model on Two Servers with AI Accelerators: A Practical Guide

    This article details a real-world deployment of a 2.8-trillion-parameter Mixture-of-Experts (MoE) large language model across two servers equipped with 32 AI accelerators (64 GiB each). It covers hardware constraints, parallelization strategy (tensor parallelism within nodes, pipeline parallelism across nodes), weight quantization and distribution, container image pinning, configuration, functional validation, load testing, and troubleshooting. Readers will learn how to plan memory budgets, choose efficient weight transfer paths, set safe context length limits, and design stress tests that reflect real usage patterns. The practical metrics and decision rules are directly applicable to similar multi-node MoE deployments.

    1. Background and Problem Definition

    Large language model parameter counts continue to grow. The Mixture-of-Experts (MoE) architecture activates only a subset of parameters per inference, so compute per token is far less than the total parameter count. However, all expert weights must remain resident in accelerator memory. When total parameters approach the trillion scale, a single server’s memory is usually insufficient, making multi-node deployment necessary.

    Multi-node deployment introduces three categories of challenges:

    1. Memory capacity: Weights, KV cache, and runtime buffers must fit together across the accelerators of multiple machines.
    2. Communication overhead: Both tensor parallelism and pipeline parallelism require data exchange between devices or nodes; interconnect bandwidth directly affects latency.
    3. Operational consistency: Weight files can reach terabytes in size; versions, checksums, and runtime environments must be strictly aligned across nodes.

    This article uses a two-node deployment as an example, walking through the complete process from resource planning to production validation. All parameters and data come from that actual test and serve as a reference for deploying similar models on comparable hardware.

    2. Model Characteristics and Deployment Constraints

    Before deployment, three key model metrics must be confirmed: total parameters, activated parameters, and context length.

    • Total parameters determine the lower bound on memory. The model in question has 2.8T total parameters.
    • Activated parameters determine per-step compute. Only about 104B parameters are activated per token, so compute latency is far lower than that of a dense model of equivalent size.
    • Context length determines the upper bound of KV cache. The model supports a 1M token context, but the actual deployment must limit cache size using a maximum sequence length parameter.

    2.1 Quantization and Weight Volume

    This deployment uses W4A8 quantized weights: weights are stored in 4-bit format, activations are computed in 8-bit format. Weight volume can be roughly estimated:

    1. 2.8 × 10^12 parameters × 0.5 bytes/parameter ≈ 1.4 TB

    The actual measured weight total was 1,466,844,769,783 bytes (~1.47 TB), closely matching the estimate. The difference comes from quantization scaling factors, shard metadata, and a small number of unquantized layers.

    2.2 Memory Budget

    Two servers contain 32 accelerator devices in total, each with 64 GiB of memory, summing to 2048 GiB (~2 TiB).

    Converting the weight volume to binary units gives approximately 1.33 TiB. The remaining ~0.67 TiB is available for KV cache, activation buffers, communication buffers, and runtime overhead. This configuration can fit the weights, but the number of concurrent requests under long-context scenarios will be limited by KV cache capacity. The maximum usable sequence length and batch size must be determined through stress testing.

    3. Parallelism Strategy and Topology Planning

    Multi-node inference typically combines two types of parallelism:

    • Tensor Parallelism (TP): Splits each layer’s matrix operations across multiple devices. Every layer requires collective communication, which happens frequently and is most sensitive to bandwidth and latency.
    • Pipeline Parallelism (PP): Splits the model into stages by layer. Communication occurs only at stage boundaries, with low volume and low frequency.

    Based on these characteristics, this deployment uses the following split:

    Dimension Configuration Rationale
    Intra-node tensor parallelism TP16 High bandwidth within a node suits frequent communication
    Cross-node pipeline parallelism PP2 Communication across nodes is limited to stage boundaries, lower bandwidth requirements
    Total parallel size world size 32 2 nodes × 16 devices

    This rule is a general principle for multi-node deployment: keep high-frequency communication inside a node, put low-frequency communication between nodes. If reversed—making tensor parallelism cross-node—each layer would traverse a slower network, noticeably reducing throughput.

    3.1 Parameter Network

    Collective communication between accelerators relies on a dedicated parameter network. Before deployment, the interconnect interfaces of both nodes must be added to the same parameter network and connectivity checked. Checks include:

    • Point-to-point bandwidth and latency between each pair of nodes;
    • Successful completion of collective communication among all devices;
    • Consistent MTU configuration on network interfaces;
    • No firewall or routing policy blocking communication ports.

    Only when all checks pass should the orchestrator treat the two nodes as a single deployment unit.

    4. Deployment Workflow

    4.1 Node Registration

    Nodes are registered using a reverse connection. A lightweight agent running on the node actively connects to the control plane. Control instructions, monitoring metrics, logs, and inference traffic all share this encrypted tunnel. Benefits:

    • No inbound ports need to be opened on nodes, reducing exposure;
    • Nodes behind NAT or in internal networks can still connect;
    • The same installation process works for different types of accelerator nodes.

    The installation command is generated on the control plane and executed once on each node. After the node comes online, the platform automatically detects accelerator count, NICs, and storage.

    4.2 Weight Distribution

    The large size of model weights means distribution efficiency directly affects deployment time. In this test, data flow between the two nodes was:

    • First node downloaded weights from the public model community, measured at ~50–57 MB/s;
    • Second node transferred directly from the first node, measured at ~490 MB/s.

    Using these rates, estimated full download times:

    1. Public download: 1.47 TB ÷ 50 MB/s ≈ 8 hours
    2. Direct node transfer: 1.47 TB ÷ 490 MB/s ≈ 50 minutes

    Direct transfer is nearly 10× faster than public download. The gap grows as more nodes are added. Therefore, the recommended approach is: download from the public source only once, then distribute to remaining nodes over the internal network.

    During distribution, pay attention to the following:

    1. Pin the version: Record the commit or revision hash of the model repository to prevent nodes from retrieving different weight versions.
    2. Verify integrity: Compute hashes for each of the 346 shard files and compare them with the source.
    3. Count shards: Confirm the number of shards matches metadata to ensure no files are missing.

    4.3 Container Image

    Container images should be pinned using their content digest (the digest) rather than just a tag. Tags can be overwritten, while the digest uniquely identifies a specific image content. Recording the digest in the deployment template guarantees that redeployment uses an identical runtime environment.

    4.4 Startup Configuration

    Below is a sample deployment configuration illustrating the relationships between parameters. Field names follow the actual inference serving framework used.

    1. model:
    2. path: /data/models/example-w4a8 # illustrative path, points to verified weight directory
    3. revision: <commit-hash> # pin to a specific version
    4. quantization: w4a8
    5. parallel:
    6. tensor_parallel_size: 16 # intra-node tensor parallelism
    7. pipeline_parallel_size: 2 # cross-node pipeline parallelism
    8. world_size: 32 # 2 nodes × 16 devices
    9. serving:
    10. max_model_len: 81920 # set based on KV cache budget, not model maximum
    11. gpu_memory_utilization: 0.90
    12. max_num_seqs: 16

    The value of max_model_len deserves special explanation. The model’s supported context length is 1M tokens, but under this configuration’s memory budget, setting it to the model maximum would make the KV cache impossible to fit. The actual value should be derived from stress test results.

    5. Functional Validation

    Functional validation should cover three categories, each with clear pass criteria.

    1. Basic dialogue: Multi-turn context remains correct; output format matches expectations.
    2. Reasoning process output: With reasoning mode enabled, the reasoning content and final answer are correctly separated.
    3. Tool calling: Function call arguments generated by the model conform to a predefined schema; call results are correctly injected and generation continues.

    Tool-call validation can be performed with a simple check, such as:

    1. import json
    2. def validate_tool_call(raw_output: str, schema: dict) -> bool:
    3. """Check whether the model's tool call is valid JSON and contains required fields."""
    4. try:
    5. call = json.loads(raw_output)
    6. except json.JSONDecodeError:
    7. return False
    8. for field in schema.get("required", []):
    9. if field not in call.get("arguments", {}):
    10. return False
    11. return call.get("name") in schema.get("allowed_names", [])

    Once functional validation passes, proceed to stress testing.

    6. Stress Test Design

    Stress tests should mimic real business patterns rather than testing only a single length. This test included three load groups:

    Scenario Characteristics Focus
    Random short text Input ~2048 tokens, output ~512 tokens Throughput, per-request latency
    Agent scenario (80K context) Long history plus multiple tool calls Prefill latency, KV cache usage
    Agent scenario (200K context) Very long context, near memory limit Maximum concurrency, stability

    A total of 836 requests were sent across the three groups, all completing successfully.

    6.1 Load Test Client Logic

    The load client records key timestamps for each request. Example logic:

    1. def run_request(client, prompt, max_tokens):
    2. t_start = now()
    3. first_token_time = None
    4. tokens = 0
    5. for chunk in client.stream(prompt, max_tokens=max_tokens):
    6. if first_token_time is None:
    7. first_token_time = now()
    8. tokens += 1
    9. t_end = now()
    10. return {
    11. "ttft": first_token_time - t_start, # time to first token
    12. "tpot": (t_end - first_token_time) / max(tokens - 1, 1), # average time per output token
    13. "output_tokens": tokens,
    14. "success": tokens > 0,
    15. }

    6.2 Metric Interpretation

    At a minimum, record the following metrics and report both means and percentiles:

    • Time to first token (TTFT): Reflects prefill phase latency; typically degrades first under long contexts.
    • Time per output token (TPOT): Reflects decode phase speed; directly affects streaming output feel.
    • Throughput: Total tokens generated per second; determines service capacity.
    • Success rate: Whether requests complete normally, including timeout, out-of-memory, and connection errors.

    The main bottlenecks in long-context scenarios are usually prefill time and KV cache usage. As context grows, TTFT rises sharply and concurrency drops due to memory limits. Therefore, capacity planning should report separate numbers for short and long contexts, rather than a single average.

    7. Common Issues and Troubleshooting

    1. Out-of-memory at startup

    • Reduce the maximum sequence length.
    • Lower gpu_memory_utilization to leave room for communication buffers.
    • Check for leftover processes occupying GPU memory.

    2. Cross-node throughput far below expectations

    • Confirm that pipeline parallel stage boundaries are on the parameter network, not the general-purpose network.
    • Use a point-to-point bandwidth test to verify actual bandwidth between nodes.
    • Check that MTU values match on both ends.

    3. Some nodes fail to load weights

    • Verify that the weight distribution was fully completed and checksums match the source.
    • Check local disk space and file permissions.
    • Confirm that all shard files are present and named exactly as expected by the framework.