By default, Ollama keeps a model in memory for five minutes after your last request, then unloads it. That's a sensible middle ground, but it's wrong for two common setups: an always-on assistant where you don't want to wait for the model to reload, and a gaming PC where you want your VRAM back the moment you finish chatting. This guide follows Ollama's own documentation; Forge PC hasn't measured load times on any particular system, because they depend on the model size, your drive and your GPU.
Step 1: See what's loaded
Open a terminal (Command Prompt, PowerShell or Terminal) and run:
ollama ps
Ollama lists every loaded model with its size, a PROCESSOR column and an UNTIL column. According to Ollama's FAQ, "100% GPU" means the model is entirely in VRAM, "100% CPU" means it's entirely in system RAM, and a split such as "48%/52% CPU/GPU" means it's spread across both. UNTIL shows when it will be unloaded.
If a model you expected on the GPU shows a CPU share, it doesn't fit in VRAM. Our guides to checking VRAM usage in Windows and setting Ollama's context length help you work out why.
Step 2: Unload a model straight away
To free memory immediately, for example before launching a game:
ollama stop llama3.2
Replace llama3.2 with the model name shown by ollama ps. If you use the API instead, Ollama's FAQ says you can send a request with keep_alive set to 0:
curl http://localhost:11434/api/generate -d '{"model": "llama3.2", "keep_alive": 0}'
Step 3: Keep a model loaded for longer (or forever)
The keep_alive parameter on the /api/generate and /api/chat endpoints accepts:
Value | Effect |
|---|
A duration such as "10m" or "24h" | Keep the model loaded for that long after the request |
A number of seconds, such as 3600 | Same, in seconds |
Any negative number, such as -1 | Keep the model loaded indefinitely |
0
| Unload as soon as the response is finished |
To preload a model and keep it in memory:
curl http://localhost:11434/api/generate -d '{"model": "llama3.2", "keep_alive": -1}'
The FAQ also shows a CLI way to preload a model: ollama run llama3.2 "".
Step 4: Change the default for every model
To change the five-minute default for all models, set the OLLAMA_KEEP_ALIVE environment variable. It takes the same values as keep_alive. On Windows, Ollama's instructions are:
Quit Ollama from its icon in the taskbar.
Open Settings (Windows 11) and search for environment variables.
Select Edit environment variables for your account.
Create a new variable called OLLAMA_KEEP_ALIVE with a value such as 30m or -1.
Click OK, then start Ollama again from the Start menu.
On Linux, where Ollama runs as a systemd service, use systemctl edit ollama.service to add the variable, then reload and restart the service. Note that a keep_alive value sent with an API request overrides OLLAMA_KEEP_ALIVE, so apps that send their own value (Home Assistant's Ollama integration has its own Keep alive setting, for example) will ignore your default.
Step 5: Control how many models stay loaded
If you switch between models, Ollama can keep several in memory if they fit. The FAQ says OLLAMA_MAX_LOADED_MODELS sets the maximum number loaded at once, defaulting to three per GPU (or three for CPU inference). When there isn't enough memory for a new model, Ollama queues the request and unloads idle models to make room. On a single 8GB to 16GB card, setting OLLAMA_MAX_LOADED_MODELS=1 keeps behaviour predictable.
Which setting should you use?
Gaming PC that also runs Ollama: leave the default, or set OLLAMA_KEEP_ALIVE=0, and run ollama stop before you play.
Dedicated AI box or home server: set OLLAMA_KEEP_ALIVE=-1 so your assistant always answers quickly. If other devices use it, see how to share Ollama on your local network and how to use Ollama with Home Assistant.
Several models in rotation: use a longer duration like 30m and cap OLLAMA_MAX_LOADED_MODELS.
For more tuning, see how to speed up a local LLM in Ollama and how to manage Ollama models.
Our verdict
Use ollama ps to see what's in memory, ollama stop to free VRAM instantly, and OLLAMA_KEEP_ALIVE to change the five-minute default: -1 for an always-ready assistant, 0 or the default for a PC you also game on.