VRAM Planning Guide for Local LLMs: Parameter Size and Quantization Choices
How much VRAM does a local LLM really need? This guide breaks down the four components of memory usage—model weights, KV cache, temporary buffers, and runtime overhead—explains how to choose between FP16, 8-bit, and 4-bit quantization, and provides reference tiers for ~2B, ~4B, ~26B sparse-activation, and ~31B parameter models across discrete GPUs and unified-memory devices, plus a practical estimation formula and deployment checklist.
1. Build a Correct VRAM Budget Model First
When asking “how much VRAM does this model need,” the most common mistake is counting only the weight size. In real deployments, memory consumption comes from at least four parts: model weights, the KV cache, runtime temporary buffers, and fragmentation plus system overhead. Weights are just the starting point. Context length, batch size, quantization method, and the inference framework’s scheduling strategy all significantly change the final footprint.
A simplified budget model looks like this:
Total VRAM ≈ weight memory+ KV cache+ activations and temporary buffers+ runtime overhead+ fragmentation and safety margin
Weight memory can be estimated as “parameter count × bytes per parameter.” For example, at 4-bit quantization each parameter takes roughly 0.5 bytes, but you must also account for scaling factors, alignment, and runtime overhead, so the theoretical figure should not be treated as the actual figure. The KV cache depends on layer count, hidden dimension, context length, batch size, and cache precision. In long-context scenarios it can become the dominant increment.
So when sizing hardware, separate “can the model load” from “can the service run stably.” Successful startup only means the weights and some buffers fit; stable operation additionally requires that long contexts, concurrent requests, and temporary allocations do not trigger out-of-memory errors.
2. Lower Quantization Is Not Always Better
Common quantization levels for local deployment include FP16, 8-bit, and 4-bit. FP16 offers higher precision but large memory usage; 8-bit strikes a reasonable balance between quality and size; 4-bit significantly reduces weight footprint and suits memory-constrained devices, but may lose accuracy—especially for code, math, and long-document understanding tasks.
Note that quantization gains come mainly from the weights. The KV cache and temporary buffers do not necessarily shrink in step. If you quantize only the weights without controlling context length, a long context can still exhaust memory. Some runtimes support KV cache quantization, but that introduces additional precision and compatibility trade-offs and should not be enabled by default.
A practical order is “stability first, savings second”: verify the model runs with a short context and a single concurrent request, then gradually increase context length and batch size. If you hit out-of-memory, first reduce context, batch size, or concurrency before considering lower-bit quantization. Do not start by stress-testing with extreme quantization plus extreme context—otherwise it becomes hard to tell whether the bottleneck is weights, cache, or runtime overhead.
3. Four Reference Tiers by Parameter Scale
For engineering selection, local models can be roughly grouped into four tiers by parameter scale and architecture. The table below is an order-of-magnitude reference, not an absolute guarantee; different quantization, context lengths, and runtime implementations will produce noticeable differences.
| Model Tier | Post-Quantization Weight Footprint | Recommended Hardware | Suitable Scenarios |
|---|---|---|---|
| ~2B parameters | ~2–4GB | Lightweight devices under 4GB | Validating the minimal runnable path, lightweight Q&A |
| ~4B parameters | ~4–6GB | 6GB discrete GPU or 16GB unified memory as a starting point | The first local experience for most users |
| ~26B sparse-activation | ~12–16GB | 16GB tier is more comfortable | Stronger reasoning without going to the heaviest models |
| ~31B parameters | ~20–24GB | 24GB and above | Higher demands on quality, code, and long context |
One point deserves emphasis about sparse-activation architectures: memory loading is generally still determined by total parameter count, while compute may scale only with activated parameters. In other words, a sparse-activation model may “compute faster,” but it will not consume memory according to its activated parameter count. Always look at total parameters and weight size when selecting—do not be misled by a small “activated parameter” figure.
4. Choosing by Hardware Tier
Under 4GB lightweight devices: prefer ~2B parameter models. The goal is to verify that the runtime chain—quantized loading, input/output, and log monitoring—works end to end. Do not expect long context or high concurrency; focus on closing the minimal loop.
Around 6GB discrete GPUs: start with ~4B parameter models. This tier covers daily conversation, summarization, and simple code assistance, but context should not be too long. Larger models are not absolutely off-limits, but starting big by default tends to trigger out-of-memory errors and raises debugging costs.
8–12GB discrete GPUs: ~4B models will run more comfortably, and you can evaluate lower-bit quantized versions of larger models. Pay special attention to context length and runtime overhead, and do not size right at the VRAM ceiling. Reserve at least a 15%–20% safety margin for temporary buffers and fragmentation.
12–16GB discrete GPUs: ~26B sparse-activation models enter the seriously-tryable range. Being able to load does not mean running stably; watch actual inference latency, time to first token, memory curves under long context, and concurrency behavior rather than relying on nominal specs.
24GB+ discrete GPUs: ~31B models become worthwhile, suited to scenarios with higher demands on quality, code, and long context. But memory tables are always references—long context still significantly increases KV cache usage, and multi-concurrency adds batch size and scheduling overhead.
5. Choosing for Unified-Memory Devices
Unified-memory laptops and compact workstations are evaluated by total unified memory and memory bandwidth rather than discrete VRAM. The advantage is large capacity and flexible model loading; the disadvantage is that the system, applications, and the model share the same pool, so actual available capacity is lower than the nominal figure.
16GB unified memory: start with ~4B parameter models. ~26B models may barely run but slowly. Daily conversation is fine; larger models are mainly limited by memory bandwidth.
32GB unified memory: ~4B models run more smoothly, and ~26B sparse-activation models can be attempted. The experience improvement over the 16GB tier is usually noticeable, but context and concurrency still need control.
64GB unified memory: both ~26B and ~31B models become runnable, suitable for users who want quality without a discrete GPU. At this point, focus on memory bandwidth and thermals rather than capacity alone.
128GB unified memory: ~31B models run with little pressure and multi-concurrency is more stable, fitting small workstations and lightweight serving scenarios. Still reserve headroom for the system and monitor memory growth under long context.
6. Context Length and Concurrency Are Hidden Variables
Many “specs look sufficient but it won’t run stably” problems trace back to context and concurrency. The KV cache can be roughly estimated as:
KV cache ≈ 2 × layers × hidden dimension × context length × batch size × bytes per element
Increasing context from 4K to 32K can multiply the KV cache several times over; raising batch size from 1 to 4 also stacks usage. Therefore, use “short context, single concurrency” as the baseline and increase pressure gradually. If long context is a hard requirement, prefer a tier with more memory headroom, or enable general optimizations such as cache quantization and paged memory management.
7. Engineering Deployment Checklist
First, run the minimal loop: short context, single concurrency, fixed input, and confirm that loading, inference, output, and logging all work. Second, set up memory and latency monitoring to observe peak usage, time to first token, throughput, and error rates. Third, define degradation strategies: on out-of-memory, automatically shorten context, reduce batch size, or fall back to a smaller model. Fourth, store model weights and logs separately to avoid disk I/O affecting inference stability.
For cloud deployment, you can pair the workload with general-purpose container platforms, object storage, log services, and monitoring/alerting offerings from providers such as Baidu AI Cloud; refer to the actual product documentation for specifications and interfaces. This article makes no commitments regarding specific APIs, pricing, or performance.
8. Pseudocode Estimation Example
function estimateVram(paramsB, bytesPerParam, layers, hidden, ctx, batch, kvBytes) {weights = paramsB * 1e9 * bytesPerParam / 1024^3kv = 2 * layers * hidden * ctx * batch * kvBytes / 1024^3runtime = weights * 0.15 + 0.5return weights + kv + runtime}// Example: ~4B parameters, 4-bit quantization estimated at 0.5 bytes/param,// 32 layers, hidden dimension 4096, context 8192, batch size 1, 2 bytes per cache elementestimateVram(4, 0.5, 32, 4096, 8192, 1, 2)
This example only builds order-of-magnitude intuition. Actual values vary with model architecture, quantization implementation, runtime allocation strategy, and system usage. In practice, keep a safety margin and rely on real stress-test results.
9. Conclusion
The core of local LLM selection is not memorizing a fixed VRAM table, but understanding how weights, KV cache, temporary buffers, and runtime overhead interact. ~4B parameter models are a good first stop for most devices; ~26B sparse-activation models are worth serious attempts at around the 16GB tier; ~31B models fit 24GB+ discrete GPUs or large-capacity unified-memory devices. Validate with short context and single concurrency first, then increase pressure step by step—that is the path from “it starts” to “it runs stably.”
