Calculating the Cost of Locally Deploying 100B+ MoE LLMs

    This article breaks down the hardware cost and memory requirements for locally deploying 100B+ Mixture of Experts (MoE) large language models. It covers weight estimation, KV Cache calculation, framework overhead, and compares two deployment tiers. It also provides alternative deployment paths and decision recommendations to help you plan your infrastructure efficiently.

    1. Calculating Weights: VRAM Baseline for MoE Models

    Many teams estimate VRAM by multiplying the total parameters by the number of bytes per parameter. While this works roughly for dense models, it leads to significant deviations for Mixture of Experts (MoE) models.

    Taking GLM-5.2 as an example, assume a total parameter count of 743B with 39B activated parameters per token. (Always refer to the official model card and release materials, as parameter sizes and architectural details directly change the figures below.)

    Although MoE models only activate a subset of parameters per forward pass, VRAM usage is determined by the total parameter count. In resident deployments without CPU or NVMe expert offloading, all expert weights must reside in GPU VRAM. Otherwise, frequently swapping expert weights in and out of system memory or storage during routing can significantly increase inference latency.

    Using FP8 quantization (1 byte per parameter), the weights for 743B parameters take about 743GB. With BF16 (2 bytes per parameter), the weight size doubles to approximately 1.5TB. This number is the starting point for hardware selection.

    2. The Underestimated Cost: Estimating KV Cache

    KV Cache is the most likely component to exceed the budget in long-context and high-concurrency scenarios. It scales linearly with context length and the number of concurrent requests, calculated as follows:

    KV Cache bytes = 2 × layers × KV heads × head_dim × context length × concurrency × bytes per element

    The “2” in the formula represents two caches for Key and Value. The number of layers, KV heads, and head_dim must be read from the model configuration file. Here is a demonstration using a set of assumed values: 80 layers, 8 KV heads, head_dim of 128, and KV Cache using BF16 (2 bytes).

    • Single 1M context (1,048,576 tokens): ~344GB
    • Single 128K context: ~43GB

    These are sample values. If the actual model uses a more compact attention structure or quantizes the KV Cache to FP8, the footprint will decrease accordingly. Testing with the target model and inference framework before deployment is essential.

    3. Framework Overhead and Redundancy Reserves

    The inference framework allocates CUDA context, activation memory, and temporary buffers for each GPU. Empirically, this extra overhead is about 10GB to 30GB per card, depending on the framework, sequence length, and parallelism strategy.

    In production environments, VRAM should not be fully utilized. When VRAM usage approaches 100%, sudden requests can easily trigger Out of Memory (OOM) errors, causing the service to crash. It is generally recommended to reserve 10% to 20% of VRAM as a safety buffer.

    Although these two overheads seem small, they often become the straw that breaks the camel’s back when VRAM is near the critical limit.

    4. Comparing Two Deployment Tiers

    Tier A: Single Node with 8 GPUs (Entry Level)

    A single node consists of 8 accelerator cards, each with 141GB of VRAM, totaling about 1128GB. After sharding FP8 weights using tensor or expert parallelism, each card holds about 93GB.

    Tier B: Dual Nodes with 16 GPUs (Usable Level)

    Two nodes comprise 16 accelerator cards of the same specification, totaling about 2256GB. The weights remain around 743GB, leaving significantly more available space.

    The two tiers are calculated based on the following assumptions: 20GB framework overhead per card, and 15% redundancy reserve of total VRAM.

    Item Tier A (8 GPUs) Tier B (16 GPUs)
    Total VRAM ~1128GB ~2256GB
    FP8 Weight Footprint ~743GB ~743GB
    Remaining After Weights ~385GB ~1513GB
    Framework & CUDA Overhead ~160GB ~320GB
    Redundancy Reserve ~170GB ~338GB
    Available for KV Cache ~55GB ~855GB
    128K Context Concurrency (Example) ~1 session ~20 sessions
    1M Context Concurrency (Example) Cannot fit ~2 sessions
    Estimated Hardware Budget ~3.5 million RMB ~7.3 to 8 million RMB

    The available space in Tier A is highly sensitive to assumptions. If the framework overhead is 10GB per card and the reserve is 10%, the KV Cache space is about 190GB. If the overhead is 30GB per card and the reserve is 20%, the space is insufficient. Therefore, Tier A should only be viewed as an entry-level threshold that “can run,” suitable for low-concurrency, context-limited scenarios.

    Tier B has ample KV Cache space and can support multiple concurrent long-context sessions. However, this conclusion also relies on the previous KV Cache assumptions and should be validated on the actual model.

    5. Budget Scope

    The amounts in the table above are rough estimates based on average market prices, covering the purchase price of the complete machine, including the server host, accelerator cards, and basic storage. It does not include data center modifications, electricity, taxes, operations and maintenance (O&M) personnel, or high-speed networking equipment between dual nodes unless explicitly stated in the quote.

    Accelerator card prices fluctuate significantly. Before making a formal decision, refer to the supplier’s real-time quotes and quote validity periods.

    6. Compute and Communication Constraints in MoE Distributed Inference

    VRAM determines whether the model can fit, but inference speed also depends on compute and communication.

    First, expert parallelism introduces cross-node communication. Each token is routed to a subset of experts. If experts are distributed across different nodes, All-to-All communication is required. In dual-node deployments, inter-node interconnect bandwidth and latency directly impact end-to-end latency. Common solutions include InfiniBand and RoCE.

    Second, fewer activated parameters do not mean less memory access. Each token activates only about 39B parameters, resulting in a compute volume much smaller than that of a dense model. However, reading expert weights still relies on VRAM bandwidth. In multi-card parallelism, the sharding strategy for tensor parallelism and expert parallelism must be carefully designed; otherwise, some cards may idle while others wait for data.

    7. Alternative Paths and Decision Recommendations

    The advantages of local deployment include completely private data, offline operation, no pay-as-you-go API fees, and the ability to deeply customize inference strategies. The trade-offs are high hardware investment, complex O&M, rapid hardware iteration, and the requirement for the team to be familiar with distributed inference, VRAM optimization, and network tuning.

    If the goal is data privacy rather than hardware ownership, consider the following paths:

    • Cloud Private Deployment: Deploy on high-performance computing nodes provided by cloud vendors, keeping data within a private VPC and scaling on demand to avoid idle hardware.
    • Context Trimming Based on Business Needs: If your business does not actually require 1M context, limiting the window to 32K or 128K can significantly reduce KV Cache footprint, making a single-node solution more viable. Specific benefits need real-world testing.
    • Quantization Compression: INT4 quantization can theoretically reduce weights to around 370GB, but the precision loss cannot be ignored. Before deployment, use a business test set for regression evaluation to ensure that the accuracy and stability of critical tasks meet requirements, rather than just looking at the VRAM reduction.

    When making decisions, it is recommended to first determine the context length and concurrency required by the business, then estimate the KV Cache using the formula, and finally choose the hardware solution. The budget should include networking, data center facilities, electricity, and O&M, not just accelerator card prices.