VRAM Planning and Model Selection for Local LLM Deployment
Learn how to estimate the real memory requirements of locally deployed large language models by accounting for quantized weights, KV cache, and runtime overhead. This guide provides practical sizing formulas and hardware-based recommendations for choosing models across different VRAM and unified-memory configurations.
VRAM Planning and Model Selection for Local LLM Deployment
As new generations of open-weight large language models continue to appear, more developers want to run them on their own machines. Almost everyone encounters the same question: how much VRAM does a particular model actually need?
Official documentation often lists theoretical requirements for full-precision weights. In real-world local deployments, however, models are usually quantized and must also reserve memory for the context cache. As a result, those figures are often only rough references.
This guide explains the underlying memory requirements and provides reusable estimation methods and hardware-based recommendations.
1. Where Does VRAM Go?
Many hardware selection mistakes come from treating the model’s weight size as its total VRAM usage. During inference, memory consumption generally consists of at least three parts:
Model weights
At BF16 or FP16 precision, every 1 billion parameters requires approximately 2 GB of memory. With 4-bit quantization, this typically falls to slightly above 0.5 GB per billion parameters, including quantization metadata. In practice, a factor of approximately 0.55–0.6 GB per billion parameters is more realistic.KV cache
Attention mechanisms cache the Key and Value tensors for previous tokens. KV cache usage increases with the number of layers, the number of attention heads, and the context length. The longer the context, the more significant this overhead becomes. For long documents, the KV cache alone can consume several additional gigabytes.Runtime overhead
Inference frameworks also require memory for internal buffers, activations, temporary operator workspace, and related runtime resources. This commonly adds another 1–3 GB.
Therefore, a model whose quantized weights occupy only 4 GB may use 6 GB or more during long-context inference. When planning VRAM, reserve an additional 20%–30% of capacity. Choosing hardware that operates at the absolute limit is one of the most common causes of out-of-memory errors.
2. Estimating Memory by Quantization Level
Quantization is the primary way to reduce the hardware requirements of local inference. The following are useful rule-of-thumb estimates:
- FP16/BF16: Approximately 2 GB per billion parameters. This preserves model quality, but full-precision large models are often impractical on consumer hardware.
- 8-bit quantization: Slightly above 1 GB per billion parameters. Quality loss is usually minimal, making this suitable when VRAM is relatively abundant and fidelity is important.
- 4-bit quantization: Approximately 0.5–0.6 GB per billion parameters. This is the practical sweet spot for local deployment, offering a strong balance between quality and resource usage.
- 3-bit quantization and below: Requires less memory, but the impact on model capability becomes more noticeable. These levels are generally best reserved for severely constrained hardware.
Using these estimates:
- A model with approximately 4B parameters may require around 2.5 GB for its 4-bit weights. Including the KV cache and runtime overhead, total usage will typically fall in the 4–6 GB range.
- A model around 26B parameters may require approximately 12–16 GB in total when quantized to 4 bits.
- Models above 30B parameters generally require a budget of more than 20 GB.
3. Choosing a Model by Hardware Tier
Around 6 GB of VRAM
Start with models in the 4B range. A small model in 4-bit quantization can run comfortably while leaving some room for the context window. Attempting to run a model above 20B parameters on this hardware will often either fail during loading or force the context window to become so short that the model is impractical.
Smaller models are already capable of useful instruction following and lightweight question answering. It is usually better to establish a reliable end-to-end workflow before moving to a larger model.
8–12 GB of VRAM
A 4B model should run comfortably, with additional room for a longer context or 8-bit quantization. You can also evaluate aggressively quantized versions of medium-sized models.
However, a model being able to start does not mean it can run reliably. Test actual inference speed and peak VRAM usage with long contexts instead of checking only whether the model loads successfully.
12–16 GB of VRAM
Models around 25B parameters become reasonable candidates in this range. With 4-bit quantization, their weights and a normal context cache can generally fit within the available memory.
The main constraint is context length. Standard conversations should be manageable, but long documents may cause the KV cache to consume the remaining headroom. If necessary, limit the context window or enable KV cache quantization to control peak usage.
24 GB of VRAM or More
Models above 30B parameters become worth considering. They can provide noticeable improvements for code generation, complex reasoning, and long-context tasks.
Even in this tier, however, a VRAM table is only a reference, not a guarantee. Extremely long contexts combined with high concurrency can still exhaust memory. For production deployments, monitor VRAM usage and configure alerts to track memory levels.
Systems with Unified Memory
Some desktop processors use a unified-memory architecture in which the CPU and GPU share system memory. In this case, the main constraints are not dedicated VRAM, but total memory capacity and memory bandwidth.
As a general guideline:
- 16 GB of unified memory: Suitable for models around 4B parameters. Larger models may load with difficulty, but performance can be limited by memory bandwidth.
- 32 GB: Models around 25B parameters become usable.
- 64 GB or more: Models around 30B parameters can also run smoothly.
The key characteristic of these systems is that “fitting in memory” does not necessarily mean “running quickly.” Evaluation should include generated tokens per second, not just whether the model can be loaded.
4. Practical Deployment Recommendations
- Estimate before downloading: Use the formula
parameter count × quantization factor + context budget + 2 GB runtime overheadto estimate requirements before downloading large weight files. - Measure peak usage under realistic workloads: Test with inputs that match your actual application and monitor peak VRAM usage. Do not treat successful loading at idle as sufficient evidence.
- Keep a fallback plan: When memory is tight, the recommended downgrade order is to shorten the context first, then reduce the quantization bit width, and finally switch to a smaller model. Avoid sacrificing stability as the first response.
- Use memory optimization features in the software stack: Major local inference frameworks commonly support techniques such as KV cache quantization, layered loading, and memory mapping. Using these features appropriately can significantly reduce peak memory consumption.
- Consider cloud capacity when elasticity is required: If local hardware cannot support a larger model or higher concurrency, cloud GPU resources and container platforms can provide elastic inference capacity. A hybrid architecture can keep lightweight workloads local while moving heavier workloads to the cloud.
5. Summary
VRAM planning for local LLM deployment is fundamentally a combined calculation of model weights, KV cache, and runtime overhead, rather than a simple comparison with the theoretical full-precision size listed in official documentation.
The core principles are:
- Estimate actual quantized memory usage instead of relying on full-precision figures.
- Reserve at least 20% additional capacity for context and runtime overhead.
- Use peak measurements from realistic workloads as the final basis for hardware selection.
Following this approach makes it easier to choose suitable hardware as models and systems continue to evolve.
