Planning VRAM and Multi-GPU Deployment for Trillion-Parameter MoE Models

    This guide explains how to estimate the memory requirements and multi-GPU architecture for deploying a trillion-parameter Mixture-of-Experts model locally. It covers total versus active parameters, weight storage at different precisions, KV cache and runtime overhead, expert and tensor parallelism, communication costs, deployment validation, and the trade-offs between self-hosting and hosted inference.

    1. From Total Parameters to Active Parameters: How MoE Models Work

    Large language models are commonly described using two parameter counts: the total number of parameters and the number of parameters activated during each forward pass. A Mixture-of-Experts (MoE) architecture divides the feed-forward layers into multiple expert subnetworks. A router selects only a small subset of those experts for each token. As a result, total parameters determine the cost of storing the weights, while active parameters determine the computation required for each step.

    Using the configuration disclosed in a public model card as an example, the model has approximately 2.8 trillion total parameters, with about 104 billion parameters activated for each token across 93 layers. Its expert pool contains 896 routed experts. Each token selects 16 of them, and two additional shared experts are applied to every token.

    These figures produce two useful ratios:

    • The routed expert selection ratio is 16/896, or approximately 1.8%.
    • The active-parameter ratio is approximately 104B/2.8T, or 3.7%.

    This difference shows that most parameters are concentrated in expert weights. Those weights must remain resident in GPU memory, even though only a small subset participates in each computation step.

    2. Estimating VRAM: Resident Weights Are the First Deployment Barrier

    Routing decisions are dynamic, so it is impossible to know in advance which experts will be used. Therefore, all expert weights must remain available in GPU memory. A rough estimate for weight memory is:

    1. Weight memory ≈ Total parameters × Bytes per parameter

    The approximate weight footprint of a 2.8-trillion-parameter model at different precisions is as follows:

    Storage precision Bytes per parameter Approximate weight size
    FP16/BF16 2 5.6 TB
    FP8/INT8 1 2.8 TB
    4-bit quantization 0.5 1.4 TB

    Quantization schemes also require storage for scale factors and other metadata, so the actual footprint will be slightly higher than the values shown above.

    Public information lists the weight size as 1.56 TB. This corresponds to approximately 0.56 bytes per parameter, or an average of roughly 4.5 bits per parameter. This suggests that the released version likely applies low-bit quantization to the expert weights while retaining higher precision for some critical layers. The exact precision distribution should be confirmed in the official files.

    The following code provides a simplified estimate:

    1. def weight_footprint_gb(total_params: float, bits_per_param: float) -> float:
    2. """Estimate resident weight memory in GB, excluding KV cache and activations."""
    3. return total_params * bits_per_param / 8 / 1e9
    4. def per_card_gb(total_gb: float, num_cards: int, reserve_ratio: float = 0.15) -> float:
    5. """Estimate the minimum memory per card after evenly sharding weights.
    6. The reserve ratio covers caches and communication buffers.
    7. """
    8. return total_gb / num_cards / (1 - reserve_ratio)
    9. if __name__ == "__main__":
    10. params = 2.8e12
    11. for bits in (16, 8, 4.5):
    12. total = weight_footprint_gb(params, bits)
    13. print(f"{bits}bit: weights about {total:.0f}GB, "
    14. f"about {per_card_gb(total, 8):.0f}GB per card with 8 cards")

    Under this estimate, eight cards would require approximately 823 GB per card at 16-bit precision, 412 GB per card at 8-bit precision, and 232 GB per card at 4.5-bit precision.

    3. What an Eight-Card Configuration Actually Requires

    Dividing 1.56 TB of weights across eight cards results in approximately 195 GB per card. This figure represents the weights only and does not include other memory requirements. Therefore, the claim that “eight cards can run the model” assumes that each card has substantially more than 195 GB of VRAM and that the combined memory of all eight cards is comfortably larger than the weight footprint. If a single card has less memory than its assigned shard, the model cannot be fully loaded, even if the total number of cards is sufficient.

    In addition to weights, a deployment must account for at least the following:

    • KV cache: Directly related to the number of layers, context length, and concurrent requests. Its usage can grow rapidly in long-context workloads.
    • Activations: Temporary intermediate results during the forward pass. Memory usage varies with batch size.
    • Communication buffers: Temporary storage required to distribute tokens among GPUs and collect the results during expert parallelism.
    • Runtime overhead: Memory used by the computation graph, fragmentation, and the inference framework itself.

    The 15% reserve ratio in the example code is only a planning heuristic, not a measured requirement. The appropriate headroom depends on the target context length and concurrency and must be measured under the actual workload.

    4. Parallelism Strategies: Expert Sharding and Communication Costs

    Multi-GPU deployments commonly combine two forms of parallelism. Expert parallelism assigns different experts to different cards, reducing the weight burden on each card. Tensor parallelism splits dense computations such as attention across cards.

    For example, if 896 experts are distributed evenly across eight cards, each card hosts 112 experts. Expert ownership can be calculated as follows:

    1. NUM_EXPERTS = 896
    2. NUM_CARDS = 8
    3. EXPERTS_PER_CARD = NUM_EXPERTS // NUM_CARDS # 112
    4. def expert_owner(expert_id: int) -> int:
    5. """Return the card responsible for a given expert."""
    6. return expert_id // EXPERTS_PER_CARD

    The cost of expert parallelism is communication. Once a token is routed to specific experts, it must be sent to the cards that host those experts. After computation, the results must be collected again. This all-to-all communication overhead increases with interconnect bandwidth requirements and token volume. If the available bandwidth is insufficient, the compute units may frequently wait, causing actual throughput to fall well below theoretical performance.

    Load balancing is equally important. If certain experts are selected more frequently, the cards hosting them can become hotspots and slow down the entire batch. In practice, operators should monitor the selection frequency of each expert and adjust the scheduling strategy provided by the inference framework as needed.

    5. Practical Checklist for Local Deployment

    1. Verify the weight version, precision, and file size. Validate file hashes to ensure that the weights are complete.
    2. Estimate peak KV-cache usage based on the target context length and concurrency.
    3. Reserve sufficient memory for activations, communication buffers, and fragmentation. Do not fill VRAM to capacity.
    4. First compare outputs with fixed inputs to confirm that the deployment matches the reference results, then run throughput benchmarks.
    5. Continuously record peak memory usage on each card, expert load distribution, and communication time for tuning.
    6. Carefully review the model’s license terms, including restrictions on commercial use and redistribution.

    6. Local Deployment or Hosted Inference?

    Local deployment is suitable when data must remain within an internal environment, when the model requires customization or fine-tuning, or when the workload has stable and relatively high sustained throughput.

    For occasional use or highly variable request volumes, calling a hosted model service on demand may be more cost-effective and avoids maintaining a multi-GPU cluster. Hardware acquisition, facility power and cooling, and operational staffing should all be included in the total cost. Before making a decision, estimate the full workload using actual request volumes and context lengths, then compare the investment with the cost of hosted inference.