Complete Guide to VRAM Configuration for Local LLM Deployment: How Much VRAM Do Different Model Sizes Need?
This article explains the calculation principles behind VRAM usage for local LLM deployment, covering model weights, KV Cache, and runtime overhead. It offers a practical hardware selection matrix for various model sizes, actionable tips to reduce VRAM consumption, and a clear decision-making workflow to help developers estimate resource requirements accurately.
Whenever a new open-source LLM is released, the first thing local deployment enthusiasts do is often not downloading the weights, but digging through the documentation to answer one question: “How much VRAM does this model actually need?” Unfortunately, official documentation typically provides theoretical values based on BF16 raw weights. For practitioners who routinely use quantized versions, these numbers can be off by several multiples compared to actual usage. This article starts from the calculation principles of VRAM consumption and combines hands-on experience with various consumer-grade hardware to provide a practical methodology for VRAM configuration and hardware selection.
1. Why Official VRAM Numbers Are “Just for Reference”
To understand VRAM estimation, we must first break down what consumes VRAM during inference. A complete model inference process roughly incurs four types of VRAM overhead:
1. Model Weights. This is the largest portion. VRAM for weights ≈ Parameter count × Bytes per parameter. For BF16 (2 bytes/parameter), a 4B parameter model requires about 8GB. With 4-bit quantization, each parameter is compressed to about 0.5 bytes, reducing the weight footprint to just 2GB. This is why quantization is the lifeline of local deployment.
2. KV Cache. During inference, the model caches attention key-value pairs, whose size is proportional to context length, batch size, number of layers, and hidden dimensions. In long-context scenarios, KV Cache growth can exceed the weights themselves, which is the fundamental reason why many deployments run out of memory (OOM) despite the weights fitting comfortably.
3. Activations and Runtime Overhead. The inference framework itself, CUDA context, and intermediate activation buffers typically consume an additional 1~3GB. On low-VRAM graphics cards, this cannot be ignored.
4. Computation Buffers and Dequantization Temporary Space. Some quantization schemes require dequantizing weights to higher precision before computation, causing instantaneous peak overhead.
A commonly used rough estimation formula:
Total VRAM ≈ Weights(Parameter count × Quantization bit-width / 8) + KV Cache + 1~3GB Runtime overhead
Take a 30B dense model with 4-bit quantization and 4K context as an example: weights take about 17~19GB, KV Cache is around 2~4GB depending on the architecture, plus the overhead. A 24GB VRAM card is a relatively safe starting point—this is the core logic of the selection table below.
2. VRAM Usage Reference Table by Model Size
Based on common community practices, here is a quick reference for typical quantized usage (based on mainstream 4-bit quantization schemes):
| Model Size | Quantized VRAM Usage | Recommended Hardware Tier | Suitable Scenarios |
|---|---|---|---|
| 2B Small Models | ~2~4GB | 4GB VRAM or 8GB+ unified memory devices | Minimum viable path verification, embedded/edge trial |
| 4B Small Models | ~4~6GB | 6GB VRAM or 16GB unified memory devices and above | First local deployment experience for most users |
| 26B MoE Models (Active parameters ~4B) | ~12~16GB | 16GB tier is more comfortable | Stronger reasoning without full dense model overhead |
| 30B Dense Models | ~20~24GB | 24GB and above | Quality, coding capabilities, and long context |
Several points are worth elaborating on:
VRAM Characteristics of MoE Architectures. In recent years, Mixture of Experts (MoE) models have popularized a design of “large total parameters, small active parameters,” such as 26B total parameters but only activating about 4B parameters per inference. The advantage of these models is that inference speed is close to small models (because the computation is determined by the active parameters), but VRAM usage is close to large models (because all expert weights must reside in VRAM). Therefore, when selecting, one should not assume that “4B active parameters mean low VRAM usage”—a common misconception.
Table Numbers Are References, Not Guarantees. Models of the same parameter size may differ by 10%~20% in actual usage due to architectural differences (layers, hidden dimensions, vocabulary size) and quantization scheme differences (whether grouped quantization is used, whether some high-precision layers are retained). Configurations pushed to the absolute limit often crash the first time a long context is loaded.
3. Hardware Selection Recommendations by Tier
3.1 6GB Class Graphics Cards
For this tier (such as various consumer-grade graphics cards with 6GB VRAM), it is recommended to start honestly with 4B quantized models. It is not entirely impossible to try 26B or 30B models—you can force them to run using layer-wise offloading (placing some weights in system memory)—but starting directly with large models will easily trigger OOM during the loading phase, and offloading brings an order-of-magnitude drop in speed, resulting in a terrible experience.
3.2 8GB~12GB Graphics Cards
4B models run very stably in this tier, with enough headroom to evaluate quantized versions of larger models. The key caveat is: always reserve 20%~30% headroom for context and runtime overhead. For example, running a model claiming 10GB usage on a 12GB VRAM card will likely OOM as the context length increases. It is recommended to set the default context length to half of the model’s supported maximum and gradually increase it based on actual usage.
3.3 12GB~16GB Graphics Cards
26B MoE models enter the “worth seriously trying” zone in this tier. A principle must be emphasized: being able to start does not mean it can run stably and efficiently. The evaluation criteria should always be the actual tokens/s generation speed and Time-to-First-Token (TTFT), rather than “the program didn’t crash.” It is recommended to run a round of benchmarks with a standardized prompt set after deployment, recording the speed curve at different context lengths.
3.4 24GB and Above
30B dense models can truly deliver value in this tier. With ample VRAM, you can enable FP16 KV Cache for improved precision, maximize context length, and even handle small-batch concurrency. However, note that the VRAM consumption of long context is perceived non-linearly—the KV Cache overhead for 4K context and 32K context can differ by more than 8 times. Always perform VRAM stress testing before running.
3.5 Unified Memory Devices (Integrated Graphics Platforms)
For architectures where memory and VRAM are shared (such as laptops and mini PCs with integrated GPUs), the selection logic is entirely different from discrete graphics: instead of looking at “VRAM,” look at the total unified memory and memory bandwidth. A general rule of thumb is that 60%~70% of unified memory can be safely allocated to the model, leaving the rest for the system and runtime. For example, a 16GB unified memory device is suitable for 4B models, while 32GB and above can smoothly run quantized versions of 26B MoE models—and because MoE active parameters are small, they actually perform better than same-scale dense models on bandwidth-limited unified memory platforms.
4. Practical Techniques to Reduce VRAM Usage
If your hardware is slightly below the model’s requirements, here are some techniques ranked by cost-effectiveness:
- Lower Quantization Precision: Dropping from 8-bit to 4-bit usually saves more than half of the weight VRAM, with acceptable quality loss on most tasks. Going below 4-bit (e.g., 3-bit, 2-bit) shows noticeable quality degradation and requires careful evaluation.
- Shorten Context and Limit Batch Size: KV Cache is linearly related to both, making it the most direct “VRAM knob.”
- KV Cache Quantization: Mainstream inference frameworks generally support compressing KV Cache to 8-bit or even 4-bit, offering significant benefits in long-context scenarios.
- Weight Offloading: Keeping some layers in system memory and the rest in VRAM, as a fallback plan. It causes large speed losses but ensures the model “can run.”
- Choose MoE Variants: On machines with sufficient bandwidth but tight VRAM, MoE models are often the best compromise between quality and speed.
5. Selection Decision Workflow Summary
Consolidating the above content into an actionable decision path:
1. Verify available VRAM/unified memory → Reserve 20%~30% headroom to get "usable budget"2. Estimate target model weight usage at 4-bit → Weights ≤ budget × 70%3. Check KV Cache requirements → Target context length × model KV coefficient4. Test deployment pipeline with a small model → Then gradually scale up5. Stress test before going live: Record peak VRAM, generation speed, OOM threshold
Conclusion: There is no “one-size-fits-all” answer to VRAM configuration, but there are clear calculation logic and empirical ranges. The core principle is: quantized weight usage is only the starting point, and KV Cache and runtime overhead determine the real resource requirements. Always rely on actual measured speed rather than nominal configurations, and always reserve sufficient headroom for long-context scenarios. With this methodology, no matter how new models iterate in the future, you can estimate within minutes whether it can run on your machine and how to run it, just by looking at the parameter size and architecture information.
