What this thread does
Do first: Set OLLAMA_KEEP_ALIVE before starting the server; override individual requests with keep_alive.
Short answer
Keep-alive controls how long idle models stay loaded. Concurrent models and parallel requests consume available RAM or VRAM; requests wait when the next model cannot fit.
What to do
| Control | Value / effect |
|---|---|
| Idle residency default | 5 minutes |
| Per-request setting | keep_alive on /api/generate or /api/chat; overrides OLLAMA_KEEP_ALIVE |
| Accepted residency values | Duration string (10m, 24h), seconds (3600), any negative number (-1, -1m) to retain, or 0 to unload after the reply |
| Server-wide residency | OLLAMA_KEEP_ALIVE accepts the same value types |
| Immediate manual unload | ollama stop llama3.2 |
| Preload | Empty request to /api/generate or /api/chat; CLI example ollama run llama3.2 "" |
| Concurrent model cap | OLLAMA_MAX_LOADED_MODELS: default 3 × GPU count, or 3 for CPU inference |
| Per-model parallelism | OLLAMA_NUM_PARALLEL: default 1 |
| Parallel memory scaling | OLLAMA_NUM_PARALLEL × OLLAMA_CONTEXT_LENGTH; context default 4096 tokens |
| Queue cap | OLLAMA_MAX_QUEUE: default 512; guide override example 1024 |
| Queue overflow | HTTP 503, overloaded |
| Inspect loaded models | ollama ps |
For a server-wide override, set the variables in the server environment before startup. For one request, send the residency field alongside its model. This documented preload keeps the model resident:
curl http://localhost:11434/api/generate -d '{"model":"llama3.2","keep_alive":-1}'
Limits and open questions
GPU models must fit completely in VRAM for concurrent loading; queued requests run in order. The FAQ separately says Radeon on Windows defaults to 1 loaded model because of ROCm v5.7 reporting, with ROCm v6.2 named as the transition; treat that as the page’s platform caveat. The example body above targets the local API.
Not for: Ollama Cloud model scheduling or vLLM prefix caching.
Sources
Checked
2026-11-17; read Local FAQ: residency, concurrency and context; no command was run.
Started from a post by @Ollama, packaged by the editor. Original post