The wait before the first word appears is the most noticeable delay in a chat. In Ollama it usually comes from one of three places: the model is not loaded yet, the prompt is very long, or the model is partly on the CPU. This guide measures the delay, then fixes the most likely cause first.
Before you start
- Ollama installed and running, with a model already pulled.
- A terminal, and a prompt you can repeat for timing.
- A way to time the request, such as curl with a timer or a stopwatch.
Time the first token now
Send a prompt and note how long the first token takes. Do it twice: once right after loading the model, and once after ten idle minutes. If the second run is much slower, the model was unloaded in between, and the keep-alive is the fix.
Keep the model warm
Set a longer keep-alive so the model stays loaded:
OLLAMA_KEEP_ALIVE=24h ollama serve
Restart Ollama for the change to take effect, then repeat the timing test. The idle run should now match the warm run.
Trim the prompt if it is still slow
If the first token is still slow while the model is loaded, shorten the prompt: remove pasted documents the model does not need, and keep the system prompt short. A shorter prompt means less work before the first token. Also check ollama ps to see whether the model is fully on the GPU or partly on the CPU.
Worked example
Worked example: with qwen3:8b, send the prompt “List three uses for a lemon.” right after loading, then again after ten idle minutes. With the default keep-alive the second run may take 8 seconds to the first token while the model reloads; with a 24-hour keep-alive both runs should take about 1 second.
Expected result
UNTESTED in this guide: no server was restarted while writing it. The expected result is that the first token arrives in about the same time on a warm and an idle run after the keep-alive change.
Limitations
First-token time also depends on the machine: a CPU-only run is slower than a GPU run, and a very long context is slower than a short one. Measure before and after each change so you know which one helped.
