How to Calculate GPU Memory for Deploying a 100B-Parameter LLM Locally, Before and After Quantization

    Deploying a 100-billion-parameter model locally requires careful GPU memory planning. This article breaks down memory estimation into weights, KV cache, and activations, compares FP16, INT8, and INT4 quantization options with concrete hardware baselines, and walks through pre-deployment estimation steps, storage and cold-start considerations, multi-GPU communication, elasticity, and common troubleshooting tips.

    1. Start with Weights: Parameter Count × Bytes per Parameter

    Take a 100B-parameter model as an example. Weight memory can be estimated directly: weight memory (GB) ≈ parameter count (in billions) × bytes per parameter. With FP16 or BF16, each parameter takes 2 bytes, so weights total roughly 200GB. With INT8, each parameter takes 1 byte, or about 100GB. With 4-bit quantization, each parameter takes roughly 0.5 bytes, a theoretical value of 50GB. Quantization constants, group scaling factors, and other metadata add a few to a dozen-plus GB, so in practice estimate 50–60GB.

    These numbers cover only the weights. During inference, GPU memory must also hold the KV cache, activations, and runtime overhead of the inference framework. The KV cache grows with context length, concurrent requests, and layer count — in long-context or high-concurrency scenarios, it can exceed the weights themselves. When planning memory, always calculate weights separately from everything else.

    2. Resource Comparison of Three Quantization Options

    Option Weight memory (100B model) Headroom depends on Accuracy risk Hardware baseline (reference)
    No quantization FP16/BF16 ~200GB Remaining memory for KV cache and activations Lowest; serves as the accuracy baseline 8×80GB, 640GB total; weights take about one-third, leaving ~440GB
    8-bit INT8 ~100GB Context length and concurrency Small loss for most general tasks, but still needs evaluation A single 8×80GB node fits the weights with substantial headroom
    4-bit INT4 ~50–60GB Degradation on complex reasoning and code generation Higher; per-task evaluation required Multi-GPU required; exact count depends on measured total memory, interconnect bandwidth, and framework support

    The hardware baselines in the table are only starting points for estimation. Actual configurations should be determined by the target model’s architecture, sequence length, and concurrency goals.

    2.1 Deployment Without Quantization (FP16/BF16)

    Eight 80GB GPUs provide 640GB of total memory. Weights take roughly 200GB, leaving about 440GB for the KV cache and activations. That headroom is comfortable, but how much context length and concurrency it actually supports requires load testing. Under tensor parallelism, each GPU also carries a weight shard plus framework overhead, so usable memory per card is lower than its rated capacity. This option offers the best accuracy and suits core workloads with strict accuracy requirements and sufficient budget.

    2.2 8-bit Quantized Deployment (INT8)

    Weights drop to roughly 100GB, which fits on a single 8×80GB node with plenty of memory left for longer contexts and more concurrent requests. Methods like LLM.int8() handle outlier values specially, keeping accuracy loss within a small range. Whether accuracy is acceptable must be verified against business metrics. Classification and summarization tasks typically show limited differences, while mathematical reasoning and long-chain code generation need separate evaluation. 8-bit quantization also reduces memory-bandwidth pressure when reading weights, which helps throughput, though the gain depends on the specific operators and the inference framework’s implementation.

    2.3 4-bit Quantized Deployment (INT4)

    Weights drop to roughly 50–60GB, reducing the number of GPUs needed. But three conditions must all be met: total memory must fit both weights and the KV cache; inter-GPU interconnect bandwidth must handle tensor-parallel communication; and the inference framework must support the chosen 4-bit format. Consumer GPUs have limited per-card memory and are often connected via PCIe. Even if the weights fit, communication latency and context headroom can become bottlenecks, so feasibility should be confirmed through real-world testing.

    The main accuracy risks of 4-bit quantization appear in complex logical reasoning and code generation tasks. Activations and the KV cache are typically still computed in half precision, so 4-bit mainly reduces weight memory — system memory and compute consumption do not shrink proportionally.

    3. Pre-Deployment Memory Estimation Steps

    1. Confirm the model’s parameter count, architecture parameters (layer count, hidden dimensions, KV heads, head dimension), and target precision.
    2. Compute weight memory: parameter count × bytes per parameter, plus a reserve for overhead. The overhead ratio should be measured with your framework.
    3. Compute the KV cache: per request, KV cache ≈ 2 × layers × KV heads × head dimension × sequence length × bytes per element; then multiply by the number of concurrent requests.
    4. Reserve memory for activations and framework runtime overhead, and measure their peak usage in a real environment.
    5. Load-test with realistic traffic, recording peak memory, time-to-first-token, and throughput, then decide on the final GPU count and quantization scheme.

    4. Storage and Cold Starts

    The theoretical lower bound for model loading time equals the weight file size divided by read bandwidth. A 200GB FP16 checkpoint takes about 100 seconds at 2GB/s and about 400 seconds at 500MB/s. A 100GB INT8 checkpoint takes about 50 seconds at 2GB/s. Actual load time also includes dequantization, memory initialization, and other steps, so it usually exceeds the theoretical value. Use high-performance SSD cloud disks or parallel file storage, and preload weights into system memory before the service starts. If your service needs elastic scaling, cold-start time directly affects responsiveness, so consider keeping a minimum number of replicas for critical services to avoid frequent loading from scratch.

    5. Multi-GPU Communication

    Tensor parallelism requires synchronizing intermediate results after every layer, so inter-GPU communication is frequent. High-speed interconnects within a server (such as NVLink) can significantly reduce communication overhead. If you must rely on PCIe, communication can account for a large share of total time, preventing throughput from scaling linearly with GPU count. Confirm the interconnect topology first, then decide on the parallelism strategy and GPU count.

    6. Elasticity and Cost

    During the exploration phase, enterprises usually don’t need GPUs running at full capacity around the clock. You can run inference services on a container platform with GPU sharing and auto-scaling policies, releasing capacity during low-traffic periods. But large models take significant time to scale up, so your scaling strategy must account for cold-start time. For monitoring, continuously track memory utilization, time-to-first-token, throughput, and OOM counts — these metrics quickly reveal whether resources are sufficient.

    7. Common Troubleshooting

    • OOM (out of memory): First check whether your memory budget counted only the weights, then verify the KV cache limit and maximum concurrency.
    • Slow cold starts: Check storage read bandwidth and confirm there is no redundant loading.
    • Low multi-GPU throughput: Check whether the GPUs communicate over PCIe, and measure the share of time spent on communication.
    • Noticeable accuracy drop after 4-bit quantization: Check whether precision-sensitive layers were quantized; try a different quantization algorithm, or keep sensitive layers at higher precision.
    • Unstable quantization results: Fix the evaluation set and compare item by item against a non-quantized baseline — don’t judge from a single run.

    8. Conclusion

    For local deployment of a 100B-parameter model, the core of resource planning is estimating GPU memory in three separate parts: weights, KV cache, and activations. For high-accuracy, well-funded scenarios, FP16 or BF16 works well. Most enterprise workloads can start with 8-bit quantization and validate accuracy on real tasks. 4-bit quantization lowers the hardware barrier but requires per-task validation, plus confirmation that interconnect bandwidth and framework support are adequate. A practical approach: complete the estimation steps above, verify with small-scale load tests, and only then finalize your GPU count and quantization scheme.