Fitting LLMs on Self-Hosted GPUs

· Source: Anup Jadhav · Field: Technology & Digital — Artificial Intelligence & Machine Learning, Cloud Computing & IT Infrastructure · Depth: Intermediate, medium

Summary

A practical approach to estimating GPU VRAM requirements for deploying Large Language Models (LLMs) on self-hosted hardware is presented, designed to prevent Out-of-Memory (OOM) errors. The core formula, "vram_required = (bits_precision / 8) × params_billions × kv_cache_allocation", is central to capacity planning. The analysis highlights how storage precision, such as FP16, FP8, or FP4, drastically reduces VRAM needs; for instance, Llama 3 70B can go from 210 GB at FP16 to 52.5 GB at FP4 with a 1.5x multiplier. The "kv_cache_allocation" multiplier (1.5x to 2.5x) accounts for KV cache, activations, and runtime overhead, becoming critical for long contexts or large batch sizes. For Mixture of Experts (MoE) models like DeepSeek V3.1 (671B total, 37B active), VRAM planning for batched server inference must consider the total parameter count. The article also stresses aligning VRAM needs with available GPU "step-ladder" capacities (e.g., H100, H200, B200) and notes that embedding models require significantly less VRAM. A six-point checklist aids initial feasibility estimates.

Key takeaway

For MLOps Engineers deploying LLMs on self-hosted GPUs, accurately estimating VRAM is crucial to avoid costly OOM errors. You should apply the "vram_required" formula, carefully considering storage precision and the KV cache multiplier based on your workload. Always round your VRAM estimate up to the next available GPU step-ladder capacity, like H100 or B200, to prevent overspending on underutilized hardware. For MoE models, size based on total parameters for batched inference, not just active ones.

Key insights

VRAM capacity planning for LLMs relies on a formula considering precision, parameters, and KV cache multiplier.

Principles

Method

Estimate GPU requirements by determining bytes per parameter, total parameters, and a workload multiplier. Multiply these, then round up to the next GPU step-ladder rung, adding a 10-15% margin.

In practice

Topics

Best for: Machine Learning Engineer, AI Engineer, MLOps Engineer

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by Anup Jadhav.