Latest

Which local AI model for your PC: parameters, quantization, VRAM and context explained with numbers

Before downloading a model in Ollama, do the maths: how many parameters, which quantization, how much video memory and how much context. A table to estimate memory, the difference between Q4, Q5 and Q8, what changes on Apple Silicon Macs and how to tell whether the model is running on the CPU instead of the GPU.

By 4 min read
Which local AI model for your PC

A language model running on your computer is fast only if it fits entirely in video memory (VRAM) or, on Macs, in unified memory. If it does not fit, part of it moves to the CPU and speed collapses. Three numbers are enough to choose: parameters, quantization and context length. For a practical use case see querying your own documents with local RAG and Ollama.

Parameters and quantization

Parameters are the model’s weights: 7B means 7 billion. Originally each weight takes 16 bits (2 bytes). Quantization compresses them to 8, 5 or 4 bits with a limited loss of quality. In the GGUF format used by llama.cpp and Ollama, the most common labels are:

Label Bits per weight (approx.) Quality When to use it
F16 / BF16 16 Original Only with plenty of memory, or for further conversion
Q8_0 8.5 Almost identical to the original Small models on cards with memory to spare
Q5_K_M 5.7 Very good A good compromise if memory allows
Q4_K_M 4.8 Good, the recommended starting point General use; the default variant of many models in Ollama
Q3 and Q2 3.5 or less Clear loss Only to squeeze a large model into little memory

As a rule, a larger model at Q4 answers better than a smaller model at Q8 in the same memory, but below Q4 quality drops quickly.

How much memory you need

Rough estimate: weight memory = parameters × bits per weight ÷ 8, plus 1–2 GB for context and runtime.

Size Q4_K_M (weights) Recommended memory Typical hardware
3–4B about 2–2.5 GB 4 GB Laptops without a dedicated GPU, mini PCs
7–8B about 4.5–5 GB 6–8 GB 8 GB cards, 16 GB Macs
12–14B about 7.5–9 GB 10–12 GB 12 GB cards, 16–24 GB Macs
27–32B about 16–20 GB 24 GB 24 GB cards, Macs with 32 GB or more
70B about 40–43 GB 48 GB or more Two cards or Macs with 64 GB or more

These are indicative values that vary with the model architecture. The exact file size is shown on the model page.

Context takes memory

The context is how much text the model keeps in mind at once (question, documents, conversation). Every context token takes memory in the KV cache, which grows linearly with length. An 8B model that fits comfortably with 4,000 tokens may no longer fit with 32,000. In Ollama the length is set with the num_ctx parameter (in a Modelfile or with /set parameter num_ctx 8192). Raise it only when you need it, for example to summarise long documents.

GPU, CPU and Mac

  • NVIDIA cards: the widest support. VRAM matters more than compute power.
  • AMD cards: supported by Ollama and llama.cpp on many recent models; check your card in the documentation.
  • Apple Silicon Macs: CPU and GPU share memory, so a 32 GB Mac can load models that would need an expensive card on a PC. Part of the memory stays reserved for the operating system.
  • CPU only: works with models up to 7–8B, but replies are slow. RAM speed matters a lot.

How to check the model runs on the GPU

ollama ps
NAME        SIZE     PROCESSOR
model:8b    6.1 GB   100% GPU

If PROCESSOR shows something like 40%/60% CPU/GPU, the model does not fit in the card: pick a lower quantization, a smaller model or a shorter context. ollama run model --verbose also shows tokens per second: below 5–10 tokens per second interactive use becomes uncomfortable.

Choosing in practice

  1. Check how much VRAM (or unified memory) you have and subtract 1–2 GB.
  2. Pick the largest model that fits at Q4_K_M.
  3. If memory is left over, try Q5_K_M or a longer context.
  4. Test the model on your real tasks (summaries, code, your language): general leaderboards say little about your use.
  5. Check the model’s licence, especially for work use.

Sources