Guide to VRAM Configuration for Local Open-Source LLM Deployment: Choosing Models from 2B to 31B
Deploying open-source Large Language Models (LLMs) locally requires careful VRAM estimation, which goes beyond official theoretical numbers. This guide explains the actual factors determining VRAM consumption, including quantized weights, KV Cache, and runtime overhead. It provides a comparison of VRAM requirements for models ranging from 2B to 31B parameters, hardware selection recommendations across different GPU tiers (including Mac unified memory), and practical tips for optimizing your local deployment. By balancing parameter size, quantization precision, and context length, developers can make informed decisions for their local LLM setups.
Why VRAM Estimation Shouldn’t Rely Solely on Official Numbers
When deploying open-source LLMs locally, a common question developers face is: “How much VRAM does this model actually need?” Official documentation typically provides theoretical values based on original BF16 weights. For instance, a 31B parameter model requires about 62GB of VRAM just for the weights in BF16 precision. However, for users running quantized versions (like 4-bit or 8-bit) for local inference, these theoretical values offer limited practical reference.
Actual VRAM usage is determined by several components working together:
- Quantized Model Weights: This is the largest portion. For example, in a common 4-bit quantization, the weight footprint is roughly half the number of parameters in bytes, multiplied by a 1.1~1.2 metadata coefficient.
- KV Cache: Proportional to context length and batch size; long-context scenarios can consume several extra GBs or more.
- Inference Framework Runtime Overhead: Computational graphs, temporary buffers, CUDA context, etc., typically requiring 1~2GB.
- System and Display Output: If the GPU also handles display output, several hundred MBs of base memory will be consumed.
A rough estimation formula for reference:
VRAM Usage (GB) ≈ Parameters (B) × Bytes per Parameter × 1.2 + KV Cache + 1~2GB Overhead
VRAM Comparison Across Different Model Sizes
Below is a summary of actual VRAM usage ranges for mainstream small to medium-sized models under typical quantization schemes, based on community practice for quick reference during hardware selection:
| Model Size | Quantized VRAM Usage | Recommended Hardware Tier | Suitable Scenarios |
|---|---|---|---|
| 2B | Approx. 2~4GB | Lightweight devices with 4GB memory | Verifying minimal runnable pipeline |
| 4B | Approx. 4~6GB | 6GB GPUs or 16GB unified memory devices | First-round local experience for most users |
| 26B (MoE sparse activation) | Approx. 12~16GB | 16GB tier for smoother experience | Strong local reasoning without maxing out hardware |
| 31B | Approx. 20~24GB | 24GB and above | Demands high quality, coding capability, or long context |
Note: The ranges in the table correspond to typical intervals for different quantization precisions (4-bit to 8-bit). Actual values vary based on the quantization scheme and inference framework, so real-world testing is recommended.
Hardware Selection by GPU Tier
1. 6GB Tier GPUs
For this tier, it is recommended to start with quantized 4B models. While 26B or 31B models might be attempted (e.g., via CPU offload with layer distribution), using them as a default starting point can easily trigger VRAM overflow during loading or long conversations, which is not worth the trade-off.
2. 8GB~12GB GPUs
4B models can run smoothly and stably, and this tier meets the threshold for evaluating larger quantized models. The key consideration here is context length: running under default settings doesn’t guarantee safety when stretching the context from 4K to 32K. Avoid configuring parameters at the absolute VRAM limit; reserve a 15%~20% margin.
3. 12GB~16GB GPUs
26B sparse activation models enter a range where they can be seriously tested. However, “can boot” is different from “stable to use.” It is recommended to closely monitor the following metrics:
- Time To First Token (TTFT);
- Steady-state generation speed (tokens/s);
- Memory growth over long, multi-turn conversations.
4. 24GB and Above GPUs
31B models can be fully loaded in this tier while maintaining good generation speeds. However, even on high-end GPUs, the VRAM usage table is just a reference, not a guarantee—long context lengths, batched requests, and parallel loading of multiple models will significantly increase actual usage.
Mac Users: Focus on Unified Memory Instead of VRAM
Apple Silicon devices do not have dedicated VRAM; the GPU and CPU share unified memory. Therefore, the evaluation metrics shift to unified memory capacity and memory bandwidth:
| Chip / Unified Memory | Recommended Model Size | Notes |
|---|---|---|
| 16GB | Start with 4B, 26B struggles but can run | Sufficient for daily chat; large models are bottlenecked by bandwidth |
| 32GB | 4B smooth, 26B worth trying | Noticeable improvement over 16GB |
| 64GB | Both 26B and 31B can run | For users wanting quality without a dedicated GPU |
| 18GB (Base M-series chips) | 4B preferred | Evaluate 26B based on specific workloads; watch system usage |
When deploying on Mac, also note the system’s limit on the GPU’s accessible memory ratio (some models default to allowing the GPU to use only about 65%~75% of unified memory, requiring manual adjustment of the recommended value) and the maturity differences in Metal backend inference frameworks.
Common Practical Recommendations
- Prioritize Quantization Precision Over Model Size: Given the same VRAM, running a smaller model with higher quantization precision (e.g., 8-bit) is often better than running a larger model with a highly compressed quantization version.
- Use Monitoring Tools for Real Testing: Monitor actual peak VRAM usage during deployment rather than relying solely on estimations.
- Control Context Length: KV Cache is a widely underestimated source of VRAM consumption, especially in long-document Q&A scenarios.
- Reserve Expansion Space: If you plan to load LoRA adapters or switch between multiple models in the future, reserve an additional 2~4GB when selecting hardware.
Conclusion
Choosing VRAM for local LLM deployment is fundamentally a balance of “Parameter Size × Quantization Precision × Context Length × Hardware Margin.” 2B/4B models are suitable for validation and lightweight scenarios, 26B sparse activation models offer great value for the 16GB tier, and 31B models require 24GB+ hardware. Rather than blindly trusting official theoretical values, base your decisions on actual inference speed and peak VRAM usage, and complete a real-world load test on your hardware before making a final choice.
