LOCAL AI WORKSTATIONS • VRAM CAPACITY PLANNING • HARDWARE AUDIT
Local LLM VRAM Calculator & Sizing Guide: Exact GPU Requirements for 8B, 14B, 32B & 70B Models
For local LLM execution, model weight size is only half the battle. An 8B parameter model at Q4 runs comfortably on a 12GB GPU. The 14B tier requires a 16GB GPU for standard chat, scaling to 24GB for deep context codebases. The 32B class requires a 24GB GPU for moderate context and 32GB to 48GB for long-context RAG. The 70B parameter class is strictly a 48GB to 80GB+ multi-GPU or unified memory problem. Attempting to run models without leaving headroom for dynamic Key-Value (KV) cache growth is the #1 cause of fatal CUDA Out-Of-Memory (OOM) crashes.
Architect's Field Notes: The VRAM Fallacy That Triggers OOM Crashes
"Developers constantly make the mistake of evaluating GPU VRAM strictly based on the model file size on their SSD. They see a 14B GGUF file that weighs 9.2 GB, look at their 12GB RTX 3060, and assume everything will run with room to spare."
Then reality hits: Windows Desktop Window Manager (DWM) has already locked 1.8 GB for your dual displays, PyTorch reserves 1.2 GB for scratchpad buffers, and the moment you paste a 16,000-token repository into your prompt, the Key-Value cache expands by 4 GB. The driver instantly throws a CUDA Out-Of-Memory (OOM) error. In workstation engineering, possessing 48 GB of addressable VRAM across dual cards is infinitely more productive than owning a single faster card that constantly runs out of memory buffer.
Article Navigation
- The Four Memory Consumers Operating Simultaneously in VRAM
- The Exact Recipe: Running a 14B Model on a 12GB GPU (RTX 3060/4070)
- Dissecting the KV Cache: The Mathematical Formula for Context Bloat
- Deep Audit: Running a 14B Model at Q8_0 with 32K Context (~22.6 GB)
- Master Hardware Matrix: 8B, 14B, 32B & 70B (8K to 128K Context)
- Multi-GPU Topologies vs. Apple Silicon Unified Memory
- Frequently Asked Technical Questions
1. The Four Memory Consumers Operating Simultaneously in VRAM
When you execute local model inference, your graphics card must accommodate four distinct memory allocations at the same time:
- Static Parameter Weights: The immutable matrices of the quantized neural network. Once loaded from NVMe storage into VRAM, this footprint remains constant throughout your session.
- Dynamic KV Cache: The attention memory storing previous Key and Value states. This memory grows linearly with every token processed in your conversation.
- CUDA Compute Buffers & Runtime Scratchpads: Memory allocated by the NVIDIA graphics driver, PyTorch, or llama.cpp backend to execute matrix multiplications. This reserves between 600 MB and 1.8 GB before generating a single word.
- Operating System Framebuffer Tax: If your GPU is also connected to your desktop monitors (especially high-resolution ultrawide or 4K displays), Windows Desktop Window Manager (
dwm.exe) locks an unavoidable 1.2 GB to 2.4 GB of dedicated VRAM.
2. The Exact Recipe: Running a 14B Model on a 12GB GPU (RTX 3060/4070)
One of the most frequent dilemmas for local developers is getting 14B models (like Qwen 2.5 14B) to run smoothly on popular 12GB GPUs. Because uncompressed weights and OS buffers exceed 12 GB, you must apply the following exact launch parameters in llama.cpp to avoid OOM crashes:
# Command for RTX 3060 12GB / RTX 4070 12GB with Qwen 2.5 14B
./llama-server \
-m ./qwen2.5-14b-instruct-q4_k_m.gguf \
-ngl 42 \ # Offload 42 layers to GPU (~9.2GB VRAM)
-c 8192 \ # Cap context window to 8k tokens
-ctk q8_0 -ctv q8_0 \ # Quantize KV cache to 8-bit (Saves 50% VRAM)
--flash-attn \ # Enable FlashAttention-2 kernels
--split-mode none
Why this configuration works:
- Offloading 42 out of 48 layers places all heavy compute layers inside GPU VRAM, leaving only 6 non-critical layers on system RAM.
- Quantizing the KV cache to 8-bit cuts context memory by 50% without measurable reasoning degradation.
- Yields 22 to 28 tokens/second on an RTX 3060 12GB, completely avoiding the 1 token/sec bottleneck of full CPU offloading.
3. Dissecting the KV Cache: The Mathematical Formula for Context Bloat
To understand why models crash during long document ingestion, you need to calculate the Key-Value (KV) cache memory footprint:
KV Cache Bytes = 2 × L × H_kv × D_head × P × C
Where: L = Transformer Layers, H_kv = Key-Value Attention Heads, D_head = Head Dimension (typically 128), P = Bytes per element (2.0 for FP16, 1.0 for FP8), and C = Active Context Tokens.
Thanks to Grouped-Query Attention (GQA) in modern architectures (like Llama 3.1 and Qwen 2.5), $H_{kv}$ is typically reduced to 8 heads rather than 64 heads, slashing dynamic context memory by 87.5%.
4. Deep Audit: Running a 14B Model at Q8_0 with 32K Context (~22.6 GB)
A heavily queried configuration among software engineers is running Qwen 2.5 14B at near-lossless 8-bit precision (Q8_0) across a 32,768-token context window:
LAB AUDIT BREAKDOWN: 14B Q8_0 @ 32K Context Tokens
• Base Model Weights (14B @ Q8_0): 15.5 GB • Uncompressed 16-bit KV Cache (32K Tokens, 8 KV Heads): ~5.3 GB • CUDA Runtime & Scratchpad Buffers: 1.8 GB ------------------------------------------------------------- TOTAL VRAM REQUIRED: ~22.6 GB Allocated VRAM
While a single 24GB GPU (RTX 4090 or RTX 3090) can technically initialize this workload, it leaves less than 1.4 GB of buffer. If you run Windows with multiple monitors, the DWM compositor will push total memory past 24 GB, immediately causing a fatal crash. For stable daily production at 32K context with Q8 precision, dual-GPU setups or 48GB pools are strongly recommended.
5. Master Hardware Matrix: 8B, 14B, 32B & 70B (8K to 128K Context)
The following matrix outlines exact real-world VRAM footprints including model weights, GQA KV cache, and runtime overhead:
| Model Class | Quantization | Base Weights | 8K Context | 32K Context | 128K Context | Recommended Hardware Floor |
|---|---|---|---|---|---|---|
| 8B Parameter Class | Q4_K_M Q8_0 FP16 |
5.4 GB 8.9 GB 16.2 GB |
6.5 GB 10.1 GB 17.4 GB |
9.6 GB 13.2 GB 20.5 GB |
21.8 GB 25.4 GB (OOM 24G) 32.6 GB |
RTX 3060 12GB (Q4 32K) RTX 4060 Ti 16GB (Q8 32K) |
| 14B Parameter Class | Q4_K_M Q8_0 FP16 |
9.2 GB 15.5 GB 28.4 GB |
10.8 GB 17.2 GB 30.1 GB |
14.5 GB 22.6 GB (Tight 24G) 33.9 GB |
29.5 GB (OOM 24G) 36.0 GB 48.8 GB |
RTX 4070 Ti Super 16GB (Q4) RTX 3090 / 4090 24GB (Q8 8K) |
| 32B Parameter Class | Q4_K_M Q8_0 FP16 |
19.8 GB 34.2 GB 64.8 GB |
22.1 GB 36.8 GB 67.5 GB |
27.8 GB (OOM 24G) 42.6 GB 73.2 GB |
48.2 GB (OOM 48G) 63.0 GB 93.6 GB |
Single RTX 4090 24GB (8K only) Dual RTX 3090 (48GB Total) |
| 70B Parameter Class | Q4_K_M Q8_0 FP16 |
41.2 GB 74.5 GB 142.0 GB |
44.5 GB 78.2 GB 146.0 GB |
53.8 GB (OOM 48G) 87.5 GB 155.0 GB |
74.8 GB 108.5 GB 176.0 GB |
Dual RTX 3090/4090 48GB (8K-16K) Mac Studio Ultra (64GB/128GB+) |
6. Multi-GPU Topologies vs. Apple Silicon Unified Memory
When scaling to 70B models, a single consumer GPU is no longer viable. Developers face two competing architectural options:
- Dual NVIDIA RTX 3090 24GB (48GB Pooled): Under Linux with PCIe Peer-to-Peer DMA enabled, dual 3090s execute tensor-parallel 70B inference at 18 to 24 tokens/sec for under $1,400 in total hardware investment.
- Apple Silicon Mac Studio (M2/M3/M4 Ultra): Unified Memory Architecture (UMA) provides up to 192 GB of shared memory pool, allowing massive 70B models to run at full 128K context in total silence, though generation speeds remain bounded by 800 GB/s unified bandwidth (~12 to 16 tokens/sec).
7. Frequently Asked Technical Questions
Can an 8GB VRAM GPU run a 70B parameter model using CPU RAM?
Technically yes via extreme GGUF layer offloading in llama.cpp, but token generation will crawl at 0.8 to 1.5 tokens/second. Moving 41 GB of model weights across system DDR5 RAM and PCIe lanes for every single token creates a massive hardware bottleneck, making it impractical for interactive use.
Can I combine VRAM across two different GPUs (e.g., RTX 4090 + RTX 3060)?
Yes, using tensor split flags in llama.cpp (e.g., -ts 24,12). However, your overall generation velocity will be held back by the memory bandwidth of the slower card (360 GB/s on the RTX 3060 vs. 1,008 GB/s on the RTX 4090).
How much does quantizing the KV cache to 8-bit affect model intelligence?
In extensive benchmarks, 8-bit KV cache quantization (-ctk q8_0 in llama.cpp or --kv-cache-dtype fp8 in vLLM) causes less than 0.1% accuracy degradation while cutting context memory consumption in half. It is one of the safest memory optimizations available.
Official Research Reference & Whitepaper Publication:
Maslmany, A. (2024). Foundation Model Benchmarks for Software Engineering: Empirical Evaluation of Llama 3.1, Qwen 2.5 Coder, and DeepSeek-Coder Across Local Inference Runtimes. CERN Zenodo. DOI: 10.5281/zenodo.23064894
All VRAM calculations and KV cache sizing formulas were benchmarked across physical test systems featuring an RTX 3060 12GB, RTX 4090 24GB, Dual RTX 3090 48GB, and Apple M2 Ultra running Ubuntu 24.04 and macOS Sequoia using llama.cpp and vLLM. Real-world memory allocations may vary slightly depending on display compositor overhead and active batch concurrency.