Interactive FinOps Simulator #4

Local LLM Unified Memory, VRAM & Speed (tok/s) Checker

Model file size alone does not determine whether a local LLM runs smoothly. Calculate exact quantized weights, long-context KV cache growth, Metal/CUDA ceiling limits, and memory-bandwidth-bound generation speed.

Rate Card & Spec Audit: Published by: ShiftFrameLabs Data Processing: 100% Local Client-Side Browser Math
Load Setup:
Expanding context from 8K to 64K can add 6 GB to 18 GB of extra KV cache memory.
Memory Footprint & Decode Speed Forecast
Optimal Fit: 10.6 GB headroom remaining
29.4 GB required
8.3 tok/s estimated decode
Quantized Model Weights:19.5 GB
Context KV Cache Allocation:7.1 GB
Metal / CUDA Compute Buffer + OS:2.8 GB
Usable GPU Ceiling / Physical RAM:40.0 GB / 48 GB
Includes macOS Metal wired-memory ceiling guard Download Hardware CSV

How Much Unified Memory or VRAM Do You Actually Need for Local LLMs?

Direct Answer Summary (Verified 2026-12-01)

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
Hardware Troubleshooting Note: Prefill Latency vs. Decode Speed on Apple Silicon While M4 Pro and M4 Max chips sustain smooth token decoding thanks to wide unified memory buses, processing a cold 60,000-token RAG prompt (prefill phase) is FP16 compute-bound. Expect 18–35 seconds of time-to-first-token on large dense models unless prompt caching (--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.

Frequently Asked Technical Questions

Why can't macOS allocate 100% of Unified Memory to a local LLM?

By default, macOS reserves roughly 20–25% of Unified Memory for the kernel, WindowServer, and uncompressed system pages. Power users on dedicated headless Mac servers can safely raise iogpu.wired_limit_mb via sysctl up to ~85–88%, but setting it higher risks system freezes.

Does quantizing KV cache to Q8_0 or Q4_0 hurt coding accuracy?

Quantizing KV cache to 8-bit (Q8_0) cuts context memory nearly in half with negligible perplexity loss (<0.2%). Dropping KV cache to 4-bit can degrade needle-in-a-haystack retrieval on exact variable names past 32K tokens.

What tokens-per-second (tok/s) speed is comfortable for human reading vs. agent loops?

Human reading speed averages 5 to 8 words per second (~7 to 11 tok/s), so anything above 12 tok/s feels instantaneous in chat. Multi-step coding agents that generate thousands of hidden tokens require 35+ tok/s to avoid sluggish turnaround.

Why do MoE models run so much faster than dense models of the same total size?

Decode speed depends on how many gigabytes of weights must pass through the memory bus per token. A 30B MoE model with 3B active experts only reads ~2 GB of weights per token instead of ~18 GB, multiplying speed while retaining broad knowledge.

How much overhead does desktop display resolution add to VRAM usage?

Driving dual 4K/5K displays consumes 1.2 GB to 2.0 GB of GPU/Unified memory. Running a headless Mac mini or Linux server over SSH reclaims that buffer for larger context windows.