Deploying 100B-Scale MoE Models on 4 GPU Nodes: A Local Setup Guide

    This article walks through the practical challenges of deploying a 100B-parameter Mixture of Experts (MoE) model locally across four GPU nodes. It covers capacity planning for weights, KV Cache, and lookup data, tiered storage using unified memory and NVMe SSDs, mixed-precision strategies with native FP8 and FP4, long-context optimization for million-token windows, and unified operations through an AI gateway. Readers will find estimation scripts, configuration examples, an acceptance checklist, and common pitfalls to avoid.

    1. Why Local Deployment of Large MoE Models Is Harder Than Expected

    Mixture of Experts (MoE) architectures have become the go-to choice for very large models. The core idea is straightforward: the model holds a massive total parameter count, but each token only activates a small subset of expert networks. This sparse activation produces two seemingly contradictory outcomes—compute stays relatively manageable, but the memory capacity required to hold the weights still grows linearly with the total parameter count.

    That is the first hurdle for local deployment. Many teams size their resources based on activated parameters and then fail during model loading. Others buy enough memory but discover during inference that bandwidth is the bottleneck, leaving throughput far below expectations.

    Consider a typical four-node GPU setup: each node has large unified memory and local NVMe SSDs, with high-speed interconnect between nodes. To run an MoE model that uses native FP8 and FP4 mixed precision and supports a context window of up to a million tokens, you need to get five things right at the same time:

    1. Capacity planning: weights, KV Cache, and lookup data all compete for the same memory;
    2. Tiered storage: pushing cold data down to SSD while keeping hot data in memory;
    3. Precision strategy: mixed precision is not about “more quantization is better” but about balancing accuracy and stability;
    4. Long context: the non-linear memory and compute overhead of million-token windows;
    5. Operations: a unified entry point and observability across multiple nodes and models.

    2. Capacity Planning: Three Separate Calculations

    Before deployment, capacity estimation must be broken into three parts rather than treated as a single “how big is the model” question.

    First: weight footprint. Mixed-precision weights must be summed tensor by tensor according to their actual storage format. A practical approach is to have the inference engine print the actual resident footprint after loading, instead of trusting theoretical estimates.

    Second: KV Cache. It scales with context length × concurrency × layers × hidden dimension. At million-token context, a single request’s KV Cache can consume tens of gigabytes, making it the part most likely to spiral out of control in long-context scenarios.

    Third: lookup and index data. Some MoE implementations introduce additional memoization lookup structures (think of them as Engram-style memory tables) to store long-tail knowledge fragments. This data is accessed infrequently but is large in capacity, making it the first candidate for tiered offloading.

    A practical estimation script skeleton:

    1. def estimate_memory(num_params_b, ctx_len, concurrency,
    2. layers, hidden, kv_bytes=2):
    3. # Weights: estimated using average bytes per parameter for mixed precision
    4. weight_gb = num_params_b * 1.0
    5. # KV Cache: roughly 2 * hidden * kv_bytes bytes per token per layer
    6. kv_gb = (ctx_len * concurrency * layers
    7. * 2 * hidden * kv_bytes) / (1024 ** 3)
    8. # Reserve 15% for activations and temporary buffers
    9. total = (weight_gb + kv_gb) * 1.15
    10. return round(weight_gb, 1), round(kv_gb, 1), round(total, 1)

    The conclusion is direct: if the three calculations together exceed 80% of the cluster’s available memory, you must introduce tiered storage rather than keep adding memory.

    3. Tiered Storage Design: Unified Memory + NVMe

    The key design decision here is to schedule “unified memory + NVMe SSD” as a single storage hierarchy:

    • Hot tier (unified memory): active expert weights, KV Cache, and runtime context;
    • Warm tier (local NVMe): shards of infrequently hit expert weights and lookup data;
    • Cold tier (optional object storage): multiple model versions and archived checkpoints.

    Three engineering points matter. First, prefetching: use routing history to predict which experts are likely to activate next and move them from SSD to memory ahead of time, hiding IO latency behind compute. Second, page alignment: align offload block sizes with filesystem blocks and memory pages to avoid read/write amplification. Third, hit-ratio monitoring: treat the warm-tier hit ratio as a core metric; if it drops below a threshold, the prefetch strategy is off target.

    An illustrative offload configuration:

    1. storage_tiering:
    2. hot: unified_memory
    3. warm: local_nvme
    4. prefetch:
    5. enabled: true
    6. depth: 2 # prefetch the next two routing batches
    7. block_mb: 16 # aligned with memory pages
    8. metrics:
    9. warm_hit_ratio_target: 0.90

    It is worth stressing that tiering is not free: it trades IO for capacity. So tiering only pays off when memory is a hard constraint; when memory is plentiful, keeping everything resident delivers better throughput.

    4. Mixed Precision and Long Context: Stability First

    Native FP8 combined with FP4 mixed precision can compress weight footprint to a low level with almost no quality loss, but keep in mind:

    • Choose precision per tensor: attention and normalization layers usually retain higher precision, while expert matrices can use lower precision;
    • Fall back for sensitive layers: keep FP16/BF16 for layers sensitive to quantization error to avoid error accumulation under long context;
    • Representative calibration data: calibration data must cover the real business distribution, or quality will noticeably degrade in long-tail scenarios.

    For long context, the cost of a million-token window is non-linear. Viable optimizations include chunked prefill to reduce peak usage per pass, KV Cache quantization and compression, sliding-window and attention sparsification, and swapping historical context out to the warm tier on demand. During load testing, always record both time to first token (TTFT) and time per output token (TPOT); the two often pull optimization in opposite directions.

    5. Unified Operations and the AI Gateway

    Without a unified entry point, a four-node cluster forces clients to be aware of the topology. It is recommended to introduce the AI gateway capability of a management platform to provide:

    • Unified API entry and routing: distribute requests by model name, tenant, and priority;
    • Rate limiting and quotas: prevent a single tenant’s long-context requests from crowding out global resources;
    • Observability: bring GPU utilization, memory watermark, warm-tier hit ratio, and queue length into a single dashboard;
    • Canary and rollback: validate new model versions with a small traffic share before full rollout.

    Combined with container orchestration, logging services, and monitoring and alerting—general cloud capabilities—you can standardize release, scaling, and fault-localization workflows, significantly reducing the complexity of multi-node operations.

    6. Acceptance Checklist and Common Pitfalls

    Before going live, confirm each item:

    1. Does cold-start loading finish within the timeout threshold (must be measured for tiered setups)?
    2. Does full-concurrency long context trigger OOM?
    3. Does the warm-tier hit ratio meet the target, and is prefetching effective?
    4. Do TTFT and TPOT meet the business SLO?
    5. Are gateway rate limiting and quotas in effect?
    6. Is there a baseline for quantization quality regression evaluation?

    The three most common pitfalls are: estimating memory from activated parameters only, stuffing all data into memory and failing to load, and ignoring KV Cache growth under long context. Quantify first, then tier, then tune—this is the most reliable path for local deployment of large-scale MoE models.