LLM Memory Bottleneck Simulator

Understand why massive context windows crash local AI models.

Configuration

Start from
16GB 64GB 128GB

Simulating 4-bit quantization (e.g., Q4_K_M).

Dense GQA assumed — 8 kv-heads × 128 head-dim. MoE, MLA and sliding-window models differ.

4k 128k 256k

llama.cpp defaults to fp16. Quantising the cache is the main lever for long contexts.

Model Weights (Static)

The core parameters of the AI. These files must be loaded into memory to execute inference. At 4-bit compression, this requires roughly 0.62 GB per 1 Billion parameters.

KV-Cache (Dynamic)

The model's active working memory. Its size is driven by layers × kv-heads × head-dim, not by parameter count — so it grows far faster than the weights as context expands.

This models the mechanism, for exact figures on a specific model, do your own math.

Memory Distribution

macOS VRAM Limit (~75%)
OS & Apps
Weights
KV-Cache
Swap Memory
(Extremely Slow)
OS & Apps Model Weights KV-Cache VRAM limit
VRAM Available
-- GB
Model Weights
-- GB
KV-Cache
-- GB
Performance
Optimal