An out-of-memory failure usually means the complete workload exceeds the usable memory pool, not merely that the model file is large. Count model weights, runtime overhead, context, multimodal components, document processing, and every other application that shares the same RAM, dedicated GPU memory, or Apple unified memory.
The first useful fix is usually to reduce model size or context. Reinstalling the app does not create more memory.
Dedicated GPU memory
On a Windows or Linux machine with a discrete GPU, the runtime fails when the model and working data do not fit in dedicated GPU memory. Some runtimes can offload part of the workload to system RAM, but that can make generation much slower.
Read the dedicated-VRAM number. On Windows, open Task Manager, choose Performance, select the GPU, and read Dedicated GPU memory. On an NVIDIA GPU, nvidia-smi in a terminal shows total and used memory. Do not add Windows “shared GPU memory” and treat it as more dedicated VRAM.
Apple unified memory
On Apple Silicon, the model shares one pool with macOS, context, document indexes, the browser, and every other process. A model that fits the installed memory fails when the operating system and normal applications consume the remaining headroom.
System RAM
CPU-only inference and partial GPU offload use system RAM. A machine can also have enough total RAM to load a model but too little remaining memory to keep the operating system responsive or grow the context.
- Close memory-heavy applications. Browsers, editors, virtual machines, games, and document-processing tools can consume the same pool.
- Reduce context length. Test a short prompt at a modest context before changing anything else.
- Use a smaller model. Move down a model class rather than forcing the current model to launch through constant swapping.
- Use a more compact model build. A common 4-bit build is normally the practical starting point for local text models.
- Restart the runtime after a failed load. A failed process can leave memory pressure or another model resident.
- Reduce what Ollama allocates. Memory use grows with context length times the number of parallel requests.
OLLAMA_NUM_PARALLELdefaults to 1; four parallel requests need about four times the context memory, so keep it at 1 for single-user use. SetOLLAMA_MAX_LOADED_MODELS=1so a second model is not held in memory. Ollama turns flash attention on automatically when your hardware supports it (OLLAMA_FLASH_ATTENTION=1forces it on). With flash attention on,OLLAMA_KV_CACHE_TYPE=q8_0uses roughly half the memory of the defaultf16conversation memory (KV cache), andq4_0roughly a quarter, with some loss of answer quality. The cache type applies to every model. Set these variables the way the offline guide setsOLLAMA_NO_CLOUDfor your system, then restart Ollama.
| Symptom | Most likely explanation | First action |
|---|---|---|
| The model never finishes loading | Model weights and loading overhead exceed the usable pool | Try a substantially smaller model |
| A short prompt works but long chats fail | Context and key-value cache consume the remaining headroom | Reduce context and start a fresh chat |
| Text chat works but image input fails | Vision components or projectors add memory demand | Test text-only, then a small image with the required components |
| Chat works but PDF import causes failure | Extraction, embeddings, indexes, and retrieved text compete with the model | Test one small document and reduce model size |
| The machine becomes unresponsive | The operating system is swapping heavily | Stop the process and choose a smaller workload |
| A GPU model spills into system RAM | Dedicated GPU memory is exhausted | Reduce model size, context, or GPU-resident layers |
Model-family names are not enough. Record:
- the exact file or model tag;
- quantization or format;
- total and active parameters where relevant;
- context target;
- runtime and version;
- GPU offload or backend settings;
- whether a vision projector or embedding model is also loaded.
Two downloads with the same family name can have materially different memory requirements.
A PDF workflow can run several memory-consuming stages beside the chat model: parsing or OCR, chunking, an embedding model, a vector index, retrieval, reranking, and a longer final prompt. Image-capable models load a vision encoder or projector in addition to the language model.
Do not diagnose these workflows from the model-file size alone. Run one small representative document or image and observe the complete pipeline.
Retry the same file with the source length you actually need and your ordinary apps open. If it loads at 2,048 but fails at 8,192, compare the context budgets. If it fails before processing even a short prompt, recheck weight size and hardware placement. Keep the smaller option if swapping persists.
Use the RAM and VRAM requirements guide to understand the memory pools, then enter the exact model file and context in the RAM and VRAM calculator.
