A Complete Guide to VRAM Configuration for Local LLM Deployment
This guide provides a comprehensive overview of VRAM requirements for locally deploying large language models (LLMs). It breaks down why official hardware specs often differ from real-world usage, details the four main components of VRAM consumption, and offers practical recommendations across different hardware tiers, including unified memory architectures.
A Complete Guide to VRAM Configuration for Local LLM Deployment
1. Why Official VRAM Data is “For Reference Only”
Many developers start local LLM deployment by checking official documentation for hardware requirements, only to quickly find themselves confused: the VRAM requirements listed in the docs do not match their actual runtime usage.
The reason is that official numbers typically reflect theoretical values for original weights in BF16/FP16 precision—meaning the space required to fully load model parameters as 16-bit floating-point numbers. A 31B parameter model, for instance, requires about 62GB of VRAM for weights alone, a figure practically meaningless for most local users.
In real local deployments, almost everyone uses Quantized versions. By compressing weights from 16-bit to 8-bit, 4-bit, or lower, VRAM usage drops significantly. After 4-bit quantization, the weights of a 31B model need only about 17~19GB. However, quantization is only half the story. Context caching, activations, and runtime framework overhead will silently consume the remaining space the moment you hit enter.
This guide uses three representative model tiers—lightweight (~4B parameters), mid-range (~26B parameters, Mixture of Experts architecture with ~4B active parameters), and large-scale (~31B parameters)—to outline VRAM patterns in practical deployments and help you make decisions based on your hardware.
2. The Quick Reference Table
| Model Tier | Quantized VRAM Usage | Recommended Hardware Tier | Target Audience |
|---|---|---|---|
| Lightweight (~2B) | ~2-4GB | Lightweight environments under 4GB | Users verifying the minimum runnable path |
| Lightweight (~4B) | ~4-6GB | Starting from 6GB GPUs or 16GB unified memory | Most users’ first local experience |
| Mid-range (26B MoE, ~4B active) | ~12-16GB | 16GB tier is more comfortable | Users wanting stronger reasoning without the heaviest models |
| Large-scale (~31B dense model) | ~20-24GB | 24GB and above | Users prioritizing output quality, coding ability, and long context |
It is important to emphasize that this table is a starting point, not a guarantee. Actual usage will fluctuate based on context length, batch size, and differences in inference framework implementation.
3. Where Does VRAM Go? Breaking Down the Four Components
To make reliable capacity plans, you must understand the complete composition of VRAM consumption:
1. Model Weights
This is the largest and most predictable component. The estimation formula is simple:
Weight size ≈ Parameter count × Bytes per parameter- BF16/FP16: 2 bytes/parameter- 8-bit quantization: ~1 byte/parameter- 4-bit quantization: ~0.5 bytes/parameter (slightly higher with quantization metadata)
For example, a 31B model with 4-bit quantization: 31 × 0.5 ≈ 15.5GB. Including metadata like quantization scaling factors, the actual size is around 17GB.
2. KV Cache (Key-Value Cache)
This is the easily overlooked “hidden killer.” During inference, the attention mechanism of each layer needs to cache historical tokens’ Keys and Values. Its size is proportional to context length × layers × hidden dimensions × 2 (K and V). A 31B model at 32K context might use an extra 4~8GB. This is why “able to load the model” and “able to stably run long context” are two completely different things.
3. Activations & Scratch Buffers
Intermediate tensors during the forward calculation process, usually related to batch size. In local single-request scenarios, this generally falls between a few hundred MB and 2GB.
4. Runtime Overhead
The inference framework’s own VRAM management, compute graph buffers, driver reserves, etc., usually occupying another 1~2GB.
A reliable rule of thumb is: Planned capacity = Quantized weight size × 1.3 + KV Cache estimate + 2GB runtime margin.
4. How to Choose by VRAM Tier
Around 6GB Tier
Start honestly with a lightweight ~4B model. The reality of this tier is that after weights consume 3~4GB, little space is left for KV Cache and runtime. Models above 26B are not completely impossible to try (they can be barely loaded via partial offloading to system RAM), but speeds will drop to levels with no practical value, and out-of-memory errors are highly likely. Your default starting point should be a lightweight model. Run it first, then talk about upgrades.
8GB to 12GB Tier
Lightweight models run smoothly, and you can begin evaluating aggressively quantized versions of mid-range models (e.g., 3-bit or lower). However, please note two traps: first, the more aggressive the quantization, the more obvious the output quality loss, especially in coding and math tasks; second, do not max out your configuration—successful startup does not mean stable completion of an 8K context inference. It is recommended to reserve at least a 20% VRAM margin.
12GB to 16GB Tier
26B-level Mixture of Experts (MoE) models enter the serious testing range. The advantage of these models lies in their architecture: although the total parameter count is large, only about 4B parameters are activated per forward pass, offering inference speeds close to small models and knowledge capacity close to large models. Running the 4-bit quantized version on a 16GB GPU: weights take about 13GB, leaving decent space for context. When evaluating, please focus on actual inference speed (token/s) rather than nominal parameters. Speeds below 10 tokens per second are often unacceptable.
24GB and Above Tier
31B-level dense models are worth trying, offering perceivable improvements in output quality, code generation, and long document understanding compared to mid-range models. But even at this tier, long context significantly increases usage—a 32K context might push total consumption close to or over 24GB. If your main scenario is long document analysis, it is recommended to quantize the KV Cache as well (mainstream inference runtimes generally support 8-bit cache quantization) or actively manage context length.
5. Special Considerations for Unified Memory Architecture Devices
Devices using unified memory (where CPU and GPU share the same physical RAM) have different selection logic from discrete GPUs: there is no distinction between “VRAM” and “RAM”, but the OS and other applications also occupy this memory, and inference performance is primarily limited by memory bandwidth rather than compute power.
| Unified Memory Capacity | Recommended Model Tier | Remarks |
|---|---|---|
| 16GB | Start with ~4B lightweight; 26B barely loads but very slow | Enough for daily chat; large models hit bandwidth bottlenecks obviously |
| 32GB | Lightweight smooth; 26B mid-range can be tried | Significant improvement over 16GB |
| 64GB | 26B and 31B both runnable | Suitable for quality-conscious users without discrete GPUs |
| 18GB tier | Prioritize lightweight; mid-range depends on quantization | Need to close large apps to free memory |
Rule of thumb: On unified memory devices, the memory available for model inference is about 60%~70% of the total. Be sure to apply a sufficient discount when planning.
6. Five Practical Tips
- Start Small, Go Big: First run the full pipeline with a lightweight model (loading, inference, context management), then upgrade step-by-step. This saves time compared to aiming for the top immediately.
- Start Quantization at 4-bit: This is the best balance of quality and size. Upgrade to 8-bit if quality is lacking; drop to 3-bit if space is insufficient.
- Explicitly Limit Context Length: Most runtimes allow setting a maximum context. Keeping it within actual needs directly saves several GB of KV Cache.
- Test Instead of Estimate: After loading the model, use system monitoring tools to observe actual usage. Record “idle usage” and “max context usage” as a basis for future scaling.
- Leave Margin for Concurrency: In multi-session or service-oriented deployments on a single machine, KV Cache grows linearly with concurrency. Capacity planning should be calculated based on peak concurrency.
7. Summary
Planning VRAM for local LLM deployment is essentially balancing four variables: model capability, quantization quality, context length, and hardware budget. Lightweight models are the starting point for path verification, 26B-level MoE models are the cost-effective sweet spot, and 31B-level dense models are the current ceiling for local quality—provided you have 24GB+ VRAM and a clear understanding of long-context overhead.
For teams with limited VRAM but wanting stronger model capabilities, consider migrating heavy inference loads to the cloud. Leveraging GPU compute and model services from mainstream cloud platforms like Baidu AI Cloud allows on-demand access to large parameter models while keeping lightweight inference local. This forms a “local light-load + cloud heavy-load” hybrid architecture, balancing cost and capability.
