Skip to main content

Playground · app-grounded instrument

On-device AI

LLM VRAM & KV-Cache Footprint Calculator

Exact memory math for open LLMs (DeepSeek-R1, Llama 3.3, Qwen 2.5, Mistral). Calculate weight sizes, KV-cache scaling up to 128K context, activation overhead, and hardware fit across Apple Silicon, RTX GPUs, and Jetson dev kits.

Already solved for 62 models and 22 accelerators. If your model and card are common ones, the arithmetic below has been done from the model's own config — browse the fit matrix rather than typing head counts in by hand.

Model & Architecture Configuration

Deterministic Math

Memory Footprint Breakdown

45.0 GB VRAM
Model Weights Footprint (0.56 B/param):39.38 GB
KV-Cache Residency (<8K context):2.50 GB
Activation & Context Overhead:3.15 GB
Min Recommended VRAM Pool:45.02 GB
Est. Generation Throughput:10.2 tok/sec

Hardware Target Compatibility Matrix

Apple Mac Studio M3/M4 Ultra (192GB)✅ Comfortably Fits
Apple Mac Studio M2 Ultra (128GB) (128GB)✅ Comfortably Fits
Apple MacBook Pro M3/M4 Max (64GB) (64GB)✅ Comfortably Fits
NVIDIA RTX 4090 / 3090 (24GB)❌ OOM Exceeded
Dual NVIDIA RTX 4090 (48GB) (48GB)⚠️ Tight Fits (85%+ VRAM)
NVIDIA H100 SXM5 80GB (80GB)✅ Comfortably Fits
Jetson Orin AGX 64GB (64GB)✅ Comfortably Fits
Raspberry Pi 5 (8GB RAM) (8GB)❌ OOM Exceeded

Anatomy of LLM Memory Allocation

Running an open LLM on consumer GPUs or Apple Silicon requires partitioning memory across three distinct structures:

1. Static Weights

Quantized Weight Tensor

The model parameters stored on disk. Quantization packs FP16 weights down to 4-bit (0.56 B/param) or 8-bit (1.06 B/param). Stays resident in VRAM/Unified RAM continuously.

2. Dynamic KV-Cache

Key-Value Attention Cache

Stores intermediate key and value states per layer for every prompt token to avoid re-computing attention during generation. Grows linearly with context length and batch size.

3. Runtime Overhead

CUDA/Metal Runtime Context

GPU driver context buffers, scratch spaces for FlashAttention, and activation tensors. Typically consumes 1.0 GB to 2.5 GB depending on framework (vLLM, llama.cpp, CoreML).

Gear & Hardware Picks for Local LLMs

Tested studio gear for running large models on-device and high-throughput inference.

Build this lab

Local vs cloud inference bench

Jetson Orin Nano for local GPU inference + Pi 5 as an offload gateway — reproduce the client-vs-serverless tradeoff on real hardware before you commit to a cloud GPU bill.

Prices shown were retrieved from the Amazon Product Advertising API on 19 July 2026 and are indicative only — the price and availability on Amazon at the time of purchase apply.

Prices shown were checked against the Amazon product listing on 9 August 2026 and are indicative only — the price and availability on Amazon at the time of purchase apply.

Estimated total

$695

Prices from Amazon catalog cache · may change

Open primary listing ↗

Kit Total

Buy ↗

The Mathematics of Memory & Bandwidth

The total VRAM footprint M_total is governed by:

Mtotal=(P×Bweight)+(2×L×Hkv×Dhead×Nctx×Nbatch×Bkv)+MoverheadM_{\text{total}} = (P \times B_{\text{weight}}) + \left(2 \times L \times H_{\text{kv}} \times D_{\text{head}} \times N_{\text{ctx}} \times N_{\text{batch}} \times B_{\text{kv}}\right) + M_{\text{overhead}}

Autoregressive token generation speed T_gen (tokens/sec) is memory-bandwidth limited during decoding:

TgenBWmem (GB/s)Mweights (GB)T_{\text{gen}} \approx \frac{\text{BW}_{\text{mem}} \text{ (GB/s)}}{M_{\text{weights}} \text{ (GB)}}

Inference Startup & Allocation Command

Copyable startup template for vLLM / llama.cpp with exact memory ceilings.

# Python / vLLM / llama.cpp startup script generator
# Run with estimated memory ceiling
python3 -m vllm.entrypoints.openai.api_server \
  --model Qwen/Qwen2.5-72B-Instruct-GGUF \
  --gpu-memory-utilization 0.90 \
  --max-model-len 32768 \
  --kv-cache-dtype fp8

Export · Soft gate

Export vLLM & llama.cpp Benchmark Config Script

Free watermarked file instantly. Unlock clean export via email — soft gate, no hard paywall. We store unlock in localStorage per sim.

File · llm-vram-kvcache-calculator.txt

llm-vram-kvcache-calculator.txttext/plain+ watermark line on free path

Free download adds a small footer: # Export from makerportal.ai — free watermarked build. Unlock c…Clean export removes footer. Both are generated fresh from your current sim tuning.

Privacy: email stays in your browser localStorage (mp_export_email_llm-vram-kvcache-calculator) + unlock flag (mp_export_unlock_llm-vram-kvcache-calculator). If Buttondown username is configured, we also POST to Buttondown (privacy-first mode, no tracking pixels per D-014). See privacy → affiliates & email.

Unlock clean export

Soft gate — no hard paywall, no Clerk. Email stays local unless you explicitly check the newsletter box. Unsubscribe anytime. RSS at /rss.xml.

Export → Fab bonusAfter export, your tuned stackup can be ordered via PCBWay/JLCPCB CTA (when live) — see /privacy#affiliates for live merchants.

Frequently Asked Questions

How is total LLM VRAM requirement calculated?

Total VRAM is the sum of model weight footprint, KV-cache residency, activation memory, and runtime overhead: VRAM = (Params * BytesPerWeight) + (2 * Layers * Heads * HeadDim * SeqLen * Batch * BytesPerKV) + ActivationOverhead + RuntimeContext. For unified memory (Apple Silicon), this entire memory pool resides in system RAM shared with macOS.

What is the KV-Cache memory impact at 128K context lengths?

At 128,000 sequence length, the KV cache often exceeds the model weights themselves! For a 70B model in FP16 KV-cache, a single request at 128K tokens requires over 32 GB of KV-cache alone. Utilizing FP8 or INT4 KV-cache quantization reduces this footprint by 2x to 4x with minimal accuracy degradation.

Why does Apple Silicon (M1–M4 Ultra) perform so well on large models?

Apple Silicon uses Unified Memory Architecture (UMA) with extreme bandwidth (up to 800 GB/s on Ultra chips). Instead of being capped at 24 GB on consumer PCIe GPUs, a Mac Studio with 192 GB Unified Memory can run a 70B FP16 or DeepSeek-R1 Q4 model natively within one shared memory pool.

What token generation speed (tokens/sec) can I expect?

Memory bandwidth is the primary bottleneck during LLM autoregressive decoding. Generation speed is approximately Memory Bandwidth (GB/s) divided by Total Active Model Weight Size (GB). On a 400 GB/s M3 Max running a 20 GB Q4 model, maximum theoretical speed is ~20 tokens/sec per stream.