Local Deployment of Open-Source LLMs: A Practical VRAM Sizing Guide by Model Size
Learn how much VRAM open-source large language models actually require after quantization, from 2B to 31B parameters. This guide breaks down the components of VRAM usage, matches model sizes to discrete GPU and unified memory configurations, and shares best practices for stable local inference.
As open-source large language models (LLMs) evolve rapidly, more developers and enterprises are choosing to run inference locally or in private environments. In practice, however, deployments often hit an awkward problem: the official documentation quotes theoretical weight memory in BF16 or FP16, and configurations that look feasible on paper end up exhausting VRAM at runtime. This article avoids vendor- and model-specific details and instead explains the underlying logic: how much VRAM quantized models actually need across different parameter scales (2B to 31B), and how to size hardware accordingly.
1. What Actually Consumes VRAM, and How Quantization Helps
When estimating VRAM requirements, it’s important to recognize that model weights are only part of the picture. A full inference workload typically consumes VRAM in three ways:
- Model weights: The most basic component. At half precision (BF16/FP16), each parameter takes roughly 2 bytes. A 30B-parameter model, for example, needs about 60GB just for weights. This is why local deployments usually rely on quantization (INT4, INT8) to shrink weights to one-quarter or even one-eighth of their original size.
- KV cache: During autoregressive generation, the model caches the key-value pairs of all preceding tokens. This usage grows linearly with context length. In long-context scenarios, the KV cache can easily exceed the weight memory itself.
- Runtime overhead: This includes the inference framework’s baseline footprint, the CUDA context, memory fragmentation, and activation memory. Expect a fixed overhead ranging from a few hundred MB to around 1GB.
Simply equating “quantized weight size” with “required VRAM” is therefore highly unreliable. When planning hardware, leave at least a 20% safety margin to cover context computation and runtime overhead.
2. VRAM Requirements by Model Size
To make this more concrete, we can group mainstream open-source model sizes into four tiers and estimate VRAM needs based on a typical INT4/INT8 mixed quantization strategy:
- 2B-class models: As entry-level lightweight models, quantized weights take only about 1.5–2GB. With runtime overhead and short contexts, total usage stays within 2–4GB. These models are mainly useful for validating the deployment pipeline or running on severely resource-constrained edge devices.
- 4B-class models: Quantized weights occupy roughly 3–4GB, and with framework overhead plus medium-length contexts, actual usage lands at 4–6GB. This tier is the go-to starting point for most developers experimenting locally or doing lightweight text processing.
- 26B-class models (including architectures with activated parameters): These models typically use sparsified or mixture-of-experts designs—the total parameter count is large, but fewer parameters are activated per inference pass. Overall VRAM usage after quantization falls between 12–16GB. They offer noticeably stronger logical reasoning and code generation locally, making them a sweet spot between performance and resource demands.
- 31B-class models: As representative high-quality, heavily parameterized models, quantized weights still require about 16GB. With long contexts and runtime overhead, total VRAM needs reach 20–24GB. These suit advanced scenarios that demand high generation quality, precise code completion, and strong long-text handling.
3. Matching Model Size to Discrete GPU Tiers
Deployment strategy should match your GPU tier—don’t push your hardware past its limits:
- 4–6GB VRAM: Entry-level cards. Stick to 2B or 4B models. While extreme quantization may let you load larger models, growing contexts easily trigger out-of-memory (OOM) errors, and inference becomes so slow it loses practical value.
- 8–12GB VRAM: The current mainstream mid-range. 4B models run smoothly here with support for fairly long context windows. If you want to try models above 10B, strictly control the quantization level and context length; otherwise, VRAM pressure forces constant swapping between GPU memory and system RAM, causing severe inference stutter.
- 12–16GB VRAM: This tier enters the “comfort zone” of 26B-class models, and it’s worth seriously trying mid-size models with activated parameters. Keep in mind that “it launches” doesn’t mean “it runs stably”—monitor token generation speed during inference to make sure no silent memory overflow is occurring.
- 24GB and above: The ceiling of consumer-grade compute. 31B-class models perform best in this environment. Even so, with very long contexts (e.g., 32K or more), watch out for VRAM spikes from the KV cache. If local hardware still can’t support larger models, developers can also consider moving inference to cloud-native environments, which offer elastic GPU capacity and containerized deployment for on-demand scaling.
4. Deployment Considerations for Unified Memory Platforms
On platforms with a unified memory architecture (such as certain mainstream desktop-class ARM chips), VRAM planning works differently than with discrete GPUs. These platforms don’t separate dedicated VRAM from system memory—everything shares one large memory pool.
- 16GB unified memory: Start with 4B-class models. The capacity allows you to attempt loading a 26B model, but since unified memory bandwidth is typically far below a discrete GPU’s GDDR6/6X VRAM, large-model inference will be severely bottlenecked and the experience poor.
- 32GB unified memory: 4B models run smoothly with plenty of headroom to try 26B-class models. Compared with the 16GB tier, the capacity bottleneck is gone, and the wider memory bandwidth delivers a clear improvement in generation speed.
- 64GB or more unified memory: This configuration can accommodate quantized 26B and 31B models. For users who don’t want to invest in an expensive discrete GPU but still care about output quality, it’s an excellent middle ground.
5. Summary and Best Practices
When planning local LLM deployment, hardware is only the foundation—sound engineering optimization is what matters. Follow the “small first, large second; short first, long second” debugging principle: first use a small model to validate the inference framework and dependencies, then swap in larger models and tune the quantization strategy, and finally extend the context window based on remaining VRAM. Also consider adding VRAM monitoring and dynamic offloading to your deployment scripts to prevent system-level hangs. Only by combining theoretical VRAM calculations, real hardware bandwidth, and practical tuning can you build an efficient, stable local AI inference service.
