Why won't it load?

4 min readMarkdown

A model that will not load almost always ran out of memory. The weightsWeightsThe full set of a model's parameters, stored in a file.Read more plus the context did not fit in your VRAMVRAMMemory on a graphics card. On a PC with a GPU, it is your model budget.Read more, or in your Mac's usable memory. The fix is to make one of them smaller.

Read the error

The wording differs by runtimeRuntimeThe software that loads a model file and runs it.Read more, but most memory errors say "allocate", "out of memory" or "requires more memory". Here is what the common ones mean.

RuntimeWhat you seeWhat it means
Ollamamodel requires more system memory (...) than is available (...)The model plus its context does not fit in free RAM. Close apps or pick a smaller build
Ollamallama runner process has terminated followed by a reasonThe engine underneath crashed while loading. The reason after it is the real error, often a memory allocation
llama.cppcudaMalloc failed: out of memoryThe layers you asked to put on the NVIDIA GPU do not fit in its VRAM
vLLM, PyTorchCUDA out of memory. Tried to allocate ...The GPU filled up, either at load time or while reserving the KV cache
vLLM... is larger than the maximum number of tokens that can be stored in KV cacheThe weights fit, but there is no room left for the context length you set
LM StudioA "failed to load model" message, sometimes with a warning that the model may exceed your system resourcesSame cause. LM Studio estimates the fit before loading and can block a model it thinks is too big
MLXA Metal error about an allocation larger than the allowed buffer sizeThe model, or one tensor in it, is bigger than the GPU share macOS allows

Ollama keeps a log with the full message when the app only shows a short error. On a Mac it is at ~/.ollama/logs/server.log. On Linux, read it with journalctl -u ollama.

Some failures that look like memory are not. An "unknown model architecture" error means your runtime is too old for the model, and the fix is an update. A failed download gives a file that will not open, and Why is the output nonsense? covers broken files.

The order of fixes

Try these in order. Each one costs you a little more than the one before.

  1. Use a smaller quantizationQuantizationStoring each weight with fewer bits so the model takes less memory.Read more. Go from Q8 to Q6, or from Q6 to Q4. Quality barely moves down to Q4, and the file shrinks a lot. Budget about 0.6 GB per billion parameters at 4-bit against about 1.1 GB per billion parameters at 8-bit. Which quantization should I download? has the ladder.
  2. Use a smaller context. Halve the context length setting. The KV cacheKV cacheSaved work from earlier tokens, so the model does not reread the whole conversation for every new token.Read more grows with every tokenTokenA chunk of text, usually part of a word. Models read and write in tokens.Read more of context, and at 128K it can be as large as a small model. How much can the model keep in mind? shows the sums.
  3. Use a smaller model. Drop one class, for example from a 27B to an 8B. This is the fix that always works and the one that costs the most. Which size of model do I need? lists the steps.
Rule of thumb

Leave a few GB free after the model loads. A model that only just fits will fail the moment the chat gets long.

Two things help before you shrink anything. Close browsers and other heavy apps, which can hold several GB. And make sure only one model is loaded, because Ollama and LM Studio can keep a previous one in memory.

shell
ollama ps
ollama stop qwen3:8b

ollama ps lists loaded models and their size. ollama stop unloads one by name.

The catch

On a PC with a separate GPU, some runtimes do not fail when the model is too big. They put the extra layers in system memory and run very slowly instead. If it loads but crawls, that is the same problem, see Why is it slow?.

Check before you download

The cheapest fix is to never download a model that cannot fit. Will it fit? does the sum for your memory, model and context. What can I run on what I have? goes the other way and lists what fits on your machine.

Try it
shell
ollama show qwen3:8b

This prints the model's parameterParameterOne learned number inside a model. An 8B model has about eight billion of them.Read more count, quantization and context length before you load it. Multiply the parameters by the rule of thumb above to see if it fits.

Go deeperThat's enough

What actually takes the memory

Three things share the space. The weights are fixed by the model and its quantization. The KV cache grows with context length and with the number of parallel requests.

A few hundred MB to a few GB goes to the runtime's working buffers, and Will the model fit in my memory? breaks this down.

Why a Mac cannot use all of its memory

macOS lets the GPU use only part of the unified memoryUnified memoryOne pool of memory shared by CPU and GPU, as on Apple silicon and some AMD and NVIDIA boxes.Read more, and keeps the rest for the system and your apps. The share is larger on machines with more memory. A model close to your total memory will not load even if nothing else is open.

Advanced users can raise the limit with sudo sysctl iogpu.wired_limit_mb=<value>, at the risk of starving macOS itself.

vLLM reserves memory on purpose

vLLM claims a fixed share of the GPU at start-up and fills it with KV cache. That is how it serves many users fast. If it fails, lower --max-model-len to shrink the context, or adjust --gpu-memory-utilization. When do I need vLLM or SGLang? covers both.

Multiple GPUs

Two GPUs add their memory together, if the runtime splits the model across them. llama.cpp and vLLM both do this. How do several GPUs in one box work together? explains the options and their costs.