Local Deployment of Trillion-Parameter MoE LLMs: Calculating Resources and Costs

    Deploying trillion-parameter Mixture of Experts (MoE) large language models locally requires a clear understanding of hardware resources and performance targets. This article breaks down the deployment into three performance tiers, provides formulas for calculating VRAM and KV cache requirements, analyzes the impact of multi-GPU communication on performance limits, and outlines heterogeneous offloading strategies and hardware configurations suitable for different use cases.

    1. Define Your Target: Three Performance Tiers Determine Cost Magnitude

    Deployment costs depend entirely on your performance requirements; there is no one-size-fits-all answer. This article categorizes deployment targets into three tiers:

    1. Just Runs: The model can load and output tokens, even if the speed is only single digits per second.
    2. Single-User Usable: Output speed for a single user reaches about 25 tokens per second (25 tps).
    3. Multi-User Concurrency: 10 concurrent requests simultaneously, while maintaining single-user output speed above 25 tps.

    The hardware gaps between these tiers usually differ by an order of magnitude. Tier 1 primarily focuses on memory capacity. Tier 2 requires high-bandwidth accelerators and optimized parallelization. Tier 3 demands sufficient KV cache capacity for concurrent requests and scales compute via multi-node or high-speed interconnects. Defining your target tier before discussing hardware and budgets prevents paying for unused performance.

    Before starting, confirm two things: whether the model weights and official technical documentation are publicly available, and whether estimated figures have been benchmarked with actual weights. Prior to weight release, all speed and VRAM numbers should be treated as mere estimates.

    2. How to Calculate VRAM Usage

    2.1 Basic Formula for Weight VRAM

    The lower limit of weight VRAM can be estimated using the following formula:

    Weight VRAM (GB) ≈ Total Parameters × Bits per Parameter ÷ 8

    “Total parameters” refers to all model parameters, not just those activated per inference step (explained in the next section).

    Quantization formats also have overhead. For example, the 4-bit microscaling float format uses an 8-bit scale factor shared among 32 4-bit elements, averaging 4.25 bits per element. This overhead is easily overlooked.

    For an example model with roughly 2.8 trillion total parameters:

    • Raw 4-bit storage: 2.8T × 4 bit ÷ 8 ≈ 1400 GB
    • Including scale overhead: 2.8T × 4.25 bit ÷ 8 ≈ 1487.5 GB
    • Actual requirements will be higher due to non-4-bit tensors (e.g., layers retaining higher precision), metadata, memory alignment, runtime workspace, and KV cache.

    For comparison, a 671-billion-parameter model in 8-bit requires about 671 GB just for weights, plus extra space for activations and runtime overhead. The size difference between these two models directly determines the hardware baseline.

    2.2 The Two Metrics of MoE Models

    MoE (Mixture of Experts) models have two easily confused metrics:

    • Storage footprint: Determined by all expert parameters. Even if only a few experts are used per step, all experts must reside in addressable storage so the router can call them at any step.
    • Compute volume: Determined by the parameters actually activated per token. Lower activation ratios mean less computation per step.

    Therefore, the deployment bottleneck for MoE models is usually storage capacity, not compute. Interpreting the expert activation ratio as the “parameter activation ratio” is a common misconception. The expert activation ratio only indicates how many experts the router selected; it must be combined with shared layers and attention layers to calculate the true parameter activation ratio.

    2.3 KV Cache Growth

    KV cache grows linearly with context length and concurrency, calculated as follows:

    KV cache (Bytes) ≈ 2 × Layers × KV Heads × Head Dim × Context Length × Concurrency × Bytes per element

    Here is a hypothetical example: 60 layers, 8 KV heads, 128 head dim, 32K context, 10 concurrent, 2 bytes per element. The result is about 80.5 GB. This number only illustrates the order of magnitude; real models have different attention architectures, so calculations must follow the actual architecture. If the attention mechanism uses compressed or shared KV representations, the formula needs appropriate modification.

    3. Why Multi-GPU Communication Determines Performance Limits

    The core communication pattern for large-scale MoE inference is all-to-all. After routing, each token must be sent to the accelerator holding the target expert for computation, and then sent back. The more scattered the experts, the larger the data transfer volume per step.

    This leads to two direct conclusions:

    1. Communication bandwidth and latency directly compress the effective utilization of compute. Regardless of how powerful the accelerator is, throughput stalls if it waits for data.
    2. A larger communication domain can restrict expert-parallel transfers within high-speed interconnects. Cross-node Ethernet or standard PCIe links struggle to support high-throughput MoE inference due to latency and bandwidth constraints.

    Therefore, proposed solutions typically recommend high-speed interconnected supernodes composed of dozens of accelerators. For budget-limited users, this means a single machine or a few nodes can only meet Tier 1 or partial Tier 2 goals, while Tier 3 requires dedicated cluster solutions.

    4. Single-Machine Heterogeneous Offloading: Runs, but with Limited Speed

    4.1 Basic Approach

    Heterogeneous offloading splits the model based on computational characteristics:

    • Compute-intensive and frequently accessed shared parts (like attention) are placed in GPU VRAM to leverage high bandwidth.
    • Sparse experts, which occupy most of the storage but are used infrequently per token, are placed in CPU memory and computed on demand.

    This approach combines the capacity advantages of large-memory servers with the compute advantages of GPUs, enabling models that exceed VRAM capacity to run.

    4.2 Theoretical Speed Limits

    During the decode phase, generating each token requires reading the activated weights from memory. Thus, decode speed has a rough upper limit:

    Theoretical token/s ≈ Effective Memory Bandwidth ÷ Bytes of weights read per token

    Assuming each token needs to read 40 GB of weights and the effective CPU memory bandwidth is 300 GB/s, the theoretical upper limit for single-user decode speed is about 7.5 token/s. To reach 25 tps, an effective bandwidth of about 1000 GB/s is required, which exceeds the capability of most dual-socket server memory systems.

    Concurrent requests can share weight reads for the same step, so batch processing can improve overall throughput. However, as concurrency increases, compute volume and KV cache footprint also grow; the actual benefit depends on where the bottleneck lies.

    4.3 Prefill and Decode Must Be Evaluated Separately

    Prefill processes the input prompt, is compute-intensive, and suits large-batch GPU parallelization. Decode generates output, is memory-bound, and is limited by memory bandwidth. The bottlenecks differ, so reporting a single “speed” can mislead readers. Evaluations should provide:

    • Prefill speed (token/s)
    • Decode speed (token/s)
    • Time to first token (TTFT)
    • Input length and output length
    • Concurrency

    High-throughput figures in public materials usually come with prerequisites, such as specific expert selection strategies, short context lengths, or particular batch sizes. When these conditions are not met, actual numbers drop significantly. Always specify the conditions when citing such figures.

    5. Hardware Solutions for the Three Tiers

    5.1 Tier 1: Just Runs

    The core requirement is sufficient memory capacity. Solutions typically include:

    • Large server memory, enough to cover quantized weights and system overhead.
    • One or a few accelerators to host shared layers like attention.
    • Accepting single-digit decode speeds.

    Costs primarily come from server memory and the motherboard platform. Hardware costs are relatively low for this tier, but the experience is limited, making it suitable for validation, offline batch processing, or low-frequency usage.

    5.2 Tier 2: Single-User 25 tps

    Achieving single-user 25 tps usually requires one of the following:

    • Sufficient VRAM capacity to keep common experts and shared layers resident in VRAM, reducing cross-device transfers.
    • Multi-GPU parallelization with high-speed interconnects to reduce expert-parallel communication overhead.
    • A higher-bandwidth memory system with verified expert selection strategies and cache hit rates.

    The cost for this tier typically ranges from tens to hundreds of thousands of dollars in hardware, depending on the GPU model, quantity, and interconnect method. Prices change rapidly, so rely on actual quotes.

    5.3 Tier 3: 10 Concurrency with Single-User 25 tps

    Building on Tier 2, this tier must also resolve issues introduced by concurrency:

    • KV cache capacity must be reserved according to the formula above.
    • The scheduler must implement continuous batching to prevent long requests from blocking short ones.
    • Multi-node parallel strategies must be designed based on the communication topology.
    • VRAM or memory needs headroom for peak loads to avoid out-of-memory errors.