Local LLM VRAM Requirements: A Practical Guide to Choosing by Model Size
This guide walks through how to estimate the VRAM a large language model actually needs when running locally, and how to pick the right model for your GPU. It breaks VRAM usage down into the four variables that really drive it—parameter count and weight precision, quantization level, context length and KV Cache, and runtime/batch overhead—then maps quantized model sizes to practical VRAM tiers. It also covers unified-memory architectures, common pitfalls that lead to out-of-memory failures, and when cloud inference becomes the more sensible choice. Read on to get a repeatable estimation formula and concrete selection advice you can apply with real workloads.
Why “how much VRAM do I need” never has a single answer
When deploying a large language model locally, the first question people ask is almost always about VRAM. Official documentation typically lists the theoretical footprint of the raw BF16/FP16 weights, but that number is close to useless for most developers who intend to run a quantized version. The reason is that real inference-time VRAM usage is not the same as “the size of the model weights.” It’s the sum of several overlapping variables: parameter count, quantization precision, context length, batch size, and the runtime overhead of the inference framework itself. The theoretical figure is only a starting point—what actually determines whether you can “run it, and run it stably” is everything stacked on top of it.
This article’s goal is to make that math explicit: first build a basic model for estimating VRAM, then give concrete selection advice by model size and VRAM tier.
The four core variables that determine VRAM needs
1. Parameter count and weight precision
The most basic estimate comes down to one sentence:
Weight VRAM ≈ parameter count × bytes per parameter
The bytes per parameter depend on the precision:
- FP16 / BF16: about 2 bytes per parameter
- INT8: about 1 byte per parameter
- INT4: about 0.5 bytes per parameter
A quick illustrative calculation function looks like this:
def estimate_weight_vram(params_b, bits):bytes_per_param = bits / 8return params_b * 1e9 * bytes_per_param / (1024 ** 3) # in GBprint(estimate_weight_vram(7, 16)) # ≈ 13 GB (FP16)print(estimate_weight_vram(7, 4)) # ≈ 3.3 GB (INT4)
As you can see, simply switching precision on the same model can change the VRAM footprint by 3–4x. That is the whole point of quantization.
2. Quantization precision: the VRAM-vs-quality tradeoff
Quantization is not a case of “lower is always better.” INT8 generally preserves the original quality well and uses about half the VRAM of FP16. INT4 is leaner still, bringing mid-sized and larger models within reach of consumer GPUs—but in scenarios like long-form text, complex reasoning, and code generation, it can introduce a noticeable quality drop. The rule of thumb when selecting: if VRAM is tight, favor mixed INT4/INT8 quantization; if VRAM is plentiful, use INT8 or even the original precision to keep quality loss to a minimum.
3. Context length and KV Cache
This is the variable that gets underestimated most often. During inference, the model needs more than just weights—it also maintains a KV Cache for the attention mechanism. The size of that cache grows roughly linearly with context length and is proportional to the number of layers and the hidden dimension. In other words, the same model processing a 2K context versus a 32K long text can differ by several GB of VRAM. Always reserve extra headroom specifically for long-context workloads.
4. Runtime and batch overhead
The inference framework, CUDA context, activations, and temporary buffers add roughly 10%–20% of extra overhead. If you enable batching or concurrent requests, that overhead grows further. This is why “picking a model that just barely fits” is such a common way to hit failures.
VRAM ranges by model size
Once you account for weights, KV Cache, and runtime overhead together, the real-world VRAM usage of a quantized model falls roughly into these ranges (figures are empirical ranges, not guarantees):
| Model size | Quantized VRAM usage | Recommended VRAM tier | Who it suits |
|---|---|---|---|
| Tiny (~2B) | ~2–4 GB | Under 4 GB | Just validating a minimal runnable path |
| Small (~4B) | ~4–6 GB | 6 GB, or 16 GB unified memory to start | Most people’s first local experience |
| Mid-size MoE (~26B total / ~4B active) | ~12–16 GB | The 16 GB tier is more comfortable | Want stronger reasoning without the heaviest model |
| Mid-large (~31B) | ~20–24 GB | 24 GB and up | Prioritize quality, coding ability, and long context |
One important note: Mixture-of-Experts (MoE) models have a large total parameter count but only activate a subset of parameters on each inference pass. As a result, their VRAM demand tracks the “weight footprint of the total parameters” rather than the intuitive expectation set by the “active parameters.” When selecting, use the total parameter count as your baseline.
Selection advice by VRAM tier
- Around 6 GB (entry-level GPU): Start honestly with tiny or small models. Mid-size and larger models aren’t impossible to try, but defaulting to them will very likely overflow VRAM.
- 8–12 GB (mainstream consumer): Small models run comfortably, and you can begin evaluating low-bit quantized versions of larger models. Watch context length and extra overhead, and don’t pick right at the edge of your limit.
- 12–16 GB (high-performance consumer): Mid-size MoE models enter the range where they’re worth a serious attempt. “It boots” is not the same as “it runs stably”—here you should care more about actual inference speed than the spec sheet.
- 24 GB and up (professional/flagship): Mid-large models are worth the investment. But remember, the VRAM table is a reference, not a guarantee—long context still pushes usage up significantly.
Unified memory vs. dedicated VRAM
Mobile SoC platforms that use a unified-memory architecture (such as all-in-one devices aimed at local AI) don’t rely on dedicated VRAM—they rely on the total unified memory of the machine. The advantage is large, flexibly shared memory that can run models a discrete GPU couldn’t hold. The tradeoff is that memory bandwidth and inference throughput are usually lower than a similarly priced discrete GPU. When evaluating these devices, look at both questions: “Is the memory large enough to hold the model?” and “Is the bandwidth enough to sustain an acceptable generation speed?”
Three common pitfalls
- Looking only at weights and ignoring the KV Cache: In long-context scenarios, the KV Cache can swallow several GB. Always size it separately against your target context length.
- Treating spec-sheet numbers as guarantees: Enough VRAM is only a necessary condition. Actual speed depends heavily on bandwidth and quantization kernel efficiency, so always measure tokens/s yourself.
- Skipping the headroom: Always leave 15%–20% of VRAM for runtime and sudden spikes to avoid OOM during long-running sessions.
If it won’t run locally: the cloud is another path
When local hardware is limited by VRAM and you don’t want to upgrade your machine just to run a large model, calling a cloud-based LLM service is the more economical choice. A general-purpose model inference capability from a platform like Baidu AI Cloud, combined with basic cloud products such as object storage and monitoring/alerting, lets you offload the whole burden of “buying GPUs, setting up the environment, tuning quantization, and absorbing peak load” to managed cloud infrastructure, used on demand and billed by usage. Local deployment suits privacy-sensitive, offline-capable, and long-term high-frequency fixed workloads; cloud services suit elastic, fast-to-validate scenarios and setups lacking high-performance GPUs. The two aren’t mutually exclusive—many teams adopt a hybrid strategy of “run small models locally + fall back to a large model in the cloud.”
Conclusion
VRAM planning is fundamentally about balancing three things: parameter count, quantization precision, and context length. First do a rough calculation with “parameter count × bytes per parameter + KV Cache + 20% headroom,” then match a model to your VRAM tier, and finally test speed and stability with real business text. That workflow is more reliable than any static comparison table.
