Local Deployment of MoE Models: VRAM Planning and Engine Selection Guide

    Deploying next-generation Mixture of Experts (MoE) models locally presents new challenges compared to traditional LLMs. This guide explains why architectural changes like mixed sparse attention, mixed-precision weights, and ultra-long contexts complicate deployment. It outlines critical pre-deployment architecture checks—including parameter verification, precision format validation, and attention layer identification—and provides a practical framework for estimating VRAM requirements to help you select the right hardware and inference engine.

    1. Why Deploying Next-Generation MoE Models Has Become Harder

    In the past, deploying open-source large models usually required only three steps: downloading the weights, installing the inference framework, and starting the service. With the emergence of new-generation flagship MoE (Mixture of Experts) models, this workflow frequently fails. Common issues include: failing to start the service despite seemingly sufficient VRAM, encountering Out-Of-Memory (OOM) errors with long contexts despite normal performance on short texts, garbled outputs when speculative decoding is enabled, and notably low prefix cache hit rates.

    Most of these issues stem from the model architecture. New-generation models often feature the following designs, each of which alters the assumptions of traditional inference systems:

    • Mixed Sparse Attention: Different layers within the same model may use sliding window attention, compressed attention, or full attention. As a result, the KV cache is no longer a single structure.
    • Mixed-Precision Weights: Expert weights commonly use FP4, while attention and dense layers use FP8. Both the framework and hardware need to simultaneously support multiple quantization paths.
    • Auxiliary Head Speculative Decoding: The model comes with a built-in draft prediction head. The inference framework must maintain cache consistency across prefill, decode, and speculative verification paths.
    • Ultra-Long Context: Capable of handling up to a million tokens, the memory management and reuse strategies for the KV cache need to be redesigned.

    Understanding these designs before deployment is essential to determine what kind of model your machine can support. Selecting GPUs, choosing frameworks, and tuning parameters must all be based on this understanding.

    2. Pre-Deployment Architecture Verification

    Before downloading the weights, it is recommended to verify the following items point by point. While verification cannot guarantee a successful deployment on the first try, it can proactively identify most issues related to insufficient VRAM, precision format mismatches, and incorrect attention type identification.

    2.1 Total Parameters vs. Activated Parameters

    MoE models typically have a massive number of total parameters, but only activate a small fraction per token. VRAM capacity is determined by the total parameters, while computational throughput is determined by the activated parameters. When selecting a GPU, you should first ensure adequate VRAM capacity and memory bandwidth before considering peak compute power.

    2.2 Precision Formats and Hardware Generations

    FP4 expert weights paired with FP8 attention rely on the native support of next-generation hardware. Before deployment, you need to confirm three things:

    1. Does the GPU natively support FP4 tensor operations?
    2. If the hardware does not support it, does the framework provide a fallback path for dequantizing FP4 weights, and how much will VRAM and latency increase after the fallback?
    3. Can the FP8 KV cache be disabled, and how much will VRAM usage increase for long contexts if it is disabled?

    2.3 Attention Layer Type Identification and Verification

    If the model mixes multiple attention types across different layers, you must confirm that the framework supports all layer types. A common problem is that the framework starts normally but processes all layers as full attention, causing the KV cache footprint to far exceed expectations.

    The verification method is as follows:

    • Cross-reference the model’s official configuration file (e.g., layer type fields in the config) with the startup logs to ensure that each layer type is correctly identified.
    • Review the allocation details of each cache pool in the startup logs to check whether the cache size for sliding window layers matches the window size.
    • If the logs show warnings such as “fallback to naive implementation” or “unrecognized layer type,” stop and troubleshoot before proceeding to stress testing.

    Reference standard for detecting anomalies: If the total allocated cache differs from the formula estimate in Section 3 by more than approximately 20%, you should check the layer type identification. This threshold is an empirical troubleshooting line and should be adjusted based on actual conditions.

    3. VRAM Planning

    3.1 VRAM Composition

    VRAM is roughly composed of three parts:

    Total VRAM ≈ Weight VRAM × (1 + Margin) + Per-token KV Cost × Concurrency × Target Context Length + Runtime Reservation

    The values for each component are as follows:

    • Weight VRAM: Total parameters × actual storage bit-width. FP4 is approximately 0.5 bytes per parameter. Some frameworks retain high-precision copies for unsupported operators, so the margin should be determined based on the framework’s official documentation and actual testing, rather than directly applying a fixed ratio.
    • KV Cache: This is the hardest part to estimate in new architectures. The cache size for sliding window layers correlates with the window length and is essentially constant; compressed layers correlate with the compression rate; and full attention layers grow linearly with the context length. The per-token KV cost should be queried from the framework’s official documentation for that specific model, and you should not rely on the experience from older models.