Deploying a Trillion-Parameter MoE Model on Dual-Node Domestic AI Accelerators: A Practical Guide

    This is a practical, end-to-end walkthrough of deploying a 2.8-trillion-parameter multimodal MoE model—running the community W4A8 quantized weights—on two domestic AI accelerator nodes (32 dies, 2 TiB of total memory). It explains why trillion-parameter MoE is hard to serve, how to account for memory before you start, and how to design a parallel topology that keeps tensor parallelism inside each node while placing pipeline parallelism across nodes. It then covers six implementation steps—environment checks, weight validation, containerization, service startup, readiness checks, and stress testing—followed by operational channels, dual-track stress testing, common troubleshooting, and a pre-launch checklist.

    1. Background: Why Trillion-Parameter MoE Is Hard to Serve

    1.1 Model Characteristics

    This guide uses a native multimodal MoE model as the deployment target. Its key characteristics are:

    • Massive scale: roughly 2.8 trillion (2.8T) total parameters, with only about 104 billion (104B) activated per token—about 3.7% of the total. It natively supports multimodal input such as images, with a context length of up to 1 million tokens.
    • Divergent compute patterns: MoE runs forward computation on only a few experts per layer. The prefill stage processes all input tokens at once, so it is compute-bound; the decode stage generates one token at a time, so it is memory-bandwidth-bound. Imbalanced routing can also turn some experts into hotspots.
    • Heavy memory pressure: even after quantization, the weights are still TB-scale. Long contexts and high concurrency quickly push up the KV cache, and multimodal input expands high-resolution images into large numbers of visual tokens, further lengthening the effective sequence.

    Moving a model like this onto domestic accelerators raises at least three classes of engineering problems: how to fit the weights into limited memory, how to partition computation efficiently across machines, and how to run and observe the service reliably on the platform. The rest of this guide addresses these three points in turn.

    1.2 Deployment Target: W4A8 Quantized Weights

    The original deployment did not use unquantized high-precision weights; it chose a community-published W4A8 quantized version. W4A8 means:

    • Weights are stored in 4-bit;
    • During computation, scaling factors are restored at the quantization granularity, and matrix operations run at 8-bit precision;
    • Sensitive layers such as embeddings, normalization, and routing typically keep higher precision.

    Three points are worth flagging here:

    1. Distinguish the source when deploying pre-quantized weights. Community quantized weights lower the memory threshold, but you should spot-check output quality before use—especially for long-text, multi-turn dialogue, and multimodal scenarios—and compare the results against the precision range stated by the quantization author.
    2. Do not estimate weight size roughly with “parameters ÷ 2”. At 4 bits per parameter, each parameter contributes only about 0.5 bytes, but grouped scaling factors and high-precision layers add extra overhead.
    3. Pin the weight version. Weights often consist of multiple shards; the original deployment used a weight set with a fixed version identifier and a shard manifest. This way, any deployment maps precisely to the same parameters, and it makes cross-checking straightforward when something goes wrong.

    1.3 Compute Foundation: Two Nodes of Domestic AI Accelerators

    The test setup was two domestic AI accelerator servers:

    • Each node has 16 dies (compute chip units), each die equipped with 64 GiB of high-bandwidth memory—1 TiB per node;
    • The two nodes total 32 dies and 2 TiB of memory;
    • The nodes are connected by a high-speed interconnect that carries cross-node compute communication.

    There is an easy-to-miss point here: at the hardware level this is “2 nodes × 16 dies”, and the software parallel strategy must align with it. Otherwise, communication degrades into cross-node round trips. This is the starting point for the topology design in the next section.

    2. Deployment Design

    2.1 Memory Capacity Accounting: Do the Math First

    The first step of distributed deployment is not typing the launch command—it is answering three questions: how much the weights take, how much is left, and whether that is enough for the context and concurrency the workload needs.

    Item Value Notes
    Total weight file size 1,466,844,769,783 bytes, about 1.37 TB (1.33 TiB) Uses decimal conversion, consistent with the vendor’s stated-capacity convention
    Total available memory 32 × 64 GiB = 2 TiB Combined across two nodes, before deducting the runtime’s own overhead
    Weight usage About 68% Resident in memory after loading completes
    Remaining space About 0.63 TiB For the KV cache, activation tensors, and communication buffers

    2.2 Parallel Topology: Intra-Node Tensor Parallelism, Cross-Node Pipeline Parallelism

    The original deployment used a combination of “tensor parallelism 16 per node + cross-node pipeline parallelism 2”, i.e., a world size of 32: the 16 dies inside each node form one tensor-parallel group, and the two nodes make up the two stages of the pipeline.

    1) Why tensor parallelism is kept inside the node

    • High communication frequency: tensor parallelism splits each layer’s matrix operations across multiple cards, and every forward pass involves several collective communications. If the parallel group spans machines, all of that communication goes over the relatively bandwidth-limited inter-node links and easily becomes the bottleneck.
    • Pipeline parallelism only passes the “baton”: pipeline parallelism splits the model by layer into several stages, and the nodes only need to pass activation tensors at stage boundaries—far less communication than tensor parallelism. This makes it well suited to cross-node partitioning.

    2) Divisibility constraints

    • The tensor-parallel degree must divide the number of attention heads; otherwise the heads cannot be distributed evenly across the dies.
    • The number of pipeline stages must divide the number of layers and be allocated as evenly as possible, so that no single stage becomes the “short board”.

    3) Multimodal models need extra tradeoffs

    If the vision encoder is made into a separate stage, it worsens pipeline load imbalance. Multimodal workloads also have highly uneven input distributions: image requests cluster in the earlier stages, while long-text requests cluster in the later stages. It is advisable to stress test with real online combinations of “number of images + text length”, evaluate the usage of each stage, and adjust the layer split or the replica deployment approach if necessary.

    4) Scale boundary

    Because the weights alone approach 1.33 TiB, replicating the model requires at least 2 nodes; for each node to independently host a replica, you need 4 nodes. The current configuration can only host a single model instance, so a single point of failure makes the whole service unavailable. Account for this in capacity planning.

    2.3 Weight Loading: Reading TB-Scale Files Into Memory “Fast and Correctly”

    Even with a well-primed kernel page cache, a cold load of 1.33 TiB of weights takes anywhere from a few minutes to over ten minutes, depending on storage bandwidth and parallelism. You can shorten loading time in the following ways:

    • Prefer local high-speed disks. If running in the cloud, you can distribute weights via shared file storage or object storage, and prefer high-performance cloud disks.
    • Use mmap-based shard loading. This kind of sharded weight format supports memory-mapped zero-copy reads, and engines can typically load shards in parallel. Make sure every die can see the same complete set of weights; shared-storage mount consistency issues must be resolved before startup.

    You can estimate load time as “weight size ÷ sustained read bandwidth”. For example, at a sustained read bandwidth of 2 GB/s on a single machine, loading one set of weights takes roughly 10 minutes or more. If both machines load from local copies in parallel, the time is about the same, but it reduces pressure on the shared storage. If you restart frequently and storage bandwidth is low, factor the load time into the readiness probe’s timeout so the instance is not repeatedly judged unhealthy and restarted.

    3. Implementation: Six Steps

    Step 1: Validate the Runtime Environment

    The platform typically uses a “control side + agent side” architecture: the agent is a statically linked single binary on each node that actively connects out to the control side, and control, monitoring, logging, and inference traffic all reuse the same tunnel. The benefit is that nodes do not need to open inbound ports, which makes deployment easier in restricted networks. Before going live, confirm the following:

    • The agent process is alive and the control side can see the node heartbeat;
    • The driver and runtime versions match the accelerator software stack’s compatibility matrix;
    • Enough host memory is reserved. Model loading, the page cache, and visual preprocessing all consume host memory; if the container memory limit is too tight, the kernel can kill the process outright.

    Step 2: Pull and Validate the Weights

    First, validate integrity. Use a script to read the shard index file in the weight directory and check the shard count and total byte count:

    1. import json, os
    2. WEIGHT_DIR = "/models/w4a8" # Replace with the actual weight mount path
    3. INDEX = os.path.join(WEIGHT_DIR, "model.safetensors.index.json")
    4. with open(INDEX, "r", encoding="utf-8") as f:
    5. shards = sorted(set(json.load(f)["weight_map"].values()))
    6. total = 0
    7. missing = []
    8. for shard in shards:
    9. path = os.path.join(WEIGHT_DIR, shard)
    10. if not os.path.exists(path):
    11. missing.append(shard)
    12. continue
    13. total += os.path.getsize(path)
    14. print(f"shards: {len(shards)}, missing: {missing}")
    15. print(f"total bytes: {total}")

    In this case, the output should be 346 shards and 1,466,844,769,783 bytes. If either value does not match, the download is incomplete or the version is inconsistent, and you should re-pull rather than start with doubts.

    Then run a consistency check. Compute a digest for each shard and compare it against the checksum manifest provided by the weight publisher; record the version identifier in the deployment ledger for traceability.

    Step 3: Containerize the Runtime Environment

    The benefit of containerized deployment is that the engine version, runtime, and driver compatibility layer are packaged together, so environments are consistent across nodes. Two things to watch for with images:

    • Reference by digest. The original deployment used “one image per hardware-and-model generation” and pinned the version with an image digest. A digest prevents a same-named tag from being overwritten, so every launch pulls the exact same image.
    • Match the image to the hardware codename. A suffix like “a3” in an image tag is usually an abbreviation of the compute hardware generation; when the runtime libraries inside the image do not match the node’s hardware generation, it is a common cause of startup failures or communication anomalies. When scaling nodes or switching machine types, check this first.

    Step 4: Start the Inference Service

    The launch parameters only need to cover a few key configurations:

    1. # Illustrative parameters; names follow your inference engine's documentation
    2. python -m inference_server \
    3. --model /models/w4a8 \
    4. --quantization w4a8 \
    5. --tensor-parallel-size 16 \
    6. --pipeline-parallel-size 2 \
    7. --max-model-len 262144 \
    8. --gpu-memory-utilization 0.90 \
    9. --host 0.0.0.0 --port 8000

    What each parameter does:

    • --model: the weight mount path;
    • --quantization w4a8: explicitly declares the quantization format, preventing the engine from loading weights at the default precision and running out of memory;
    • --tensor-parallel-size 16 and --pipeline-parallel-size 2: correspond to the topology design in section 2.2;
    • --max-model-len: determines the maximum reserved KV cache space. Not every workload needs the full 1M context; in production, set it according to real needs rather than blindly matching the model’s upper limit;
    • --gpu-memory-utilization: the upper bound of the memory watermark. Too low wastes capacity; too high easily triggers out-of-memory during long-sequence inference.

    After startup, look at two things in the logs: whether memory allocation across the dies is roughly balanced, and whether both pipeline stages are ready. A card with noticeably low memory usage often indicates an anomaly in weight sharding or the parallel mapping.

    Step 5: Check Service Readiness

    The inference service usually loads the weights first, then completes memory warmup and compilation, which can take several minutes. Use the readiness endpoint (not the liveness endpoint) to decide whether the service can take traffic, and set the probe timeout to more than the cold-start time so the service is not “restarted the moment it comes up”.

    Then run a small smoke test whose input contains both a test image and some text, to confirm the multimodal path works:

    1. curl -sS http://127.0.0.1:8000/v1/chat/completions \
    2. -H "Content-Type: application/json" \
    3. -d '{
    4. "model": "w4a8-moe",
    5. "messages": [{"role": "user", "content": [
    6. {"type": "image_url", "image_url": {"url": "file:///tmp/test.png"}},
    7. {"type": "text", "text": "Describe the main content of this image"}
    8. ]}],
    9. "max_tokens": 256
    10. }'

    Note: the server uses a protocol compatible with the common chat-interface convention. If the weights are adapted to a different protocol, adjust the request body accordingly. Note also that the example does not enable authentication; exposing it directly to the outside brings the risk of unauthorized access and data leakage—see section 5.

    Step 6: Stress Test and Establish a Capacity Baseline

    Stress testing should cover typical scenarios such as “long-text prefill”, “multimodal input”, and “high-concurrency short requests”, and record first-token latency, inter-token output interval, throughput, and memory watermark for each. These metrics are the basis for later gateway timeout settings and replica scaling.

    4. Operational Channels and Stress Testing Methods

    4.1 Control Plane vs. Data Plane: Benefits and Costs of Reuse

    In the original deployment, the agent connected out actively and a single tunnel carried all traffic—very convenient to deploy. But it has two sides:

    • Benefit: nodes do not go out to the network and do not open ports, which naturally fits NAT and firewall environments.
    • Cost: control commands, monitoring collection, log reporting, and inference requests share the same channel. When inference traffic surges, control-plane messages may queue and lag, and logs may back up.

    In production, it is recommended to:

    1. Set a separate upload size limit and timeout for large requests, so a large payload does not block the channel;
    2. Report logs asynchronously in batches rather than synchronously per request;
    3. Match the monitoring collection frequency to the tunnel’s capacity, prioritizing key metrics;
    4. Separate control-plane and data-plane ports whenever possible, to reduce mutual interference.

    In addition, the tunnel typically uses encrypted transport. The connection credentials between the agent and the server must be kept secure and rotated periodically, and the node side should authenticate inbound inference requests.

    The original stress test was launched from the control side, through the platform gateway, to the instance—measuring the complete “user’s-eye” path—but the results mix in gateway and tunnel overhead. A dual-track approach is recommended:

    • End-to-end testing: access the inference service from the control side through the gateway to obtain the latency distribution users actually perceive, used for capacity planning and SLA definition;
    • Instance-internal testing: access the local service port directly from inside the instance, ruling out gateway and tunnel factors, to determine whether the bottleneck comes from the model itself or from the transport path.

    The difference between the two paths is precisely the extra overhead introduced by the gateway and the tunnel.

    5. Common Troubleshooting

    Symptom Common cause How to investigate
    Out-of-memory at startup Quantization format not recognized, weights loaded at high precision Confirm the quantization parameters are explicitly passed; check each die’s memory usage in the logs
    Failure partway through loading Shard missing or corrupted Use the script from step 2 to verify shard count and byte count, then compare digests file by file
    Startup hangs or initialization times out Inter-node communication not established Check the inter-node high-speed network and NIC selection parameters; confirm all ranks have started; extend the timeout appropriately
    Image request errors Visual input format not supported Check the multimodal parameters, protocol fields, and image size limits
    Long requests time out at the gateway First-token time exceeds the gateway timeout threshold Evaluate shortening the context; set a separate timeout for streaming requests; check whether gateway response buffering is disabled
    Missing logs or monitoring Tunnel saturated by large requests Limit request body size, report logs asynchronously, separate the ports

    One additional point: when troubleshooting long-request problems, first distinguish whether the request is stuck in prefill or in decode. The former is usually related to input length and the number of tokens after multimodal expansion; the latter has more to do with the memory watermark and bandwidth.

    6. Pre-Launch Checklist

    • Weight version identifier, shard count, and total byte count match the release information;
    • Image is pinned by digest and matches the node’s hardware generation;
    • Parallel topology aligns with the number of dies per node, and tensor-parallel groups do not cross machines;
    • Inter-node high-speed network is available, and communication timeouts have been increased to match the scale;
    • Readiness probe timeout is greater than the cold-start load time;
    • Context length and memory watermark are set according to actual business needs;
    • Inference service has authentication enabled, is not directly exposed to the public internet, and tunnel credentials have been rotated;
    • Stress testing distinguishes end-to-end and instance-internal paths, with key metric baselines recorded;
    • Memory watermark, first-token latency, and tunnel status are wired into monitoring and alerting.

    Conclusion

    Deploying a trillion-parameter MoE model on domestic compute is fundamentally the result of coordination across three layers:

    • Capacity: work out the memory budget for weights, KV cache, and activations up front;
    • Topology: keep tensor parallelism inside the node and place pipeline parallelism across nodes;
    • Engineering: make weights verifiable, images reproducible, and the channel observable.

    Get these three things solid, and the model service moves from “it runs” to “it runs stably and is operable”. The quantization format, topology combination, and parameter configuration in this guide should all be verified against the official documentation of the engine you use, and validated repeatedly against your actual workload.