How Much Unified Memory or VRAM Do You Actually Need for Local LLMs?
A local LLM requires Quantized Weight Size + Context KV Cache + 2.1 to 2.8 GB of compute-graph overhead. On Apple Silicon Macs, macOS reserves roughly 16% to 20% of Unified Memory outside default Metal wired allocation—meaning a 32B Q4_K_M model (19.5 GB weights) comfortably runs at 32K context on a 48GB M4 Pro (~9 tok/s), but triggers severe SSD swap slowdown on a 24GB system.
Exact Memory & Bandwidth Speed Equations
Token generation (autoregressive decoding) reads every active model weight from memory once per generated token, making decode speed strictly memory-bandwidth-bound rather than compute-bound:
Total_Memory_GB = (Params_B * Bytes_Per_Param) + (KV_GB_per_1K * Context_K) + Runtime_Overhead_GB Decode_Speed_tok_s = (Memory_Bandwidth_GB_s / Active_Weights_Plus_KV_GB) * Architecture_Efficiency
Mixture-of-Experts (MoE) architectures such as 30B-A3B store all 30B parameters in RAM (requiring capacity), yet only read 3.3B active parameters per token—delivering 3x to 4x faster generation on bandwidth-constrained Mac mini nodes.
Formula Output vs. Reference llama-bench Throughput (M4 Pro & RTX 4090)
Comparing bandwidth-derived memory and decode estimates against reference llama-bench runs with Flash Attention (-fa on) and quantized KV caches:
| Hardware & Model Setup | Context | Formula RAM | Typical Resident RAM | Formula tok/s | Reference tok/s |
|---|---|---|---|---|---|
| Mac mini M4 (24GB) · 14B Dense Q4_K_M | 16K | 13.9 GB | ~14.3 GB | 8.2 tok/s | ~8.5 tok/s |
| Mac mini M4 Pro (48GB) · 32B Dense Q4_K_M | 32K | 29.4 GB | ~30.2 GB | 8.3 tok/s | ~8.7 tok/s |
| Mac mini M4 Pro (48GB) · 30B-A3B MoE Q4_K_M | 32K | 24.3 GB | ~24.9 GB | 58.8 tok/s | ~54.6 tok/s |
| RTX 4090 (24GB VRAM) · 32B Dense Q4_K_M | 16K | 25.2 GB | OOM (22.2 GB cap) | 0 tok/s | PCIe offload ~3.1 tok/s |
--cache-ram) keeps your system prefix resident. Read Fixing Local LLM OOM & Swap Bottlenecks for sysctl tuning commands.
Worked Sizing Examples
Example 1: Daily Local Coding Assistant on a 48GB Mac mini M4 Pro
Running a 32B Q4_K_M dense coding model consumes 19.5 GB for weights and 7.1 GB for a 32K repository context window, totaling 29.4 GB with Metal buffers—leaving over 10 GB free for your IDE, Docker containers, and browser. If interactive autocomplete feels sluggish at ~8.7 tok/s, switching to a 30B-A3B MoE model boosts output past 50 tok/s within a smaller 24.9 GB footprint.
Example 2: Why a 24GB RTX 4090 Beats M4 on 14B Speed, Yet Loses on 32B Capacity
With 1,008 GB/s of GDDR6X bandwidth, an RTX 4090 generates ~68 tok/s on a 14B Q4_K_M model—nearly 4x faster than an M4 Pro. However, the moment total weights + KV cache cross 22.2 GB, layers spill across PCIe into system DDR5 RAM and throughput collapses by 85%. Compare financial tradeoffs in our Local vs. Cloud GPU Break-Even Calculator.