GPU Memory Planning and Cost Estimation for Local Deployment of Trillion-Parameter MoE Models

    This article breaks down GPU memory requirements for locally deploying a trillion-parameter MoE LLM. It explains why memory must be budgeted by total parameters rather than activated parameters, estimates 4-bit weight storage including scaling factors, accounts for KV cache and runtime workspace, and provides a hardware topology and cost-estimation framework. It also reviews engineering options for reducing the deployment barrier.

    As model scale moves toward the trillion-parameter level, more engineering teams are evaluating the feasibility of local deployment. Moving a 2.8-trillion-parameter mixture-of-experts (MoE) model from the cloud to a self-built data center raises a more fundamental question than “how many GPUs should we buy?”: how should GPU memory actually be calculated? A single budgeting mistake can waste millions in budget or prevent the system from starting. Using a typical trillion-parameter MoE architecture as the background, this article breaks down the components of GPU memory usage and presents a reusable cost-estimation framework.

    1. Clarify first: what does MoE activation sparsity actually save?

    Before discussing GPU memory, one widespread misunderstanding must be corrected: the sparse activation of MoE architecture saves compute, not GPU memory.

    Take a typical trillion-parameter MoE model as an example. Its structure contains about 896 expert networks, and during inference each token routes to only 16 experts, giving an expert activation ratio of about 1.79%. Two points require particular attention:

    1. Expert activation ratio is not parameter activation ratio. In addition to expert layers, model parameters include dense parts such as attention modules, embedding layers, and normalization layers, which are fully involved for every token. Therefore, the actual proportion of parameters involved in computation is clearly higher than the 1.79% expert-level figure. Modern architectures also often introduce sparse attention mechanisms and attention residuals, further changing the actual distribution of computation.

    2. Activation sparsity affects FLOPs, not GPU memory occupancy. The inference engine must load the weights of all 896 experts fully into GPU memory (or storage reachable through layered scheduling), because routing decisions occur dynamically token by token: the previous token may go to experts 3, 17, and 205, while the next token may hit another 16 experts. Any static pruning scheme that “loads only frequently used experts” will degrade model capability in general inference scenarios.

    This leads to the first core conclusion: for local deployment of an MoE model, the GPU memory budget must be calculated based on total parameter count, not activated parameter count.

    2. Theoretical lower bound after quantization: the storage bill for 4-bit weights

    If a trillion-parameter model were stored in FP16, 2.8 trillion parameters would require about 5.6 TB of GPU memory, which is almost unacceptable in engineering terms. The industry therefore commonly introduces quantization after training or even during training. A current advanced practice is to adopt quantization-aware training (QAT) starting from the supervised fine-tuning (SFT) stage, quantizing weights to a 4-bit floating-point format (such as the commonly used MXFP4-style approach) and using 8-bit floating point for activations, thereby greatly compressing storage with almost no precision loss.

    1. Bare data lower bound

    The simplest estimate is: 2.8 trillion parameters × 4 bit ÷ 8 = 1.4 TB (about 1400 GB). This is often cited directly as the “minimum GPU memory requirement,” but it is only a theoretical bare-data lower bound and far from the real deployment requirement.

    2. Scaling factor overhead

    4-bit floating-point quantization usually uses group quantization: every 32 4-bit elements share one 8-bit scaling factor. According to public group-quantization specifications:

    • Every 32 elements: 32 × 4 bit + 8 bit = 136 bit
    • Equivalent per parameter: 136 ÷ 32 = 4.25 bit
    • Total weight storage: 2.8T × 4.25 ÷ 8 ≈ 1487.5 GB

    This item alone adds nearly 90 GB beyond the bare estimate.

    3. Other weight items that are easy to miss

    • Unquantized tensors: normalization parameters, some embedding layers, and routing gates are usually kept at high precision (FP16/BF16). Although their parameter share is small, they still need to be counted.
    • Metadata and alignment: tensor-splitting metadata and GPU memory alignment padding create additional fragmentation in multi-GPU sharding scenarios.

    3. The hidden runtime major items: KV cache and workspace

    Loading the weights is only the first step. During inference, two additional types of GPU memory consumption must be reserved.

    1. KV cache

    During autoregressive generation, the attention layer at each layer must cache the Key/Value of historical tokens. KV cache size is positively correlated with the following factors:

    1. KV Cache ≈ number of layers × hidden-dimension-related term × sequence length × batch size × precision bytes

    For long-context, high-concurrency scenarios, KV cache can easily reach hundreds of GB. Latent-compression attention structures (low-rank projection of KV) can significantly reduce this item, which is an important motivation for modern architecture design. Even so, with 32K–128K context and dozens of concurrent requests, reserving more than 200 GB for KV cache is not exaggerated.

    2. Runtime workspace

    This includes operator temporary buffers, activation staging, and communication buffers (all-reduce/all-to-all data exchange during multi-GPU parallelism). Generally, 10%–15% of total GPU memory should be reserved.

    3. Summary budget table (illustrative)

    Item Estimated magnitude
    4-bit weights + scaling factors ~1500 GB
    Unquantized tensors and metadata Tens of GB
    KV cache (long context + concurrency) 200 GB+
    Runtime workspace and communication buffers 150–250 GB
    Total About 2 TB or more

    In other words, for a 2.8-trillion-parameter 4-bit model, a safe GPU memory budget should be planned at 2 TB, not 1.4 TB.

    4. Hardware topology and cost estimation

    How can a 2 TB GPU memory requirement be mapped to hardware? Take a general-purpose accelerator with 80 GB of GPU memory per card as an example:

    • Pure weights require about 19–20 cards; after including KV cache and workspace, 24 cards (three 8-GPU servers) is a more realistic starting configuration.
    • If cards with a higher memory capacity are used (for example, around 141 GB per card), the number of nodes can be reduced to no more than two, while also lowering cross-node communication overhead.

    Cost should be evaluated item by item:

    1. Accelerator card cost: this is the dominant item. Based on market conditions, 24 high-end inference cards represent an investment in the millions of RMB; specific prices fluctuate with supply and demand and should be based on quotations at procurement time.
    2. Full servers and network: expert parallelism in MoE is extremely sensitive to inter-node bandwidth. A high-speed interconnect network (such as a 400G-class RDMA network) is recommended; switches and NICs are also an expense in the hundreds of thousands of RMB.
    3. Power and cooling: the continuous electricity cost of three high-power 8-GPU servers and data-center cooling retrofits are long-term operating costs.
    4. Labor and operations: model loading optimization, inference framework tuning, and fault monitoring all require dedicated staff.

    Overall, for a local deployment that can provide stable external service, the one-time hardware investment is usually in the several-million-RMB range, plus considerable annual operating expenses. This magnitude means that unless there are strict data-residency compliance requirements or extremely high stable call volumes, obtaining inference capacity on demand through cloud compute services, object storage, and container platforms is often more cost-flexible. For example, general-purpose compute and storage offerings from public cloud providers can serve as a reference baseline when comparing self-hosting and cloud approaches.

    5. Engineering measures to lower the barrier

    If the budget is limited, the following trade-off options can be considered:

    • CPU/memory offloading: place cold expert weights in large-capacity memory and schedule them on demand. This can greatly reduce the number of GPUs, at the cost of several times higher inference latency, making it suitable only for offline batch processing.
    • More aggressive quantization: in some scenarios, quantizing non-sensitive layers to 3-bit or even lower precision can compress weights by another 25%, but precision regression must be tested in practice.
    • Limit context and concurrency: reducing the KV cache budget is the most cost-effective way to save GPU memory.

    Conclusion

    Local deployment of a trillion-parameter MoE model is essentially a careful budgeting exercise: calculate GPU memory by total parameters and compute by activated parameters. Remember three numbers: after 4-bit quantization, weights are about 1.5 TB; with KV cache and workspace, the total is about 2 TB; this corresponds to a hardware starting point at the 24-card level and an investment in the several-million-RMB range. Clarify the budget before discussing deployment architecture—that is the responsible engineering decision path.