Complete Guide to VRAM Configuration for Local LLM Deployment
This guide provides actionable VRAM estimation methods and hardware selection recommendations for deploying large language models locally. It breaks down the four main components of VRAM usage—weights, KV cache, activations, and framework overhead—and offers practical hardware configurations across different model sizes and quantization levels.
Complete Guide to VRAM Configuration for Local LLM Deployment
When deploying large language models locally, the most common question is not whether you can download the model, but how much VRAM your machine actually needs. Vendor documentation typically provides theoretical values for BF16 or FP16 original weights. However, actual deployment often uses 4-bit or 8-bit quantization, compounded by KV cache, runtime buffers, batching, and long context overhead. Relying solely on a weight size table can easily lead to wrong decisions. This article provides an actionable VRAM estimation method and hardware selection recommendations based on different parameter sizes and quantization levels.
1. Four Components of VRAM Usage
When estimating local inference VRAM, it is recommended to use the following simplified model:
Total VRAM ≈ Weight VRAM + KV Cache + Activations & Temp Buffers + Runtime Framework Overhead
Weight VRAM is determined by the number of parameters and quantization precision. Taking 4-bit weights as an example, each parameter takes about 0.5 bytes. Factoring in quantization metadata, whether embedding and output layers are quantized, etc., an engineering estimate of 0.55–0.65 bytes per parameter is practical. A ~4B parameter model’s weights take about 2–2.6GB, but the actual total usage typically reaches 4–6GB; a ~31B parameter model’s weights take about 17–20GB, with actual total usage often falling between 20–24GB.
KV cache is often underestimated. The simplified formula is:
KV Cache ≈ 2 × layers × KV heads × head dimension × sequence length × batch size × bytes per element
Using Grouped-Query Attention (GQA) can significantly reduce the number of KV heads, but increasing the context from 4K to 32K still causes exponential growth in KV cache. If the batch size is further increased from 1 to 4, VRAM pressure is amplified. Activations, temporary buffers, framework runtime, graph optimization, and memory pools also incur fixed overhead, usually ranging from a few hundred MB to several GB. Therefore, “weights fit” does not mean “stable service.”
2. Parameter Tiers and Empirical VRAM Comparison
The table below shows empirical ranges for 4-bit weights, batch size 1, and moderate context length. It is suitable for initial screening but should not replace real-world testing.
| Parameter Tier | 4-bit Weight VRAM | Recommended Total Usage | Recommended Hardware Tier | Target Audience |
|---|---|---|---|---|
| ~2B | ~1–1.5GB | ~2–4GB | Lightweight machines under 4GB | Verifying minimum runnable path |
| ~4B | ~2–3GB | ~4–6GB | Starting from 6GB VRAM or 16GB unified memory | First local experience for most users |
| ~26B total params, ~4B active (MoE) | ~13–17GB | More comfortable from 16GB, 12–16GB requires extreme tuning | 16GB tier | Wanting stronger inference without the heaviest models |
| ~31B | ~17–20GB | ~20–24GB | 24GB and above | Prioritizing quality, code, and long context |
It should be emphasized: for Mixture of Experts (MoE) architectures, the total parameters determine the weight loading size, while active parameters determine partial computation overhead. It does not mean VRAM is calculated solely based on active parameters. If quantization granularity is coarse, embedding layers are unquantized, or KV cache uses FP16, actual usage will be higher than the table’s lower bounds.
3. Hardware Selection by Tier
~6GB VRAM: Prioritize ~4B models. The core goal here is “stable runnability,” not maximum parameters. ~26B or 31B models may start with extreme quantization but will easily trigger out-of-memory errors during long contexts or multi-turn conversations. It is recommended to start with 4K context and batch size 1, record peak VRAM, and then increase gradually.
8–12GB VRAM: ~4B is more stable, can evaluate lower-bit quantization of larger models. This tier allows trying the low-context version of a ~26B MoE model, but you should distinguish between “can start” and “can serve stably.” Runtime overhead, GUI usage, and desktop environment VRAM will erode available space; do not select configurations at the absolute limit.
12–16GB VRAM: ~26B MoE enters a viable range for serious trials. Using 4-bit weights, 8-bit KV cache, 4K–8K context, and batch size 1 usually provides a complete experience. However, long context and concurrency will significantly increase usage. It is recommended to focus on actual inference speed and first-token latency rather than just nominal specs.
24GB+ VRAM: ~31B is worth trying. This tier can cover higher-quality models and longer contexts, but still needs margins for KV cache and temporary buffers. If planning multi-concurrency services, distribute total VRAM by concurrency count rather than estimating by single-request peaks.
4. Evaluating Unified Memory Architecture Platforms
Unified memory architecture platforms do not distinguish between dedicated VRAM and system memory; models can share total system memory, but memory bandwidth remains a bottleneck. Empirically: 16GB unified memory suggests starting with ~4B; ~26B can run barely but is speed-limited. 32GB unified memory makes ~4B smoother, and ~26B is worth trying. 64GB unified memory can cover ~26B and ~31B, suitable for users with quality demands who don’t want to use a discrete GPU. The 18GB tier should prioritize ~4B, with ~26B depending on context and quantization strategy.
5. Context, Concurrency, and Quantization Strategies
Long context is a hidden variable in VRAM growth. It is recommended to fix the model and quantization format first, start with 2048 or 4096 context, test 8K, 16K, and 32K by doubling, and record peak VRAM and throughput. Concurrency tests should start at batch size 1, gradually increase to 2 and 4, and observe if obvious jitter occurs. KV cache quantization can reduce usage but may affect long-context stability; a combination of 4-bit weights and 8-bit KV cache is usually more balanced. Lower-bit quantization is not necessarily faster because dequantization and operator implementation may introduce extra overhead.
A universal deployment pseudo-config is as follows:
deployment:weight_quantization: int4kv_cache_dtype: int8context_length: 4096max_batch_size: 1memory_offload: automonitor: peak_vram
6. Establishing Your VRAM Baseline
It is recommended to test practically following these steps: First, fix the model version and quantization format. Second, set batch size to 1, starting context at 4K. Third, record free VRAM after loading, peak VRAM for the first token, and peak during continuous generation. Fourth, gradually increase context and concurrency. Fifth, test the difference between FP16 and INT8 KV cache separately. Only by establishing your own baseline can you turn “reference tables” into reliable decisions.
7. Common Pitfalls
Only looking at weight file size, ignoring KV cache and runtime overhead; equating “can start” with “can run stably”; inferring long-context performance from short-context test results; ignoring desktop environment and background process usage; assuming unified memory can scale infinitely. In actual deployment, reserving a 15%–25% VRAM margin is generally more robust.
Conclusion
The selection order for local deployment should be: first determine the weight minimum by parameter tier, then adjust total usage with context and concurrency, and finally leave a margin based on hardware tier. ~4B is suitable for most people’s first experience, ~26B MoE is suitable for serious trials on the 16GB tier, and ~31B is better for 24GB+ scenarios emphasizing quality and long context. A VRAM table is a screening tool, not a performance guarantee; relying on measured peaks ensures a stable, reproducible local inference experience.
