AI Use Cases

Guide · updated 2026-11-10

How much VRAM do you need to run an LLM locally? Work it out for your own machine

Work out how much VRAM a local LLM needs: the model file, the context cache and a margin, with worked examples on a 16 GB laptop and an 8 GB graphics card.

You need enough graphics memory to hold three things at once: the model file, the memory for your conversation, and a margin for the runner itself. For a common 8 billion parameter model the file alone is about 5.2 GB, so an 8 GB graphics card runs it with a normal length conversation, and a 16 GB Mac runs it with room to spare. The answer grows with how long a conversation you want, not only with how big the model is. The two worked examples below show the arithmetic so you can repeat it for any model.

What uses memory when a model runs?

Three parts add up to the total.

  • The weights. This is the model itself, the file you download. It is the biggest part and you can read its size off the download page.
  • The context cache. While you chat, the model keeps a working memory of every token in the conversation so far, called the key value cache or KV cache. It grows with every message.
  • Overhead. The runner needs scratch space for its calculations, and your operating system and other apps hold some memory too. This guide plans for a 1 GB margin, which is a planning choice rather than a measured figure. Leave more if you keep a browser full of tabs open.

If the total fits in your graphics memory, the model runs entirely on the GPU. If it does not, most runners split the model between the GPU and system memory, and it gets slower.

How do you estimate the weights from the model file?

Use the download size. A model file already reflects how heavily it was compressed, so you do not need to work out bits per parameter yourself. Ollama lists the size beside every tag on the Qwen3 model page (read 2026-11-10):

TagDownload sizeContext window listed
qwen3:4b2.5 GB256K
qwen3:8b5.2 GB40K
qwen3:14b9.3 GB40K
qwen3:32b20 GB40K

The weights take about as much memory as the file takes on disk. A smaller download means a smaller model or a more compressed one, and both cost some quality. llama.cpp, the engine under several local runners, supports integer quantization from 1.5 bit up to 8 bit "for faster inference and reduced memory use", according to the llama.cpp project README.

Why does a longer conversation need more memory?

Every token in the conversation gets stored in the KV cache, for every layer of the model. You can work out the cost per token from four numbers in the model's own configuration:

bytes per token = 2 x layers x KV heads x head size x bytes per value

The 2 is there because the cache keeps a key and a value. At the default precision each value takes 2 bytes. The Qwen3-8B model card on Hugging Face lists 36 layers and 8 KV heads, and its configuration file gives a head size of 128 (read 2026-11-10). So:

2 x 36 x 8 x 128 x 2 = 147,456 bytes per token, about 0.15 MB.

That looks small until you multiply it by a conversation:

Context lengthKV cache for Qwen3 8B (from the formula above)
4,096 tokens0.6 GB
16,384 tokens2.4 GB
32,768 tokens4.8 GB

At a long context the cache is almost as large as the model. This is why the same model can fit on your machine for a quick question and fail to fit when you paste in a long document. Ollama uses a context window of 4,096 tokens by default and lets you raise it with the OLLAMA_CONTEXT_LENGTH setting (Ollama FAQ, read 2026-11-10).

Worked example 1: a laptop with 16 GB of unified memory

On an Apple silicon Mac the CPU and GPU share one pool of memory, so the whole 16 GB is the budget. macOS and your open apps need their share of it as well.

Trying qwen3:14b at the default 4,096 token context. The 14B configuration file lists 40 layers, 8 KV heads and a head size of 128 (read 2026-11-10), which is 163,840 bytes per token.

  • Weights: 9.3 GB (Ollama model page)
  • KV cache: 163,840 x 4,096 = 0.7 GB
  • Margin: 1 GB
  • Total: about 11.0 GB, leaving about 5 GB of the 16 GB for macOS and everything else

It fits, but tightly. Raise the context to 16,384 tokens and the cache becomes 2.7 GB, the total becomes 13.0 GB, and the system starts to struggle.

What to change. Step down to qwen3:8b. At 16,384 tokens it needs 5.2 + 2.4 + 1 = 8.6 GB, which leaves plenty of room for the rest of the machine. On a 16 GB laptop an 8B model with a longer conversation is usually a better trade than a 14B model with a short one.

Worked example 2: a desktop with an 8 GB graphics card

On a PC with a separate graphics card, the card's own memory is the budget for full speed. System RAM only comes in when the model spills over.

Trying qwen3:8b at the default 4,096 token context.

  • Weights: 5.2 GB
  • KV cache: 0.6 GB
  • Margin: 1 GB
  • Total: about 6.8 GB of the 8 GB

It fits on the card and runs at full speed.

Now at 32,768 tokens, for a long document: 5.2 + 4.8 + 1 = 11.0 GB. That does not fit, so the runner puts part of the model in system memory and it slows down.

What to change. You have three levers, cheapest first.

  1. Shorten the context. At 16,384 tokens the total is 8.6 GB, still slightly over.
  2. Compress the cache. Ollama can store the KV cache at 8 bit, which uses about half the memory of the default, or at 4 bit, which uses about a quarter, with a small to medium loss in precision (Ollama FAQ). At 16,384 tokens with an 8 bit cache the total is 5.2 + 1.2 + 1 = 7.4 GB, and it fits.
  3. Use a smaller model. qwen3:4b is a 2.5 GB download and leaves far more room for context.

Does a Mac count its system memory?

Yes. On Apple silicon there is no separate graphics memory. The GPU draws from the same unified memory as everything else, which is why a Mac with 32 GB or more can hold models that would need an expensive graphics card on a PC. The catch is that macOS keeps part of that memory for itself and your apps, so never plan to use all of it for the model. llama.cpp calls Apple silicon "a first-class citizen" and runs on it through Metal (llama.cpp project README).

Can you run a model with no graphics card at all?

Yes. Ollama and llama.cpp both run on the processor alone, using system RAM to hold the model. Ollama reports this as 100% CPU (Ollama FAQ). The same arithmetic applies, with system RAM as the budget. It works, but it is much slower, because a processor reads memory far more slowly than a graphics chip does. Small models in the 1B to 4B range are the practical choice on a machine with no GPU. For setup steps on a laptop, see how to run an LLM locally on your laptop.

What do you change when a model does not fit?

Work through these in order, because each one costs a little more than the last.

  1. Shorten the context. If you do not need long documents, the default context is often enough.
  2. Compress the KV cache to 8 bit. The loss is very small and the cache shrinks by about half.
  3. Pick a smaller tag of the same model, such as 8B instead of 14B.
  4. Pick a more compressed file of the same model, if the runner offers one.
  5. Accept a split. Let the runner put part of the model in system memory. It still works, only slower. llama.cpp describes this as CPU and GPU hybrid inference that partially accelerates "models larger than the total VRAM capacity" (llama.cpp project README).

How do you check what is actually being used?

Your arithmetic is an estimate. The runner's own report is the truth.

  • Ollama. Run ollama ps while a model is loaded. The Processor column reads 100% GPU when the whole model sits in graphics memory, 100% CPU when it sits entirely in system memory, and a split such as 48%/52% CPU/GPU when it spans both (Ollama FAQ, read 2026-11-10). A split means it did not fit.
  • Windows. Open Task Manager, then Performance, then your GPU, and read Dedicated GPU memory while the model answers a question.
  • NVIDIA cards on any system. Run nvidia-smi in a terminal to see memory used per process.
  • Mac. Open Activity Monitor and watch Memory Pressure on the Memory tab. Yellow or red means the model is pushing the rest of the machine into swap.

If the number you see is higher than your estimate, check the context length the app is really using. Another app may set a different default from Ollama.

Frequently asked questions

Does system RAM count when the GPU runs out?

Yes, but at a cost. Most runners move the layers that do not fit into system RAM and run them on the processor. The model keeps working and gets slower. On a Mac the question does not arise, because all memory is shared.

Is a smaller model or a more compressed model the better trade?

Both cost some quality, and which costs less depends on the model and the task. The practical answer is to try both on a task you care about and keep the one whose answers you trust. A one step change, such as 8 bit to 4 bit, is a reasonable first test.

Why does the same model use more memory in one app than another?

Usually the context length. One app may default to a much longer context than another, and the KV cache grows with it. Cache precision and how many conversations the app keeps open at once also change the total. Ollama notes that handling parallel requests increases the context size by the number of parallel requests (Ollama FAQ).

Do I need a new computer to run a local model?

Probably not. Any recent laptop with 8 GB of memory can run a small model, and 16 GB runs an 8B model comfortably. Do the arithmetic for the model you want first, and buy hardware only if the model you need does not fit any way you try it.

Pick a runner for your machine

Once you know what fits, choose the software to run it. The run LLMs locally use-case page ranks the runners from public evidence, with the free options and the open source options listed separately. If you are deciding between the two most common choices, Ollama vs LM Studio compares them, and the Ollama and llama.cpp tool pages carry each one's current strengths and weaknesses.

More guides