Local Deployment of Sparse MoE Models: How to Size VRAM and System RAM

    Sparse mixture-of-experts (MoE) models can have very large total parameter counts while activating only a small subset of parameters per token, but local deployment still requires careful VRAM and RAM planning. This article compares dense and sparse computation, explains the difference between active and total parameters, provides a step-by-step method for estimating weight VRAM, expert storage, KV cache, and headroom, and discusses quantization, speed factors, model selection checks, and known limitations.

    Introduction: Why Local Deployment Often Runs Into VRAM Limits

    When developers run large models locally, they often start by looking at parameter count. More parameters usually mean stronger capabilities, but inference also requires more VRAM and compute. For some time, local deployment has generally followed two paths: use a dense large model to ensure capability, at the cost of high hardware requirements, or rely on quantization and compression with some capability loss; alternatively, use a small model to ensure speed, with limited performance on complex tasks.

    Sparse activation architectures—Mixture of Experts (MoE)—try to balance both ends. The parameters and conclusions in this article come from a community article and have not been independently reproduced. For any specific model, the numbers should be checked against its official model card. This article focuses on the mechanism itself and on how to estimate your own hardware requirements based on this type of mechanism.

    1. Compute Differences Between Dense and Sparse Models

    A dense model uses all parameters in the forward computation for every token. Taking a 27B dense model as an example, each generated token theoretically requires about 27 billion parameters to participate in computation. This has two direct consequences: high computational load, and limited first-token latency and throughput. When the model enters a deep reasoning mode, the generated intermediate reasoning content becomes longer, and the wait becomes more noticeable.

    An MoE model splits network layers into multiple “expert” subnetworks, and a router selects a small number of experts for each token. The total parameter count can be very large, but each forward pass activates only a small portion of it. Two numbers need to be distinguished here: total parameters determine the model’s stored knowledge capacity, while active parameters determine the computation per token. The source article’s description of “about 6B active and more than 100B total” is a typical description of this structure. Note that small active parameters do not mean small memory requirements, because inactive experts still need to be stored somewhere; otherwise the router cannot call them.

    2. What VRAM and System RAM Each Hold

    During local inference, VRAM mainly holds three types of content: the weights needed for current computation, the KV cache (key-value cache that stores the generated context), and runtime overhead. The size of the KV cache grows linearly with context length.

    Taking 6B active parameters as an example, at FP16 precision the weights are about 6 × 2 = 12GB. This does not include the KV cache, activations, or the framework’s own overhead. Therefore, on a 16GB GPU, the model can run, but only with relatively short contexts. To process long documents with tens of thousands of tokens, you usually need INT8 or 4-bit quantized weights, a quantized KV cache, or more VRAM.

    Expert parameters are another part. When total parameters exceed 100B, even with 4-bit quantization, the weights are about 100 × 0.5 = 50GB. If this part is to be fully placed in memory, the system RAM should be at least around 64GB, with headroom left for the operating system and other programs. 32GB of RAM cannot hold the complete expert set. When RAM is insufficient, the system will swap some data to disk, and speed will drop noticeably.

    Therefore, the claim that “active parameters are small, so 16GB VRAM plus 32GB RAM can smoothly run the full version” does not hold. A more accurate understanding is: VRAM determines whether the current computation can complete quickly, while RAM determines whether all experts can be held. Both need to be estimated separately based on quantization precision and context length.

    3. Estimating a Configuration with Formulas

    The estimation can follow these steps.

    1. Weight VRAM: number of active parameters × bytes per parameter. FP16 is 2 bytes, INT8 is 1 byte, and 4-bit is 0.5 bytes.
    2. Expert memory: total parameter count × bytes per parameter, plus about 10% to 20% headroom.
    3. KV cache: related to the number of layers, number of KV heads, head dimension, context length, and precision. It must be calculated according to the specific model configuration and cannot be replaced by a fixed number.
    4. Reserve: memory and VRAM used by the operating system, IDE, browser, and other programs. Usually, at least 2GB to 4GB should be reserved.

    With this method, a 100B-class MoE model under 4-bit quantization requires far more than 32GB of memory. If memory is insufficient, there are two approaches: first, use an inference framework that supports paging or memory-mapped (mmap) loading, so that some experts are read from disk on demand; second, accept lower generation speed. The former can make the model run, but speed depends on disk and memory bandwidth, so it is not suitable as the main setup for interactive coding.

    4. What Determines Speed

    The source article gives specific tokens/s numbers but does not specify the GPU model, context length, batch size, quantization method, inference framework version, or measurement method, so they cannot be compared directly. The main factors affecting speed include:

    • VRAM bandwidth: single-token generation is usually limited by weight read speed.
    • Memory bandwidth: the process of moving experts from system RAM to VRAM affects speed, and differences between DDR4 and DDR5 also show up here.
    • Routing overhead: the more frequently experts are switched, the more additional data movement is required.
    • Quantization format and the degree of kernel optimization in the inference framework.

    To compare two models, use the same machine, the same framework, the same quantization method, and the same set of prompts, take the average of multiple runs, and record both first-token latency and steady generation speed. Only then do the numbers have reference value.

    5. Checks When Selecting a Model

    • Ratio of active parameters to total parameters: a smaller ratio saves computation per token, but it does not reduce memory requirements.
    • Target context length: long contexts significantly increase KV cache usage.
    • Quantization support: confirm that the framework you use supports the model’s quantization format.
    • Framework maturity: check the official repository and issue list to confirm whether optimizations for the architecture already exist.
    • Fallback plan: prepare a small dense model for use when expert routing is unstable or hardware is insufficient.

    6. Known Limitations

    Sparse architectures are still evolving, and several points need attention.

    First, routing may deviate from the optimum. In relatively niche professional domains, such as understanding manuals for rare instruments, the expert combination selected by the router may not be the most appropriate, and answer depth may not match that of a full-parameter model.

    Second, the software ecosystem is still catching up. Some inference frameworks may have incomplete support for new architectures. When encountering problems, first check the corresponding project’s issue list to confirm whether it is a known issue, and pay attention to version updates.

    Third, empirical conclusions need time to accumulate. Community tests use inconsistent methods, and a single benchmark run cannot represent long-term stability.

    Conclusion

    MoE-style models separate “total knowledge capacity” from “per-token computation,” which opens new possibilities for local deployment. But this separation also makes hardware estimation more complex. VRAM, RAM, context, and quantization need to be considered together; active parameters alone are not enough. For developers, calculating your own hardware boundaries with the method above before deciding which model to choose is more reliable than chasing a particular benchmark number.