Local LLM VRAM Planning Guide: How to Choose Model Size by Hardware

    This guide explains how to estimate VRAM for local LLM deployment by accounting for model weights, KV cache, and runtime overhead. It covers quantization trade-offs, hardware tiers from 6GB to 24GB+, unified-memory devices, and practical optimizations when memory is tight.

    Local LLM VRAM Planning: A Complete Guide to Choosing Model Size by Hardware

    1. Why Official VRAM Numbers Are Only a Reference

    When developers deploy open-source LLMs locally, the first step is often to check the hardware requirements in the official documentation. These numbers are usually theoretical weight sizes at BF16 or FP16 precision. They are not wrong, but they only answer one question: how much space is needed to load the full model. They do not answer whether the model can run inference smoothly on your machine.

    Actual VRAM usage during deployment has three main components:

    1. Model weights: parameter count × bytes per parameter. At BF16, each parameter takes 2 bytes; after 4-bit quantization, it takes roughly 0.5 bytes. This is the largest part of VRAM usage.
    2. KV cache: during inference, each attention layer caches the Key and Value of historical tokens. Its size is proportional to context length, batch size, number of layers, and hidden dimension. In long-context scenarios, the KV cache can exceed the weights themselves.
    3. Runtime overhead: compute graphs, activations, framework-reserved memory fragmentation, and other costs. This usually takes 1–2 GB. It is easy to overlook, but it often becomes the final straw that exhausts VRAM.

    The right selection approach is therefore not “Can the weights fit into VRAM?” but “Do the weights + KV cache for the target context length + runtime overhead leave at least 15% headroom?”

    2. How Quantization Affects Actual VRAM Use

    Quantization is a core technique for local deployment. Common precision levels and their approximate VRAM relationship are as follows:

    Precision Approx. bytes per parameter 7B-class model weights (approx.) 30B-class model weights (approx.)
    FP16/BF16 2 bytes 14GB 60GB
    8bit 1 byte 7GB 30GB
    4bit 0.5–0.6 bytes 4GB 16GB

    Two points need attention. First, lower quantization precision saves more VRAM, but model quality will suffer perceptibly; 4bit is usually the sweet spot between quality and size. Second, different quantization formats (such as GPTQ, AWQ, and GGUF) have different compute efficiency. Saving more VRAM does not necessarily mean faster inference.

    3. Choosing Models by Hardware Tier

    6GB VRAM (Entry-Level Discrete GPUs)

    At this tier, only 3B–4B models with 4-bit quantization are recommended. Larger models may barely start through CPU offloading, but inference speed will drop to a point with little practical value. Keep context within 4K and disable unnecessary parallel sampling.

    8GB–12GB VRAM (Mainstream Mid-Range GPUs)

    4B-class models can run stably and smoothly, making this a reasonable choice for daily chat and lightweight coding assistance. 7B–8B 4-bit models can be attempted, but KV cache space must be reserved, and the context should not be maxed out. A useful rule of thumb: model weight usage should not exceed 70% of VRAM.

    12GB–16GB VRAM (Upper Mid-Range GPUs)

    This is the range where 20B–30B-class MoE models or 4-bit dense models start to become seriously testable. For MoE architectures with fewer active parameters, all weights can reside in VRAM while only some experts are activated per step, so inference speed can still be acceptable. But “it can start” does not mean “it runs stably.” Benchmark actual tokens/s instead of only checking whether loading succeeds.

    24GB and Above (Flagship GPUs)

    4-bit quantized versions of 30B-class dense models can run fairly comfortably, making this suitable for scenarios with higher requirements for answer quality, coding ability, and long context. Even so, long context still significantly increases KV cache usage. For contexts above 32K, consider quantizing the KV cache as well or moving to a higher-VRAM option.

    4. Choosing Devices with Unified Memory

    Devices with unified memory architecture share memory between CPU and GPU and do not have a separate VRAM concept. The criteria become total memory capacity + memory bandwidth:

    • 16GB unified memory: 4B-class models are the upper limit. The system itself also uses 3–4GB, and larger models will frequently swap memory, resulting in a poor experience.
    • 32GB unified memory: 4B-class models run smoothly, and 20B-class quantized models can be attempted, with a clear experience improvement.
    • 64GB unified memory: 30B-class models can reside fully in memory. This suits users who do not want a discrete GPU but still have quality requirements.

    The bottleneck on unified-memory devices is usually bandwidth rather than capacity. As a result, token generation speed for large models will be noticeably lower than that of discrete GPUs with the same memory tier. Expected speed should be part of the selection process.

    5. General Optimizations When VRAM Is Insufficient

    1. Lower quantization precision: moving from 8bit to 4bit or even 3bit is the most direct approach, but quality loss must be accepted.
    2. Shorten the context window: KV cache grows linearly with context. Cutting 32K to 8K can often free up several GB of VRAM.
    3. Quantize the KV cache: mainstream inference frameworks generally support reducing KV cache to 8bit or 4bit, with significant benefits in long-context scenarios.
    4. Layer offloading: place some layers in system memory and compute them on the CPU, trading VRAM for time. This suits scenarios where a larger model is used only occasionally.
    5. Use elastic cloud compute: if local hardware truly cannot support the target model, consider cloud GPU instances for on-demand inference. For example, Baidu AI Cloud offers GPU cloud servers and model service platforms as general cloud options; these can supplement local compute, with on-demand start/stop to avoid buying high-end GPUs for occasional needs.

    6. Selection Decision Checklist

    Here is a simplified decision flow:

    1. Define the need: chat Q&A, code generation, or long-document analysis? The need determines the target model size and context length.
    2. Calculate the budget: quantized weight size + estimated KV cache for the target context + 2GB runtime headroom ≤ 85% of available VRAM.
    3. Benchmark and verify: any comparison table is only a reference. The final criteria should be tokens/s and time to first token on your own machine.
    4. Keep a fallback: when VRAM is tight, reduce context first, then lower quantization precision, and only then consider a smaller model.

    Once you master this estimation method, you can quickly judge whether your device can run any newly released open-source model and how it should be run, without having to check the documentation.