Deploying Open-Weight LLMs: GPU Memory Estimation and Capacity Planning

    Learn how to estimate GPU memory requirements for large open-weight MoE models, budget for weights and KV cache, and compare FP8 and Q4 deployment options. This guide explains how context length, concurrency, quantization, and server infrastructure affect hardware sizing.

    Estimate Weight Memory Before Choosing Hardware

    When an enterprise obtains the weights for a mixture-of-experts (MoE) model with hundreds of billions of parameters, the first question is often whether an existing eight-GPU server can run it.

    The answer depends on three variables: deployment precision, target context length, and concurrency. Change any one of them, and the hardware requirements change. A more reliable planning process is to define the workload first, estimate resource requirements second, and select GPUs last.

    Weight Memory Depends on Total Parameters, Not Active Parameters

    A common mistake with MoE models is to see “approximately 40B active parameters per inference” and size the hardware as though it were a 40B model.

    Active parameters determine the amount of computation performed during a forward pass. Weight memory depends on the total parameter count. For a 744B-parameter model, the full set of weights must reside across the GPUs in a GPU-resident deployment, regardless of how many experts are activated for each inference. Offloading some weights to CPU memory reduces GPU memory requirements, but can substantially reduce throughput.

    A basic estimate is:

    Weight memory = total parameters in billions × bytes per parameter × runtime overhead factor

    When parameters are expressed in billions and each parameter occupies one byte, the result is in decimal GB.

    1. def weight_gb(total_params_b, bytes_per_param, overhead=1.15):
    2. # total_params_b is in billions; the result is in decimal GB.
    3. return total_params_b * bytes_per_param * overhead
    4. print(round(weight_gb(744, 1))) # FP8: approximately 856 GB
    5. print(round(weight_gb(744, 2))) # BF16: approximately 1,711 GB
    6. print(round(weight_gb(744, 0.5))) # Q4: approximately 428 GB

    The 1.15 factor is only a rough allowance for overhead such as CUDA contexts and communication buffers. It does not include KV cache or activations. Longer contexts and higher concurrency increase total memory requirements, so this estimate should be treated as an initial baseline rather than a complete capacity budget. For production planning, calibrate the overhead factor against measured GPU memory usage after loading the model.

    For Q4 quantization, the theoretical packed weight size is approximately:

    744 × 0.5 = 372 GB

    Applying the 1.15 runtime factor brings the estimate to approximately 428 GB, consistent with the script.

    Three Deployment Tiers and What They Support

    Deployment tier Estimated weight memory, including 1.15 overhead Reference GPU configuration Target context or workload Intended role Main risk
    Native FP8 Approximately 856 GB 8 × H200, 141 GB each; 1,128 GB total 32K–128K context Standard production starting point Insufficient headroom for 1M context
    Full 1M context Approximately 856 GB for weights, plus substantial KV cache 8 × B200-class GPUs, 180 GB each; 1,440 GB total 1M context Extremely long-context workloads High hardware cost
    Q4 quantization Approximately 428 GB 8 × 80 GB GPUs, 640 GB total, or 8 × 96 GB GPUs, 768 GB total Functional validation and low concurrency Validation and testing Quality degradation and potentially lower throughput

    Tier 1: Native FP8

    An eight-H200 node provides 1,128 GB of GPU memory. After allocating approximately 856 GB for weights and the estimated overhead, about 272 GB remains for KV cache, activations, and additional communication buffers.

    At context lengths of 32K to 128K, that headroom can support moderate concurrency, depending on the model and workload. It should not be treated as a 1M-context configuration.

    The H20 belongs in a different capacity tier. At 96 GB per GPU, eight H20 GPUs provide 768 GB in total. The raw FP8 weights alone occupy 744 GB, leaving almost no headroom; including runtime overhead exceeds the available capacity. An eight-H20 node therefore cannot be treated as equivalent to an eight-H200 node with 141 GB per GPU.

    Tier 2: Full 1M Context

    Why can eight 141 GB GPUs hold the FP8 weights but still struggle with a 1M-token context? The main reason is KV cache.

    As the next section illustrates, a single 1M-context request can require approximately 262 GB of KV cache under the example assumptions. An eight-GPU node with 180 GB per GPU provides 1,440 GB in total. After the estimated weight allocation, approximately 584 GB remains, providing more room for long-context requests and computation.

    This is still a capacity-planning reference, not a guarantee of a particular concurrency level.

    Tier 3: Q4 Quantization for Validation

    An estimated 428 GB weight allocation fits within an eight-GPU node using 80 GB GPUs, leaving approximately 212 GB of headroom. This makes it a practical option for functional validation and low-concurrency testing.

    Two caveats matter:

    1. Quantization can affect quality. Evaluate the quantized model against your own task-specific test set to determine whether the change is acceptable.
    2. Fitting in memory does not guarantee sufficient throughput. General-purpose inference backends running very large MoE models may deliver lower throughput than frameworks optimized for native FP8 execution.

    Estimating KV Cache Memory

    For a conventional K/V cache, memory per token is calculated as:

    Bytes per token = 2 × number of layers × number of KV heads × head dimension × bytes per element

    The factor of two accounts for both the key and value caches.

    KV cache memory for one request is the per-token requirement multiplied by its context length. Total KV cache memory is the sum across concurrent requests—or, when requests have the same length, the per-request requirement multiplied by concurrency.

    Consider the following illustrative configuration, which does not represent the specifications of a particular model:

    • 61 layers
    • 8 KV heads using grouped-query attention (GQA)
    • A head dimension of 128
    • BF16 KV cache, using 2 bytes per element

    The per-token requirement is:

    2 × 61 × 8 × 128 × 2 = 249,856 bytes, or approximately 0.25 MB per token.

    Using 32K as 32,768 tokens, 128K as 131,072 tokens, and 1M as 1,048,576 tokens gives:

    • 32K context: approximately 8.2 GB per request
    • 128K context: approximately 32.7 GB per request
    • 1M context: approximately 262 GB per request

    The eight-H200 FP8 configuration has approximately 272 GB remaining after its estimated weight allocation. One 1M-context request would consume almost all of that headroom, leaving little room for temporary computation workspace or other concurrent requests.

    Two assumptions are important here.

    First, KV cache grows approximately linearly with context length. Temporary workspace for attention computation can add further memory requirements.

    Second, the model architecture determines the coefficient in this calculation. With multi-head attention, where the number of KV heads equals the number of attention heads—for example, 64—the KV cache could be eight times larger than in this eight-KV-head GQA example.

    Storing the KV cache in FP8 instead of BF16 can halve its memory requirement, but any quality impact must be validated with an evaluation set.

    Six Factors That Determine the Final Configuration

    The configuration table is a starting point. Each of the following factors can change the sizing decision and should be verified in the deployment environment.

    1. Typical and peak context length. Sizing for a 1M-token peak rather than a typical 32K-token workload can multiply the memory budget. Use the actual context-length distribution as the baseline, and validate peak workloads through load testing.

    2. Maximum output length and reasoning mode. Extended reasoning can substantially increase the number of generated tokens, raising both KV cache usage and decoding overhead. Estimating memory from input length alone is a common mistake.

    3. Online users versus concurrent requests. The number of online users is not the same as inference concurrency. During traffic bursts, however, the two can approach one another. Test against peak concurrent demand.

    4. Tool use and long-running agents. Multi-turn agent workflows accumulate context and keep sessions active longer. Memory fragmentation can also become more pronounced.

    5. Interconnect and software stack. GPU interconnect bandwidth—particularly the difference between NVLink-class connections and PCIe—inference framework versions, and combinations of tensor, expert, and pipeline parallelism all affect throughput.

    6. Tolerance for quantization-related quality changes. Q4 degradation may be more noticeable on complex reasoning and coding tasks. Establish an evaluation set and compare results before choosing the quantized deployment.

    Starting Points for Server-Level Planning

    An FP8 inference node requires more than enough GPU memory. The rest of the server must also support model loading, data preparation, and communication. The following are starting points; reassess them against power requirements and the actual workload before procurement.

    Component Starting recommendation Purpose
    CPU Dual-socket, high-core-count processors Help prevent data preprocessing and communication from becoming bottlenecks
    System memory At least 1.5 TB Accommodate CPU offloading and temporary buffers during model loading