How much memory does a model need?
The simple rule to know what fits on your machine, before you download anything.
Before downloading a model, only one question matters: does it fit in your machine’s memory? If it doesn’t, it will refuse to start or crawl along. The calculation itself is simple.
The simple rule
The memory needed is the sum of three things:
- the model’s weights, by far the biggest part;
- the context, meaning the conversation and the documents the model keeps in mind;
- the engine, the software that runs the model, which adds a few hundred megabytes.
For the weights, multiply the number of parameters by the number of bits stored for each one, then divide by eight to get bytes:
weights (GB) = billions of parameters × bits per parameter ÷ 8
An 8-billion-parameter model described as “4-bit” actually stores about 4.9 bits per parameter (more on that below). It therefore takes 8 × 4.9 ÷ 8, or 4.9 GB. That is the download size of llama3.1:8b in Ollama.
What “4-bit” means
Models are trained with 16 bits per parameter. To make them fit on a computer, they are compressed by storing each parameter on fewer bits: this is quantization. Precision drops a little; the space saved is huge.
In the GGUF files used by Ollama, LM Studio and llama.cpp, three formats come up everywhere:
| Format | Bits per parameter | In practice |
|---|---|---|
| Q4_K_M, “4-bit” | 4.9 | The most common trade-off. |
| Q8_0, “8-bit” | 8.5 | Almost identical to the original, twice as heavy. |
| F16, “16-bit” | 16 | The original model, rarely useful at home. |
Why 4.9 and not 4? These formats also store scale factors, and keep some parts of the model at higher precision. At 4 bits, the loss of quality stays small for most uses; below that, it becomes clearly visible.
Here is what the weights take up, by model size and precision:
| Model size | 4 bits | 8 bits | 16 bits |
|---|---|---|---|
| 3 billion | 1.8 GB | 3.2 GB | 6 GB |
| 8 billion | 4.9 GB | 8.5 GB | 16 GB |
| 14 billion | 8.6 GB | 14.9 GB | 28 GB |
| 32 billion | 19.6 GB | 34 GB | 64 GB |
| 70 billion | 42.9 GB | 74.4 GB | 140 GB |
Context takes up space too
During a conversation, the model keeps in memory everything it has already read, split into tokens (pieces of words). This working memory, called the KV cache, grows with the length of the context. For Llama 3.1 8B, it takes 128 KiB per token in 16 bits:
| Context length | Cache memory |
|---|---|
| 4,096 tokens | 0.5 GB |
| 32,768 tokens | 4.3 GB |
| 131,072 tokens | 17.2 GB |
Large models need more per token (320 KiB for Llama 3.1 70B), but many recent models are designed to need less (96 KiB for Qwen3 30B-A3B). The calculator uses high values: its estimate is cautious.
Two levers to keep the context in check:
- Keep a reasonable length. Ollama sets it according to your graphics card’s memory: 4,096 tokens below 24 GB, according to its documentation. To increase it for one conversation, type
/set parameter num_ctx 16384. - Compress the cache. With the variable
OLLAMA_KV_CACHE_TYPE=q8_0, Ollama roughly halves the space the cache takes, for a minimal loss of precision.
Which memory counts on your machine
On an Apple silicon Mac, memory is unified: the processor and the graphics chip share it. By default, macOS gives the graphics chip only about two thirds to three quarters of the total. Advanced users can raise this limit until the next restart with sudo sysctl iogpu.wired_limit_mb=…, always leaving headroom for the system.
On a PC with a graphics card, the card’s memory (the VRAM) is what counts. If the model doesn’t fit, part of it moves to system RAM and runs on the processor: it works, but much more slowly.
Without a graphics card, everything goes through system RAM and the processor. It is workable with a small model of 3 or 4 billion parameters, slow beyond that.
The site’s tools count the available memory like this: on a Mac, two thirds of the memory up to 36 GB, three quarters above that; on a graphics card, all its memory minus 1 GB for the display; without a graphics card, three quarters of the RAM. A model runs comfortably if it takes at most 85% of it, with no headroom up to 100%. To keep some margin, “Which AI for my machine?” counts a context of 8,192 tokens, and 32,768 for documents.
The case of MoE models
Some models, called mixture of experts (MoE), use only part of their parameters for each token. gpt-oss-20b has 21 billion parameters, but only 3.6 billion work on each token. For memory, count the total size: everything must be loaded. For speed, the active part is what counts, hence how fast they are.
In practice
At 4 bits and with a short context:
| Machine memory | What runs |
|---|---|
| 8 GB | Models of 3 to 4 billion parameters. |
| 16 GB | Up to 8 or 9 billion. |
| 24 to 32 GB | 14 billion with no trouble; up to 27 billion on 32 GB, with no headroom on a Mac. |
| 64 GB | 32 billion at 8 bits, or 70 billion at 4 bits, with no headroom. |
| 128 GB | 70 billion at 8 bits. |
Remember. Choose 4 bits, a reasonable context, and a model whose weights take at most 40% of the memory of a Mac or a PC without a graphics card, or 60% of a graphics card’s memory. For a specific case, use the calculator, or “Which AI for my machine?” for the models in the Ollama library.
