On Ollama up to version 0.24, asking for a model that did not fit produced the error model requires more system memory (2.3 GiB) than is available (1.6 GiB). The check compared an estimate of weights plus KV cache plus compute buffers against free RAM plus swap, and it was removed between versions 0.24.0 and 0.25.0.
What you need
- Ollama installed, any recent version
- The exact error message or an OOM-killed service to diagnose
- A terminal and the model name that failed
Step 1: Read the numbers in the error
The error gives two figures, for example requires 2.3 GiB, available 1.6 GiB. The estimate counts model weights, KV cache that grows with context length, and compute buffers. On current Ollama there is no pre-check; instead the load may be killed by the kernel OOM killer and the service restarts.
Step 2: Shrink the context first
If the error appears only at a long context, lower num_ctx in a Modelfile, for example from 32768 to 4096. KV cache is the part that scales with context, and a 1B model at 131k context was refused with a 5.2 GiB estimate in the cited tests.
Step 3: Pick a smaller model or quant, then add mmap or swap
If the model file alone is bigger than RAM, no setting fixes it; pick a smaller model or a smaller quant such as Q4_K_M. On CPU-only machines, setting use_mmap to true in the Modelfile lets the kernel page weights from disk, and adding swap is a safety net. Setting OOMPolicy=continue on the service stops one bad load from restarting the whole server.
Worked example: a 3B model refused on a 2 GB machine
The table below is a synthetic example. The error text and the measured figures come from the cited memory guide; the machine size is its test setup.
| Model | Context | Outcome |
|---|---|---|
| llama3.2:3b | 4096 | Refused, estimate 2.3 GiB vs 1.6 GiB available |
| llama3.2:1b | 4096 | Loads, about 1.5 GiB resident |
| llama3.2:1b | 131072 | Refused, estimate 5.2 GiB |
Expected result (UNTESTED). after lowering num_ctx or switching to a smaller model, the model loads and answers instead of returning the memory error. This check was not run live; the figures and fixes come from the cited memory guide.
Limits
- On Ollama 0.25.0 and later the polite error is gone; an oversized load may OOM-kill the service instead.
- Swap lets a model load but can make it very slow, and turning swap off later can itself be killed.
- The old estimate ignored mmap, so a model it refused could still run with mmap on.
- A model file bigger than total RAM cannot run, whatever the settings.
