Instrument · Memory check
LLM VRAM calculator
Llama 3.1 8B needs about 6.4 GB at Q4_K_M: 4.92 GB of weights plus ~0.7 GB of KV cache at 4K context plus ~0.8 GB of overhead. That three-part sum is the whole calculation. Pick a model and your machine below; every model size is measured from real GGUF files.
Runs at Q4_K_M using ~6.4 GB of ~10.5 GB usable. You have room for Q8_0 for higher quality.
Best on macOS: LM Studio · Q4_K_M recommended
The formula, in the open
total memory = measured weights at your quant + KV cache for your context length + runtime overhead. That total is compared against your machine's usable memory: VRAM minus the runtime reserve on a GPU, roughly two thirds of unified memory on a Mac, RAM after the OS on a CPU laptop. Every constant and its source is documented on the methodology page; every model size links its GGUF source.
Other ways in
Start from your memory budget on the best LLM for your RAM pages, from your exact machine on best LLM for your device, or from a model's own page, which carries the full memory breakdown and a fit check for every tracked device. The 16 / 24 / 32 GB round-up answers the budget question in prose.
FAQ
How much VRAM does an LLM need?
Weights plus KV cache plus a little runtime overhead. Concretely: Llama 3.1 8B at Q4_K_M is 4.92 GB of weights, ~0.7 GB of KV cache at 4K context and ~0.8 GB of overhead, about 6.4 GB total. The same model at 32K context needs ~11.1 GB.
How is the model size calculated?
It is not calculated, it is measured: every model's Q4_K_M and Q8_0 figures are read from real GGUF files on Hugging Face or the Ollama registry, with the source linked on the model page. Only the KV cache and overhead are computed, from the model's architecture and your context setting.
Does the calculator work for RAM and Apple unified memory too?
Yes. It compares the model's total need against the usable memory of the machine you pick: GPU VRAM minus runtime reserve, about two thirds of a Mac's unified memory (the Metal working-set limit), or a CPU laptop's RAM after the OS. The verdict is per machine, not a single number.
Why does my context length change the answer?
The KV cache grows with context and lives in the same memory as the weights. For Llama 3.1 8B the total moves from ~6.4 GB at 4K context to ~11.1 GB at 32K, which is the difference between fitting and not fitting on an 8GB card.