Engineering Practice: Deploying MoE Large Models on a 4-Node Compact Cluster

    This article explains how to deploy hundred-billion-parameter MoE models on a compact 4-node cluster with unified memory architecture. It covers memory capacity planning for weights and KV cache, hardware and RDMA networking setup, tiered storage with NVMe offloading, FP8/FP4 quantization strategies, tensor parallelism configuration for inference engines, stress testing methods, common troubleshooting issues, and model selection guidance—helping engineers calculate memory budgets before deployment and validate capacity limits through benchmarking.

    1. Calculate Memory Before Deployment

    Before deploying a large model, the first question to answer is: can the weights and inference cache fit into the cluster’s memory? The weight footprint is estimated as:

    Weight footprint = parameter count × bytes per parameter

    FP16 uses 2 bytes per parameter, FP8 uses 1 byte, and FP4 uses 0.5 bytes. For an example model with 200 billion parameters, FP16 weights take roughly 400 GB, FP8 about 200 GB, and FP4 about 100 GB. These numbers are only meant to demonstrate the calculation method, not measured values from any specific model.

    For MoE models, the total parameter count determines memory usage, while the active parameter count determines compute per token. Total parameters decide whether the model fits; active parameters affect decoding speed. Both matter when selecting a model.

    KV cache is the other major memory cost. For standard attention, it can be estimated as:

    KV cache ≈ 2 × layers × KV heads × head dimension × context length × bytes per element × concurrent sessions

    Assume a model with 60 layers, 8 KV heads, and a head dimension of 128, with KV stored in FP16. A single 128K (131,072-token) context then requires roughly 2 × 60 × 8 × 128 × 131072 × 2 bytes, or about 32 GB. Models using other attention structures require a modified formula—recalculate based on the parameters in the model’s configuration file.

    The cluster’s memory needs headroom. Runtime overhead, activations, and memory fragmentation all consume space. As a starting point, reserve at least 20% of memory and allocate the rest to weights and KV cache. On a 512 GB cluster, reserving about 102 GB leaves roughly 410 GB. After loading 200 GB of FP8 weights, about 210 GB remains. At 32 GB per 128K context, this supports only about 6 concurrent long-context sessions.

    This calculation also defines the cluster’s capability boundary. A 1-trillion-parameter model needs about 1 TB in FP8, and still around 500 GB even with FP4 quantization—nearly filling the entire cluster memory with no room left for KV cache or runtime headroom. Therefore, the 4-node cluster described here is better suited for hundred-billion-parameter MoE models quantized to FP8 or FP4.

    2. Hardware Configuration

    The following is the example configuration used in this article. Actual node specifications should be filled in according to the selected product.

    Item Per Node Cluster Total
    Compute node 1 SoC with ARM CPU and GPU in a unified package 4 nodes
    CPU cores 20 cores 80 cores
    Unified memory ~128 GB LPDDR5X ~512 GB
    Local storage ~2 TB NVMe SSD ~8 TB
    RDMA NIC 1 × 200 Gbps class 4 NICs
    Interconnect Connected to a 400G switch Star topology

    The advantage of unified memory architecture is that CPU and GPU share the same memory space, so weights can be accessed by both sides without PCIe copies. This design reduces data movement, but it does not reduce capacity requirements. The model still must fit within 512 GB—memory capacity remains the first gate for deployment.

    3. Network Topology

    There are two common ways to interconnect multiple nodes: direct point-to-point links between nodes, or a star topology through a switch. This solution uses a star topology for three reasons.

    First, fewer links. Fully connecting 4 nodes point-to-point requires 6 links, while a star topology needs only 4. The gap widens as node count grows.

    Second, a clean topology. Each node connects only to the switch, so adding or removing a node does not affect existing links.

    Third, nodes do not forward traffic. Data between nodes is forwarded by the switch, so compute resources are not consumed by network relay tasks.

    Inter-node communication uses RoCE (RDMA over Converged Ethernet). RDMA transfers data directly between the NIC and memory, bypassing the operating system kernel network stack, which reduces CPU overhead and communication latency.

    Actual latency depends on the switch, NICs, and RoCE configuration, so this article does not give generic figures. Before going live, measure link performance with RTT (round-trip time) and P99 latency, and record the results in acceptance documentation.

    4. Tiered Storage: Memory and NVMe Working Together

    A large model’s weights plus KV cache often exceed unified memory capacity. This solution uses a three-tier placement strategy.

    The first tier is hot data—the main model weights. Weights are sharded via tensor parallelism and distributed across the unified memory of each node, ensuring high-bandwidth access during computation.

    The second tier is cold data—infrequently accessed portions, such as some expert weights or lookup-table-like structures. This data is offloaded to NVMe SSDs and loaded on demand.

    The third tier is the KV cache. Long contexts during inference consume large amounts of KV cache, so sufficient memory headroom must be reserved after deployment.

    NVMe read latency is far higher than memory latency. If frequently accessed data is offloaded, decoding latency rises noticeably. After going live, monitor NVMe read volume and data hit rates. If high-frequency data ends up on NVMe, migrate it back to memory or adjust the placement strategy.

    5. Quantization Strategy

    New-generation GPUs natively support FP8 and FP4 computation. Mixed FP8/FP4 precision reduces weight storage overhead. Note that “compressed to roughly a quarter of FP16” applies only to the weights themselves. KV cache, activations, and runtime overhead are not covered by this ratio and must be calculated separately.

    Follow these steps during deployment:

    1. Prefer officially released quantized versions. Self-quantization introduces additional accuracy loss and requires separate evaluation.
    2. Keep higher precision for sensitive layers. Common sensitive locations include the embedding layer, output layer, and some attention layers—determine specifics based on evaluation results.
    3. Before going live, compare pre- and post-quantization results on standard evaluation sets, record the differences, and confirm the accuracy is acceptable.

    Additionally, the actual speedup from FP4 depends on whether the hardware and inference engine provide corresponding compute kernels. Verify this during selection.

    6. Inference Engine and Tensor Parallelism Configuration

    The inference engine needs three capabilities: continuous batching, paged KV cache management, and multi-node tensor parallelism. An example configuration follows.

    1. # Example parameters; names follow vLLM style. Refer to the documentation
    2. # of your actual engine version.
    3. inference-server \
    4. --model /data/models/moe-model \
    5. --tensor-parallel-size 4 \
    6. --max-model-len 131072 \
    7. --dtype fp8 \
    8. --gpu-memory-utilization 0.90 \
    9. --enable-chunked-prefill

    The meaning and configuration of each parameter:

    • tensor-parallel-size: Align with the node count. With 4 nodes, set it to 4, so each layer’s weights are sharded across 4 nodes.
    • max-model-len: Set to the upper limit validated by stress testing. The 131072 in the example is only a starting point, not a recommended value. The setting must satisfy: per-session KV cache footprint × target concurrency ≤ available KV cache space.
    • gpu-memory-utilization: Under unified memory architecture, the operating system, other processes, and the inference engine share the same memory. The available memory reported by the engine may be optimistic. Before startup, use system tools to confirm actual free memory, then decide this value.
    • enable-chunked-prefill: With chunked prefill enabled, long inputs are processed in pieces, preventing them from monopolizing compute resources and blocking other concurrent requests for extended periods.

    Parameter names vary by engine and version. Check the documentation for the version you use before applying them.

    7. Stress Testing Methodology

    Stress tests should cover four typical scenarios. The table below shows example settings for input length, output length, concurrency levels, and key metrics. Adjust actual parameters based on your business data.

    Scenario Input Length Output Length Concurrency Levels Key Metrics
    Everyday Q&A ~128 tokens ~256 tokens 1, 4, 8, 16, 32 TTFT, single-stream decoding speed
    Document processing ~32K tokens ~512 tokens 1, 2, 4, 8 Prefill throughput, TTFT
    Complex reasoning ~4K tokens ~2K tokens 1, 4, 8 Decoding throughput, TPOT
    Coding & Agent 64K–128K mixed, multi-turn ~1K tokens 1, 2, 4 KV cache usage, overall throughput, error rate

    Execute stress tests as follows:

    1. Warm up before formal measurement so model weights and caches reach a steady state.
    2. Run each concurrency level for a fixed duration, and only use data from the stable phase.
    3. Record TTFT at P50, P95, and P99; TPOT; overall throughput; peak memory; KV cache utilization; NVMe read volume; and network utilization.
    4. Pass/fail thresholds must be defined by the business side before testing. Without predefined thresholds, results cannot be judged as passing or failing.

    8. Expected Patterns to Validate

    The following patterns are based on general characteristics of MoE models and unified memory architecture. They are hypotheses to be validated on this cluster, not measured results.

    • For single-stream requests, decoding speed is primarily limited by memory bandwidth. Unified memory has an advantage here, but measured bandwidth and decoding speed should be the final arbiter.
    • As concurrency increases, throughput may grow near-linearly until KV cache or compute resources approach their limits.
    • Whether long contexts can run stably depends on KV cache headroom and the NVMe offload path. Whether million-token-level contexts are supported can only be determined after stress testing per Section 7; this article draws no conclusion.

    9. Common Risks and Troubleshooting

    The following issues are common during deployment.

    1. Out of memory (OOM). First reduce max-model-len or concurrency. If still insufficient, switch to lower-precision weights or reduce model size.
    2. Accuracy degradation after quantization. Compare evaluation results before and after quantization, and restore sensitive layers to higher precision.
    3. Latency jitter caused by NVMe offloading. Check whether high-frequency data resides on NVMe and migrate it back to memory.
    4. Tensor parallelism communication becoming a bottleneck. Monitor network utilization and RTT; check RoCE configuration and the switch’s congestion control settings.
    5. Version mismatch. The inference engine, drivers, and model format must be mutually compatible. Validate upgrades in a test environment first.

    10. Model Selection Recommendations

    Using a 512 GB cluster as an example, the table below estimates weight footprints for models of different parameter scales. The data covers weights only; KV cache and runtime headroom are not included.

    Total Parameters FP8 Weights FP4 Weights Suitable for This Cluster?
    100B ~100 GB ~50 GB Yes, ample headroom
    200B ~200 GB ~100 GB Yes, supports several long-context sessions
    500B ~500 GB ~250 GB FP8 nearly fills memory, not recommended; FP4 needs headroom validation
    1T ~1 TB ~500 GB No, no room for KV cache

    Focus on these four points when selecting a model:

    First, whether model weights match cluster memory, with KV cache headroom reserved.
    Second, whether network bandwidth meets tensor parallelism communication needs.
    Third, whether the inference engine’s support for the target model architecture and low-precision formats is mature.
    Fourth, whether operational capability is sufficient, including model version management, monitoring and alerting, and authentication and rate limiting at the AI gateway.

    If you want to evaluate model quality first, you can run comparison tests on public cloud model services before deciding whether to migrate to a local cluster. This is a neutral suggestion and does not constitute a recommendation for any platform or product.

    Conclusion

    A 4-node unified memory cluster connected through a 400G switch can run hundred-billion-parameter MoE models within a controlled hardware footprint. Whether it can support longer contexts and higher concurrency must be judged based on memory calculations and measured data. Calculating weight and KV cache footprints before deployment, then determining parameter limits through stress testing, is the fundamental practice for reducing risk.