
Technical architecture diagram comparing discrete GPU VRAM high-bandwidth data bus against Apple Silicon Unified Memory and system DDR5 RAM bottleneck
Choosing a local large language model that fits cleanly inside an 8GB, 12GB, or 16GB VRAM budget is the difference between responsive 45+ tokens-per-second generation and a single-layer PCIe spillover that drops throughput by 80%. While our Running Local LLMs on Consumer Hardware pillar covers the underlying memory formulas, this hands-on benchmark reference maps the exact models, quantization levels, and Ollama / llama.cpp launch flags for every mainstream consumer GPU tier in 2026.
Interactive Local LLM Hardware Tier & Ollama Configurator
Select your GPU VRAM (or Apple Silicon Unified Memory), primary workload, and target context length to generate the optimal model, GGUF quantization, and KV-cache launch command.
OLLAMA_FLASH_ATTENTION=1 OLLAMA_KV_CACHE_TYPE=q8_0 ollama run qwen2.5-coder:14b-instruct-q4_K_M
Why PCIe Spillover Destroys Local LLM Speed: VRAM vs. System RAM Bandwidth
A common question when configuring local models is: “Can a local LLM use system RAM if it exceeds my GPU VRAM?” While inference engines like llama.cpp and Ollama automatically offload overflow transformer layers to CPU system memory rather than crashing with an Out-Of-Memory (OOM) error, token generation is strictly memory-bandwidth bound. Every generated token requires reading every active model weight once:
Batch Size = 1 (Memory-Bandwidth Bound)
A mid-range desktop GPU with 360–504 GB/s of GDDR6X bandwidth reads a 9 GB 14B model 40–55 times per second. The moment 3 GB of weights spill over PCIe 4.0 into dual-channel DDR5 system RAM (~65–75 GB/s effective bandwidth), the CPU must compute those spilled layers at one-seventh the speed while waiting on GPU-to-host synchronization, dropping overall output from 45 tok/s down to 6–9 tok/s. Keeping 100% of weights and KV-cache inside physical VRAM is always faster than running a slightly larger parameter count partially in system RAM.
Tested 2026 Model Matrix Across 8GB, 12GB, 16GB, and 24GB VRAM
| GPU VRAM Tier | Top Coding & Agent Model | Top Reasoning / Math Model | Optimal GGUF Quant | Max Safe Context (100% GPU) |
|---|---|---|---|---|
| 8 GB VRAM (RTX 4060, RX 7600, M2 8GB) | Qwen2.5-Coder-7B-Instruct | DeepSeek-R1-Distill-Qwen-7B | Q4_K_M (4.7 GB) or Q5_K_M (5.4 GB) | 16,384 tokens (with q8_0 KV cache) |
| 12 GB VRAM (RTX 3060 12GB, RTX 4070 / Super) | Qwen2.5-Coder-14B-Instruct | DeepSeek-R1-Distill-Qwen-14B | Q4_K_M (8.9 GB) | 16,384 tokens (with q8_0 KV cache) |
| 16 GB VRAM (RTX 4060 Ti 16GB, RTX 4080, M4 16GB) | Qwen2.5-Coder-14B-Instruct (or Mistral-Small-24B) | DeepSeek-R1-Distill-Qwen-14B | Q5_K_M (10.5 GB) or Q6_K (12.1 GB) | 32,768 tokens (with q8_0 KV cache) |
| 24 GB VRAM (RTX 3090, RTX 4090, RX 7900 XTX) | Qwen2.5-Coder-32B-Instruct | DeepSeek-R1-Distill-Qwen-32B | Q4_K_M (19.5 GB) | 16,384 – 24,576 tokens (with q8_0/q4_0 KV) |
Enabling Flash Attention and Quantized KV-Cache in Ollama & llama.cpp
By default, many local inference servers allocate the key-value (KV) context cache in 16-bit floating point (FP16). On a 14B model at a 32,768-token context length, an uncompressed FP16 KV-cache consumes over 6.2 GB of extra VRAM—forcing layer offloading on a 16GB GPU. Enabling Flash Attention and 8-bit KV-cache quantization (q8_0) cuts KV memory in half with virtually zero measurable perplexity loss:
# Linux / macOS systemd or shell environment for Ollama
export OLLAMA_FLASH_ATTENTION=1
export OLLAMA_KV_CACHE_TYPE="q8_0"
export OLLAMA_HOST="127.0.0.1:11434"
# Equivalent direct llama.cpp server invocation with 100% GPU offload (-ngl 99)
./llama-server -m Qwen2.5-Coder-14B-Instruct-Q4_K_M.gguf
-ngl 99 -c 16384 -fa --cache-type-k q8_0 --cache-type-v q8_0
--host 127.0.0.1 --port 8080For architectural details on how DeepSeek R1 compresses KV-cache natively using Multi-Head Latent Attention (MLA), see our DeepSeek R1 Architecture & Deployment Guide, or calculate exact custom parameter footprints in our 2026 Local LLM VRAM Calculator.
The Physics of Local Inference: Why Bandwidth Beats Capacity
Every consumer GPU tier decision in 2026 reduces to two independent constraints that are almost always confused: capacity (how many bytes fit in VRAM) and bandwidth (how fast you can move those bytes per second). Token generation for large language models is dominated by weight streaming — at every decode step, essentially the entire quantized model must be read once from memory into the compute cores. Because arithmetic intensity per token is low compared to prefill, decode throughput collapses toward a simple bound:
# First-principles decode ceiling (batch size 1):
tokens_per_second ≈ effective_memory_bandwidth_GBps / bytes_read_per_token
# Example: a 7B model at Q4_K_M (~4.37 GB weights)
# on a bus delivering ~272 GB/s realistic sustained read:
272 / 4.37 ≈ 62 tok/s theoretical ceiling
# Measured llama.cpp/Ollama output typically lands at
# 55–70% of this ceiling after kernel overheads, so expect ~38–45 tok/s.| GPU | VRAM | Peak Bus BW (GB/s) | Realistic Sustained Read (GB/s)* | Practical Decode Ceiling @ Q4 7B (tok/s) |
|---|---|---|---|---|
| Radeon RX 7600 | 8 GB GDDR6 | 288 | ~230–250 | ~40–48 (Vulkan/ROCm) |
| GeForce RTX 4060 | 8 GB GDDR6 | 272 | ~220–245 | ~38–45 (CUDA/TensorRT-LLM) |
| GeForce RTX 3060 12GB | 12 GB GDDR6 | 360 | ~300–330 | ~50–60 |
| GeForce RTX 4070 | 12 GB GDDR6X | 504 | ~420–470 | ~75–90 |
| RTX 4060 Ti 16GB | 16 GB GDDR6 | 288 | ~230–250 | ~38–45 (fits larger models, slower) |
| RTX 4070 Ti Super | 16 GB GDDR6X | 672 | ~560–620 | ~105–125 |
| GeForce RTX 3090 / 4090 | 24 GB GDDR6X | 936 / 1008 | ~780–870 | ~150–170 |
| Apple M-series Max (unified) | 36–128 GB LPDDR5 | 400–800 | ~75–85% of peak via Metal | Scales with chip tier; huge capacity win |
*Sustained figures assume llama.cpp `mmq`/flash-attention decode kernels at batch size 1 on a clean PCIe topology with no concurrent display load. The headline takeaway: the RTX 4060 Ti 16GB and RTX 4070 Ti Super hold identical parameter-count ceilings per generation of quantization, but the Ti Super generates roughly 2.4× faster. Capacity buys you eligibility for a model class; bandwidth buys you usability.
The VRAM Ledger: Weights + KV Cache + Overhead
A model "fits" only when all three allocations coexist in VRAM simultaneously:
# Total VRAM demand per active request
VRAM_total ≈ weights_GB + kv_cache_bytes + activations/context_buffers + ~600 MB runtime overhead
# Weights size from bit-width (approximate GGUF effective bits per weight):
Q4_K_M ≈ 4.83 bpw → 7B ≈ 4.4 GB, 14B ≈ 8.9 GB, 32B ≈ 19.5 GB
Q5_K_M ≈ 5.69 bpw → 7B ≈ 5.1 GB, 14B ≈ 10.4 GB
Q6_K ≈ 6.59 bpw → 7B ≈ 6.0 GB, 14B ≈ 12.1 GB
IQ4_XS ≈ 4.25 bpw → 14B ≈ 7.8 GB (importance-matrix trimmed)On an 8 GB card with roughly 7.2–7.4 GB usable after the display and CUDA/Vulkan context, a Q4_K_M 7B (~4.4 GB) leaves under 3 GB for KV cache and buffers — enough for modest contexts at standard GQA ratios, but not for aggressive long-context work without quantizing or offloading the cache.
The KV Cache: Exact Memory Tables by Context Window
KV-cache size is fully deterministic once you know architecture constants:
kv_bytes = 2 * n_layers * n_kv_heads * head_dim * ctx_tokens * bytes_per_element
# For Llama-3.x-style GQA models this simplifies per token:
# e.g., a 32-layer, 8-KV-head, 128-dim model in f16 stores
# 2 × 32 × 8 × 128 = 65,536 elements/token → 131,072 B/token ≈ 128 KiB/token
# At Q8_0 KV cache quantization: ~64 KiB/token
# At Q4_0 KV cache quantization: ~34 KiB/token (per-tensor floor of ~35% f16)| Model Family | KV dtype | @ 8k ctx | @ 32k ctx | @ 64k ctx |
|---|---|---|---|---|
| Llama 3.x / DeepSeek-R1-Distill (GQA 8 heads) | f16 | ~1.0 GB | ~4.0 GB | ~8.0 GB |
| Q8_0 | ~0.5 GB | ~2.0 GB | ~4.0 GB | |
| Q4_0 | ~0.27 GB | ~1.06 GB | ~2.13 GB | |
| Gemma-style (GQA 8 heads, ~46 layers) | f16 | ~1.5 GB | ~6.0 GB | ~12.0 GB |
| Q8_0 | ~0.75 GB | ~3.0 GB | ~6.0 GB | |
| Qwen2.5-Coder class (GQA, ~48 layers) | f16 | ~1.6 GB | ~6.4 GB | ~12.8 GB |
| Q8_0 | ~0.8 GB | ~3.2 GB | ~6.4 GB |
Two operational consequences follow immediately. First, 32k+ context on 8 and 12 GB cards is a cache-quantization problem, not a model-size problem — running the KV cache at Q8_0 costs near-zero perplexity (typically <0.5% degradation) while halving cache footprint. Second, at 64k the cache alone exceeds the entire usable VRAM of an 8 GB card under any dtype, so long-context RAG on that tier must use CPU-offloaded or paged attention paths (llama.cpp `-ot exps=CPU`-style tensor overrides, or vLLM with paging), accepting a 30–60% throughput penalty.
Quantization Quality: Perplexity Impact of Q4_K_M vs Q5_K_M vs Q6_K vs IQ4_XS
K-quants quantize blocks of weights with per-block scales plus super-block scaling; importance-matrix (IQ) quants go further by measuring each weight's contribution to activations before assigning bit levels. On representative post-trained instruct models tested with a fixed evaluation corpus in 2026 tooling:
| Quant | bpw | Δ perplexity vs f16* | Size delta vs f16 | When to choose it |
|---|---|---|---|---|
| Q6_K | 6.59 | ≈ +0.08% (near-indistinguishable) | ~73% | When it fits — the "no-compromise" ceiling for most tiers. |
| Q5_K_M | 5.69 | ≈ +0.3–0.7% | ~63% | Best Q/Q6 trade-off when headroom is needed for cache. |
| Q4_K_M | 4.83 | ≈ +1.5–3% | ~54% | The default general-purpose point; safe for chat and coding. |
| IQ4_XS | 4.25 | ≈ +2–4% (better than Q4_0, slightly worse than Q4_K_M on prose, competitive on code) | ~48% | Squeezing a bigger model into the same VRAM — e.g., 14B where only 9 GB remains. |
*Figures are relative degradation bands consistent across llama.cpp perplexity sweeps on 7B–32B dense models; exact numbers vary by checkpoint and evaluation set, but the ordering is stable. The engineering rule of thumb: prefer a smaller model at higher precision over a larger model at lower precision whenever both fit. A Q6_K 7B generally outperforms an IQ4_XS 13B-class model for reasoning-heavy tasks despite having half the parameters, because quantization error compounds through chain-of-thought token sequences. Exception: code generation tolerates aggressive quantization far better than natural-language reasoning does, since syntax-constrained decoding partially masks weight noise.
The Spillover Cliff: Why Partial Offload Destroys Throughput
When weights + cache exceed VRAM, llama.cpp splits layers between GPU and CPU. Because every decode step must still read the full network, the CPU-resident portion runs at system-RAM bandwidth (typically 50–90 GB/s dual-channel DDR5) while the GPU portion runs at its full bus speed. Effective throughput becomes:
# Weighted harmonic of offload fractions:
1/tps_eff ≈ f_gpu/BW_gpu + f_cpu/BW_ram
# With 85% on a 272 GB/s card and 15% in ~80 GB/s RAM:
1/tps ≈ 0.85/220 + 0.15/65 → tps_eff ≈ 44% of pure-GPU speed
# PCIe DDR5 spillover also risks OOM-kill loops if the OS
# desktop compositor reclaims headroom mid-generation.
nvidia-smi --query-gpu=memory.used,memory.total --format=csv -l 1 # monitor firstPer-Tier Model Selection Matrix and Tested Configs
| Task | 8 GB (RTX 4060 / RX 7600) | 12 GB (RTX 4070 / RTX 3060 12GB) | 16 GB (4060 Ti 16 / 4070 Ti S) | 24 GB (3090 / 4090) |
|---|---|---|---|---|
| Coding (fill-in + edit) | Qwen2.5-Coder-7B Q4_K_M, 8k ctx | Qwen2.5-Coder-14B IQ4_XS, f16-KV trimmed ctx | Qwen2.5-Coder-14B Q6_K @ 32k; 32B only at Q3/IQ4 spillover on the Ti S is not worth it — prefer 14B fast | Qwen2.5-Coder-32B Q4_K_M @ 16–32k (~13 GB + cache) |
| Math / chain-of-thought reasoning | DeepSeek-R1-Distill-Qwen-7B Q6_K (reasoning demands precision headroom over size) | DeepSeek-R1-Distill-14B Q5_K_M, KV Q8_0 | DeepSeek-R1-Distill-32B IQ4_XS (slow ~15–20 tok/s on the Ti S; 14B Q6_K faster and often more accurate per second of wait) | Distill-32B Q6_K — the sweet spot for sustained CoT |
| General chat + tool calling | Llama 3.3 / Gemma 9-class at Q4_K_M with strict JSON grammar constraints | Gemma-class 12B Q6_K — strongest instruction fidelity in tier | Llama-class 8B+ Q6_K paired with a function-calling template, or Gemma 27B IQ4_XS (tight) | 70B IQ/Q3 variants, or two models side-by-side via Ollama load balancing |
| Vision / multimodal | 7B vision model Q5_K_M + mmproj f16 (~350 MB projector); budget ~800 MB extra for image tokens' KV | 11–13B-class vision Q5_K_M comfortably at 8k ctx | 26–29B-class vision IQ4_XS on the Ti S; multi-page document OCR viable | 72/90B-class vision models Q4 with video-frame batching |
| Long-context RAG (32–64k) | 7B Q4_K_M + KV Q4_0, ~24k practical ceiling without paging | 14B IQ4_XS + KV Q8_0 @ 32k fits on RTX 4070 with ~1 GB margin | 14B Q5_K_M + f16 KV @ 48k, or 64k with Q8 cache; embedder colocated if <4 GB | 70B at low quant for retrieval-verified answers, plus local embedding+reranker stack in parallel VRAM |
Ollama Recipes That Actually Match These Constraints
Generic `ollama run` defaults waste your VRAM: Ollama's context default (historically 2048→4096 tokens) leaves most of the KV budget unused, while auto-layer offload can silently spill. Pin everything explicitly:
# --- 8 GB tier: Qwen2.5-Coder-7B, max usable context ---
ollama create coder8 -f - <<'EOF'
FROM qwen2.5-coder:7b
PARAMETER num_ctx 16384
PARAMETER num_gpu 99
PARAMETER temperature 0.2
ENV OLLAMA_KV_CACHE_TYPE=q8_0
ENV OLLAMA_FLASH_ATTENTION=1
EOF
# --- 12 GB tier: DeepSeek-R1-Distill-14B reasoning on RTX 4070 ---
ollama create r1d14 -f - <<'EOF'
FROM deepseek-r1:14b # pick an IQ4_XS/Q4_K_M tagged build
PARAMETER num_ctx 32768
PARAMETER repeat_penalty 1.1 # distills drift without it in long CoT
ENV OLLAMA_KV_CACHE_TYPE=q8_0
ENV OLLAMA_FLASH_ATTENTION=1
EOF
# Verify no spillover:
ollama ps # "100% GPU" required; if you see a split, drop to 24k ctxFor raw llama.cpp control (useful when tuning tensor offload placement):
# Force only attention/output layers to CPU if the model is ~1GB too big,
# keeping all dense weight streaming on-GPU:
./llama-server -m model-IQ4_XS.gguf -ngl 99
-c 32768 --cache-type-k q8_0 --cache-type-v q8_0
--flash-attn -fa
-ot ".ffn_(up|gate)_exps.weight=CPU" # route specific tensors by regex
# Measure before/after honestly — prefill and decode are separate metrics:
# benchmark prompt: time-to-first-token (prefill) ≈ context-length sensitive;
# steady-state decode tok/s ≈ bandwidth bound as derived above.Apple Silicon Unified Memory: The Capacity Loophole
An M-series Max/Mega chip with 64–128 GB unified memory runs models no consumer NVIDIA card can hold — a 70B Q6_K (~60 GB) fits entirely on-chip — but delivers it at roughly one-third to two-thirds the tokens/sec of an RTX 4090, because LPDDR5 bus bandwidth caps out below GDDR6X. The decision rule:
- Pick Apple Silicon when you need >24 GB effective capacity (large MoE routers that activate few experts, long-context multi-document work, running several small models simultaneously), value silent low-power operation, or want a single machine for everything.
- Pick discrete NVIDIA when per-token latency matters most (interactive coding assistants, agent loops issuing thousands of short generations) — bandwidth-bound decode still favors the fastest bus you can afford.
- Skip hybrid GPU+RAM offload on x86 desktops unless your system RAM bandwidth is unusually high; the harmonic penalty shown earlier means a "just barely doesn't fit" model often feels slower than a smaller fully-offloaded one.
Tier Verdicts
8 GB is the entry tier and its ceiling is real: 7B-class at Q4–Q6, 16k–24k practical context. It excels as an always-on assistant node, not a reasoning engine. 12 GB is the best price-to-capability ratio in 2026 — the RTX 4070's ~500 GB/s bus plus 14B IQ4_XS models makes it feel like two tiers up from 8 GB. 16 GB splits into two products: buy the RTX 4060 Ti 16GB for capacity-bound batch/RAG workloads where tokens/sec is secondary; buy the RTX 4070 Ti Super when 32B-class low-quant reasoning at usable speeds matters. 24 GB removes almost every constraint simultaneously — 32B at near-lossless quantization with room to spare for embedding models and vision projectors — and remains the reference configuration against which every other tier should be measured.
Written and prepared by Kshitij Gupta.



