toolkitbox

~/tools / Local LLM Memory Estimator

Local LLM Memory Estimator — Estimate the memory a local LLM needs: model file plus KV cache

Estimate how much memory a local LLM needs on a VPS or your own machine: the model file plus the KV cache for your context length and number of parallel requests. Presets use the official download sizes and model configurations of Qwen3 and Mistral 7B. Nothing leaves your browser.

Model

Ollama tag qwen3:8b, quantization Q4_K_M, download size 5.2 GB.

Estimate

Model weights
4.84 GiB
KV cache
0.56 GiB
Reserve
1.00 GiB
Total
6.41 GiB (6.88 GB)
Smallest common memory size that holds it
8 GiB

This is an estimate. It does not include the runtime's compute buffers, and it assumes that every layer has the same KV shape. Measure a real run before you choose a plan.

Model data checked on 2026-10-26.

Sources: Ollama library · Model configuration (config.json) · Ollama FAQ

Everything runs in your browser. Nothing is uploaded.

A local language model needs memory for two things. The first is the model itself, which is about as large as its download file. The second is the KV cache, which grows with the length of the context and with the number of requests the server handles at the same time. The Ollama FAQ states that the required RAM scales by OLLAMA_NUM_PARALLEL multiplied by OLLAMA_CONTEXT_LENGTH, and that quantizing the cache with q8_0 uses approximately half the memory of f16 and q4_0 about a quarter. This tool adds the two parts for you. It takes the file size from the Ollama library, and the number of layers, KV heads and head dimension from each model's official configuration file, and it calculates the cache as 2 × layers × KV heads × head dimension × context length × parallel requests × bytes per value. It then adds a reserve for the operating system and other services, shows the total in GiB and GB, names the smallest common memory size that holds it, and tells you whether it fits the VPS plan you type in. The result is an estimate, not a measurement: it does not include the runtime's own compute buffers, and a real server should be measured before you commit to a plan. The model data was checked on the date shown below the tool.

Use Cases

  • Choosing the memory size of a VPS plan before you pay for it
  • Seeing what raising the context length or the number of parallel requests does to memory
  • Comparing a smaller model with a larger one for the same server

Usage

  1. Choose a model, or choose the custom entry and type the file size, layers, KV heads and head dimension of your own model.
  2. Set the context length, the number of parallel requests, the KV cache type and a reserve for the operating system and other services.
  3. Optionally type the memory of the plan you are considering to see whether the estimate fits and by how much.

FAQ

How is the memory calculated?

The tool adds three parts. The weights are the download size of the model file. The KV cache is 2 × layers × KV heads × head dimension × context length × parallel requests × bytes per value, where a value takes 2 bytes in f16, and about 1 byte in q8_0 and about half a byte in q4_0, following the ratios in the Ollama FAQ. The third part is a reserve that you set for the operating system and other services.

Where do the numbers for the models come from?

The file sizes and the quantization are the ones that the Ollama library shows for each tag. The number of layers, KV heads and the head dimension come from each model's official config.json on Hugging Face. For Mistral 7B, which gives no head dimension, it is the hidden size divided by the number of attention heads. The date of the check is shown below the tool.

Why is the result only an estimate?

The runtime also needs working memory for its compute buffers, which this tool does not include, and the real use depends on the runtime and its settings. Measure the memory use of a real run before you choose a plan, and keep some margin.

What is the difference between GB and GiB?

A GB is 1,000,000,000 bytes and a GiB is 1,073,741,824 bytes. The tool shows both for the total and compares the plan memory you type with the total in GiB, so that it does not overestimate what fits. A provider's "GB" may mean either, so check how your provider counts.

Can I use a model that is not in the list?

Yes. Choose the custom entry and type the file size, the layers, the KV heads and the head dimension, which are given in the model's config.json. The formula assumes that every layer has the same KV shape, so it does not fit models that mix layer types, use sliding windows, or use a mixture of experts.

What does the KV cache type change?

It changes only the size of the cache, not the weights. According to the Ollama FAQ, q8_0 uses approximately half the memory of f16 and q4_0 approximately a quarter. This tool does not measure how a smaller cache affects the answers.

Is my input sent to a server?

No. The calculation runs in your browser.

Related