Local LLM VRAM Configuration: Complete Guide to Sizing, Deployment, and Tuning (April 2026 Edition)

    VRAM requirements for open-weight LLMs are usually quoted as theoretical figures that cover weights alone. Actual usage often runs 30% to 100% higher once KV cache, runtime overhead, and quantization effects are included. This guide shows how to estimate VRAM from a model's parameter count, layer structure, KV head configuration, context length, and concurrency. It includes a ready-to-use Python preflight script, a reference table mapping model size and architecture (dense or MoE) to VRAM requirements, and deployment guidance for discrete GPUs from 6 GB to 24 GB+ and unified memory platforms. It also explains the right tuning order when VRAM runs short, capacity planning for served inference, and a pre-launch checklist. The goal is to make model selection decisions before you buy hardware or deploy.

    1. Start Here: Published VRAM Figures Are Not Deployment Requirements

    When an open-weight model is released, the VRAM figure that comes with it is almost always a theoretical value under ideal conditions: weight size calculated as parameter count multiplied by bits per parameter, with a note that “actual usage depends on context length.” Once the model is actually loaded, VRAM usage is often 30% to 100% higher. The reason is straightforward: the theoretical figure covers weights only, while runtime also involves hidden costs such as KV cache, VRAM preallocation, communication and graphics buffers, and quantization alignment padding.

    For local deployments, the right approach is not to look up a “how much VRAM does model X need” table. It is to understand the estimation method and run the numbers with your own configuration. That is how this guide is organized.

    2. Breaking Down VRAM Usage

    For single-GPU inference, VRAM demand can be approximated as:

    1. VRAM demand ≈ weight size + KV cache + fixed runtime overhead + safety margin

    1. Weight Size

    Weight size is determined by parameter count and bytes per parameter:

    1. Weight size (GB) ≈ Parameters (billions) × Bytes per parameter

    Bytes per parameter depends on the precision or quantization bit width. Half precision is about 2 bytes per parameter, 8-bit is about 1 byte, and 4-bit weight-only quantization is about 0.5 bytes. Two caveats apply:

    • Quantization metadata: Quantization typically uses a grouped strategy, with each group sharing a set of scale factors. This adds roughly 5%–15% in extra metadata.
    • Layers left unquantized: Embedding layers, the output projection, and normalization layers often keep higher precision and are not quantized. The smaller the model, the larger this fixed overhead’s share of the total.

    As a result, the actual weights of a 2B-class model at 4-bit are often not the theoretical 1 GB, but closer to 1.3–1.6 GB.

    2. KV Cache

    This is the component most likely to get out of control in long-context scenarios. Autoregressive inference needs to cache the attention keys and values of past tokens. Its size scales roughly in proportion to sequence length and concurrency:

    1. KV (GB) ≈ 2 × layers × KV heads × head dim × bytes × sequence length × concurrency / 1e9

    Key takeaways:

    • Linear growth: KV cache grows linearly with context length and linearly with concurrency.
    • Grouped-query attention (GQA): GQA significantly reduces this term by reducing the number of KV heads. It is an important design choice for long-context friendliness.
    • Cache precision: Going from an FP16 cache to an 8-bit cache makes a direct 2× difference.

    As a rule of thumb, for a mid-size model at a 4K context, KV cache for a single request is around a few hundred MB. Push the context beyond 32K and add a few concurrent requests, and it can exceed the size of the weights themselves. This is the most common reason for “the weights fit, but it blows up as soon as I send long text.”

    3. Fixed Runtime Overhead

    This includes:

    • Preallocated blocks from the VRAM allocator: Most inference frameworks reserve a substantial share of available VRAM up front to avoid fragmentation.
    • Operator workspaces and graph caches
    • Communication buffers for tensor parallelism across multiple GPUs
    • Desktop or graphics compositor processes running on the GPU: These take up 0.5–1.5 GB.
    • Alignment padding: Structures that are not multiples of 8-bit or 16-bit integers, such as attention head dimensions and hidden dimensions, produce padding during quantization.

    4. Safety Margin

    Leave 15%–20% in reserve. This is not excessive caution. A VRAM overflow is not as simple as “an error you can retry”: it kills the inference process, invalidates the KV cache, and rolls back the batch queue. In unattended services, the cost is high.

    You can embed the following script directly in your deployment pipeline as a preflight check:

    1. def estimate_vram_bytes(num_params_b, bytes_per_param,
    2. num_layers, num_kv_heads, head_dim,
    3. ctx_len, batch=1, kv_bytes=2, overhead_gb=1.5):
    4. weights = num_params_b * 1e9 * bytes_per_param * 1.15 # 1.15: quantization metadata and unquantized layers
    5. kv = 2 * num_layers * num_kv_heads * head_dim * kv_bytes * ctx_len * batch
    6. total = weights + kv + overhead_gb * 1e9
    7. return total / 1e9, (total * 1.2) / 1e9 # Returns: estimate, estimate with 20% headroom
    8. need, safe = estimate_vram_bytes(8, 0.5, 32, 8, 128, ctx_len=8192)
    9. print(f"Estimated {need:.1f} GB; recommend at least {safe:.0f} GB of available VRAM")

    3. Choosing by Model Size and Architecture

    Before looking at size tiers, you must distinguish between model architectures. This is a major reason many comparison tables fail:

    • Dense models: Every forward pass activates all parameters. VRAM usage is determined by total parameter count, and latency also increases with parameter count.
    • Sparse (Mixture-of-Experts) models: Total parameter count determines VRAM usage, but only a small fraction of the parameters are activated per token. The result is “heavy on VRAM, light on compute, relatively low latency.”

    The ranges below are order-of-magnitude references for engineering decisions, not exact guarantees:

    Model Size / Architecture Weight Size After 4-bit Quantization Typical Starting VRAM Main Bottleneck
    1B–2B dense ~1–1.5 GB 4 GB Capability ceiling
    3B–5B dense ~2–3.5 GB 6 GB KV cache at long context
    7B–9B dense ~4.5–6 GB 8 GB (12 GB is safer) Context length and concurrency
    10B–15B dense ~7–10 GB 16 GB Generation speed
    20B–30B sparse (MoE) ~12–18 GB 16 GB is tight, 24 GB is comfortable Loading weights + memory bandwidth
    20B–35B dense ~13–22 GB 24 GB and above Limited by both VRAM capacity and bandwidth

    A comparison that often goes unnoticed: a 20B–30B MoE model may use more VRAM than a 13B dense model, yet it is not necessarily slower. If your goal is “fast responses plus enough VRAM,” this architecture is worth considering first. If your goal is “compress cost to the limit on a single GPU,” a smaller dense model from the same generation is often the better value.

    4. Deciding by Hardware Tier

    6 GB entry-level discrete GPU / no discrete GPU: The realistic answer is a 3B–5B class model at 4-bit quantization, with context kept at 4K–8K. This range suits validating pipelines, classification and extraction tasks, and offline batch processing. It is not suitable as a primary conversational model. Attempting to run larger models here typically does not mean “it runs slowly” but “it will not start at all.”

    8 GB–12 GB discrete GPU: The main arena for 7B–9B dense models. The key is not to leave zero headroom: running a 7B model with a 32K context right at the 8 GB limit will almost certainly trigger allocation failures or heavy swapping. Leave more than 2 GB of headroom. An 8-bit KV cache combined with grouped quantization usually works better than squeezing the parameters to the limit.

    12 GB–16 GB discrete GPU: 13B-class dense models and 20B–30B-class MoE models become worth serious evaluation. The right mindset here: being able to start is not the same as being stably usable. Judge by sustained throughput (tokens/s), not by whether the model loads successfully.

    24 GB and above: 35B-class dense models or larger MoE models move into the feasible range. At this point, however, the constraint shifts to VRAM bandwidth. The decode phase is memory-bound, and bandwidth determines single-request speed. A configuration with enough capacity but insufficient bandwidth often delivers a worse long-context experience than one with slightly less capacity but higher bandwidth.

    Unified memory platforms (mobile and all-in-one desktop devices): The decision logic is completely different. You need to check three things at once:

    1. Total unified memory capacity: The operating system, graphics, and applications themselves take up a substantial share. Typically, only 50%–70% can be allocated to the model, so a 32 GB machine has about 16–22 GB available.
    2. Memory bandwidth: These platforms commonly deliver bandwidth on the order of hundreds of GB/s, clearly lower than a comparable discrete GPU. This is the main limitation for long-text and high-concurrency scenarios.
    3. Whether memory pressure causes swapping: Once physical memory is exceeded, the system starts paging, and latency degrades by orders of magnitude. Unlike a VRAM OOM error, this does not fail outright, so it is hard to detect right away.

    Practical approach: keep model VRAM usage within 70% of available memory. Use monitoring tools to watch for sustained memory pressure and swapping activity.

    5. Tuning Order: What to Do When VRAM Runs Short

    Do not start by swapping models. Troubleshoot in the following order, from highest to lowest cost-effectiveness:

    1. Reduce context length. This is the option with the biggest payoff and the smallest cost. Going from 32K to 8K cuts KV cache to one quarter.
    2. Reduce concurrency. KV cache grows linearly with concurrency, and a single serial request stream is often the sensible choice for local use.
    3. Use lower-precision or quantized KV cache. An 8-bit KV cache usually has minimal impact on quality and saves half the memory outright.
    4. Enable PagedAttention-style mechanisms. Allocating KV cache in blocks can significantly reduce fragmentation and wasted reserved space.
    5. Drop weight quantization by one level. Going from 8-bit to 4-bit halves weight memory, but you need to assess quality loss. Quantization error is more noticeable in lower-parameter models.
    6. Offload at the operator level. Placing some layers in host memory makes the model run, but latency rises sharply. This is only suitable for offline batch processing.
    7. Use tensor parallelism across multiple GPUs. Watch out for communication overhead. On some multi-GPU setups without high-speed interconnects, a smaller single-GPU model performs better.

    6. Capacity Planning for Serving

    Individual users care about “can it run,” while production services care about “how many requests can it handle.” Serving adds these considerations:

    • Extra VRAM from batching: Continuous batching keeps the KV caches of multiple requests resident at the same time. VRAM usage ≈ single-request KV cache × concurrency. Capacity planning must be based on peak concurrency, not the average.
    • Request length distribution: For most services, the bottleneck is not the average input length but the long tail. Track the P95/P99 input and output lengths, and set the context limit based on P99.
    • Queuing and degradation policies: Set a maximum context length, a maximum concurrency, and a queue timeout. Making timed-out requests fail fast with a clear error is more manageable than letting an entire batch stall.
    • Observability: Add VRAM usage, KV cache hit rate, queue time, tokens/s, and time to first token to monitoring and alerting, with notifications when thresholds are crossed. Otherwise, VRAM leaks and slow queries can only be discovered through user feedback.

    When moving to the cloud, these capabilities can be assembled directly from standard building blocks: a container platform to host inference services and scale them elastically, object storage to hold model weights and quantized artifacts with version management, a load balancer to distribute requests, a logging service to capture requests and error information, and monitoring and alerting to cover VRAM and latency metrics. Platforms such as Baidu AI Cloud provide this kind of general-purpose foundational capability. For specific specs and quotas, refer to the current parameters in the official documentation. This guide makes no promises about any vendor’s specific metrics.

    7. Pre-Launch Checklist

    • Use the estimation script with your own parameter count, layer structure, context length, and concurrency to calculate requirements. Do not copy numbers from a comparison table.
    • Reserve 15%–20% of VRAM/RAM headroom. Do not run at the limit.
    • Set the context length to the smallest value the business requires, and configure a per-request limit.
    • On unified memory platforms, additionally check memory pressure and swapping.
    • Stress-test with real business samples, and record P95 time to first token and sustained throughput.
    • Run an A/B comparison at the same budget: a larger model with short context versus a smaller model with long context. Determine which better fits the business.
    • Have monitoring and alerting in place, covering VRAM usage, queue time, and error rate.

    VRAM problems are never about “looking up a number.” They are about “doing the math.” Break down weight size, KV cache, and runtime overhead, then layer in your actual business parameters for context length and concurrency. Doing so resolves most sizing questions before you buy hardware or deploy.