A Practical Guide to VRAM Configuration and Hardware Selection for Local LLMs

    Local large language models often fail not because the model is too large, but because VRAM planning is incomplete. This guide explains how to estimate total VRAM usage—including weights, KV cache, activations, and runtime overhead—and how to match model tiers with appropriate GPU or unified memory configurations. It covers 4B to 30B parameter models, quantization considerations, per-GPU recommendations from 6GB to 24GB+, and a practical step-by-step workflow for stable deployment.

    Introduction: Why VRAM Planning Is More Complex Than It Looks

    When running large language models (LLMs) locally, the most commonly underestimated factor is not the model’s parameter count—it is the complexity of ensuring sufficient VRAM. Many configuration tables provide only a rough VRAM range, but real-world results are influenced by multiple interacting factors: quantization method, context length, batch size, inference framework implementation, KV cache strategy, and operating system/driver overhead.

    Therefore, VRAM configuration cannot be approached simply by asking “how big is the model?” Instead, a complete evaluation framework should be established that accounts for model tier, hardware tier, and runtime parameters.

    This article abstracts the problem into a general technical topic: how to select appropriate VRAM configurations for local LLMs across different parameter scales, quantization levels, and hardware resources—while avoiding the common pitfall of configurations that “load but cannot run stably.”

    1. Mapping Model Tiers to Basic VRAM Usage

    From an engineering perspective, local LLMs can be categorized into four rough tiers based on parameter size and activation behavior. The following table shows typical post-quantization VRAM usage and recommended hardware for each tier.

    Model Tier Post-Quantization VRAM (Approx.) Recommended Hardware Target User
    ~2B ultra-efficient ~2–4 GB Lightweight devices with 4 GB or less Those validating a minimal runnable path
    ~4B small efficient ~4–6 GB 6 GB discrete GPU or 16 GB unified memory as a starting point Most users’ first local experience
    Medium-scale sparse activation ~12–16 GB 16 GB tier for comfortable operation Those wanting stronger inference without the heaviest models
    ~30B medium-to-large dense ~20–24 GB 24 GB or above Those prioritizing quality, code generation, and long context

    This table is a starting point only—not a guarantee. The reason is that “post-quantization VRAM usage” typically covers only the weights. Actual runtime demands additional memory for:

    • KV cache
    • Temporary activations
    • Inference framework buffers
    • VRAM fragmentation
    • System/graphical interface overhead

    Long context scenarios are particularly impactful: KV cache growth can push a configuration that is “just enough” into out-of-memory territory.

    2. What Actually Consumes VRAM

    A more rigorous estimation model can be expressed as:

    1. Total VRAM ≈ Weight VRAM + KV Cache + Activations and Temporary Buffers + Runtime and Framework Overhead + Safety Margin

    Weight VRAM can be approximated from parameter count and quantization bytes:

    1. def weight_memory_gb(params_billion, bytes_per_param):
    2. # params_billion is in units of one billion parameters
    3. return params_billion * 1e9 * bytes_per_param / (1024 ** 3)
    4. # Example: 4-bit quantization is approximately 0.5 bytes/param, plus quantization metadata and alignment overhead
    5. approx = weight_memory_gb(4, 0.5)

    KV cache estimation is more dependent on architectural parameters and runtime configuration. The general formula is:

    1. KV Cache ≈ 2 × num_layers × num_kv_heads × head_dim × sequence_length × batch_size × bytes_per_element

    This shows that context length and batch size are two amplifiers of VRAM growth. Many statements like “model X runs on 24 GB” implicitly assume short context and batch size of 1. Once context extends to tens of thousands of tokens, or concurrent requests are enabled, VRAM demand rises rapidly.

    Three principles should guide any configuration:

    1. Get the minimal path working first: Use ultra-efficient or small-efficient models to validate drivers, runtime, and the basic inference pipeline.
    2. Then test stable throughput: Do not just check whether the model loads—observe peak VRAM, time-to-first-token, and sustained generation speed.
    3. Finally tune context and batch size: Increase long context and concurrency gradually, always preserving a safety margin.

    3. Hardware Tier Recommendations

    3.1 6 GB Discrete GPU: Prioritize Small Efficient Models

    A 6 GB GPU is suitable for a first local LLM experience. At this tier, stick with ~4B small efficient models. It is technically possible to attempt medium-scale sparse or dense models, but doing so from the start risks VRAM exhaustion and severe performance degradation due to constant swapping.

    Practical advice:

    • Prefer 4-bit or more compact quantized versions.
    • Start with short context lengths; only extend after confirming stability.
    • Close unnecessary background GUI applications to preserve VRAM headroom.
    • Measure success by “can it sustain a continuous conversation,” not merely “can it load.”

    3.2 8–12 GB Discrete GPU: Small Efficient Models Are Safer; Larger Models with Caution

    The 8–12 GB tier offers more headroom, but pushing it to the absolute limit is still not recommended. Small efficient models are typically very stable. It is also feasible to evaluate quantized versions of larger models, but the key distinction is whether the weights fit versus whether the model runs at runtime. Context length, framework pre-allocation policies, and batch size all change peak VRAM.

    Recommended approach:

    • Maintain two configurations: a stable configuration for daily use and an experimental configuration for testing larger models.
    • Record peak VRAM at different context lengths.
    • If noticeable swapping or latency jitter occurs, first reduce context or batch size.

    3.3 12–16 GB Discrete GPU: Medium-Scale Sparse Models Become Viable

    At 12–16 GB, medium-scale sparse activation models are a serious option. These models have large total parameter counts but activate fewer parameters per token, potentially offering a better balance of quality and speed during inference. However, “it loads” is not the same as “it runs reliably.” Monitor actual inference speed, VRAM growth under long context, and whether the framework creates excess cache.

    Key metrics to watch:

    • Whether peak VRAM sits near the ceiling for extended periods
    • Whether generation speed suddenly drops during sustained output
    • Whether long contexts trigger reclamation and reallocation
    • Whether multi-turn conversations lead to VRAM fragmentation

    3.4 24 GB and Above: Medium-to-Large Dense Models Worthy of Evaluation

    The 24 GB+ tier is more appropriate for ~30B medium-to-large dense models. This tier prioritizes generation quality, code capability, and long-context behavior. Still, the VRAM table is a reference, not a guarantee. Long contexts significantly increase memory usage, and quantization choices affect both quality and speed. Benchmark under fixed context and batch size before deciding to use such models for production assistance.

    4. Unified Memory Devices: A Different Perspective

    Unified memory devices do not have discrete VRAM in the traditional sense. What matters is the total unified memory size and memory bandwidth. The advantage is that CPU and accelerator share the same memory pool, allowing larger models to run than a discrete GPU’s VRAM would permit. The limitations are bandwidth and system-level memory pressure, which constrain actual speed.

    Unified Memory Tier Recommended Model Tier Notes
    16 GB Small efficient models as a baseline; sparse medium models run but slowly Sufficient for daily conversation; large models primarily limited by memory bandwidth
    32 GB Small efficient models run smoothly; sparse medium models can be attempted Notable improvement over 16 GB
    64 GB Sparse medium and medium-to-large dense models both run Suitable for users prioritizing quality without discrete accelerators
    128 GB Medium-to-large dense models without pressure; more stable under concurrency Where flagship devices excel

    On unified memory devices, pay special attention to system RAM usage. Browsers, development tools, and containers all compete for the shared memory pool. Close high-usage applications before inference, and monitor memory pressure and swap activity.

    5. Deployment Workflow and Fallback Strategy

    The recommended process is:

    1. Minimal validation: Verify the inference pipeline with an ultra-efficient model.
    2. Stable configuration: Determine daily-usable context and batch size with a small efficient model.
    3. Capacity assessment: Record peak VRAM, tokens-per-second, and time-to-first-token.
    4. Incremental upgrades: Change only one variable at a time—avoid increasing model size, context length, and batch size simultaneously.
    5. Prepare fallbacks: Maintain a verified stable model configuration for each hardware tier.

    If local resources are insufficient, use general-purpose cloud hosts or container platforms to validate on demand, and combine with logging services and monitoring alerts for capacity assessment. Whether local or cloud-based, the core methodology is the same: estimate first, stress-test second, and base hardware selection on stable operation metrics rather than nominal specs.