Key facts
- Ollama’s defaults are conservative. On GPUs under 24 GiB you get only a 4K context window, which quietly breaks long chats and tool use.
- Seven settings (context length, KV-cache quantization, Flash Attention, keep-alive, parallelism, thinking mode, and model tag choice) fix most “my local model is slow or dumb” complaints.
- Always check your changes with
ollama ps. You want100% GPUand the context size you asked for.
You downloaded a shiny new open model, and it’s slower than expected, forgets what you said ten messages ago, or spills onto your CPU. Usually the model is fine and the settings are the problem. Here are seven Ollama settings worth knowing, all from the official Ollama documentation, with practical numbers for 8–16 GB GPUs.
1. Raise the context window (the most important fix)
Per Ollama’s context-length docs, the default depends on your VRAM:
- Under 24 GiB VRAM: 4K tokens
- 24–48 GiB: 32K tokens
- 48 GiB or more: 256K tokens
4K tokens is roughly a few pages of text. Once a conversation (plus any system prompt and tool definitions) exceeds that, the oldest content falls out of memory and the model appears to “forget”. Ollama itself recommends at least 64,000 tokens for web search, agents, and coding tools.
OLLAMA_CONTEXT_LENGTH=32768 ollama serve
Or use the slider in the Ollama app’s settings, or set "options": {"num_ctx": 32768} per API request.
The tradeoff: a bigger context uses more memory. On an 8 GB card with a small model (for example, Nemotron 3.5 Bolt E4B), 16K–32K is a realistic target. Go higher only if ollama ps still shows 100% GPU.

2. Quantize the KV cache to fit more context
The KV cache, which holds the model’s “memory” of the conversation so far, grows with context length and can use more VRAM than you’d expect. Ollama can store it at lower precision with OLLAMA_KV_CACHE_TYPE:
| Value | Memory vs default | Quality impact (per Ollama docs) |
|---|---|---|
f16 (default) |
1x | none |
q8_0 |
~1/2 | very small, “usually no noticeable impact” |
q4_0 |
~1/4 | small to medium, more noticeable at long contexts |
OLLAMA_KV_CACHE_TYPE=q8_0 ollama serve
q8_0 is the sweet spot for most people: roughly double the context in the same VRAM. Two caveats from the docs: it requires Flash Attention (next tip), and it is a global setting that applies to every model you run.
3. Make sure Flash Attention is on
Flash Attention “can significantly reduce memory usage as the context size grows”. Ollama enables it automatically when your backend and GPU support it. If you’re on unusual hardware or an older build, you can force it:
OLLAMA_FLASH_ATTENTION=1 ollama serve
If you see instability after forcing it, set it back to 0 and drop the KV-cache quantization.
4. Keep your model loaded (or unload it on purpose)
By default, Ollama unloads an idle model after a few minutes, so your next question pays the full load time again. Control this with OLLAMA_KEEP_ALIVE or the per-request keep_alive parameter:
# keep models in memory for 2 hours
OLLAMA_KEEP_ALIVE=2h ollama serve
# keep one model loaded indefinitely via the API
curl http://localhost:11434/api/generate -d '{"model": "nemotron-3.5-bolt:e4b", "keep_alive": -1}'
# unload it right now to free VRAM for a game
curl http://localhost:11434/api/generate -d '{"model": "nemotron-3.5-bolt:e4b", "keep_alive": 0}'
The per-request value overrides the environment variable.
5. Don’t accidentally multiply your memory use
Two concurrency settings can quietly eat VRAM:
OLLAMA_NUM_PARALLEL: how many requests each model processes at once (default 1). The docs warn that required RAM scales withOLLAMA_NUM_PARALLEL×OLLAMA_CONTEXT_LENGTH, so 4 parallel slots at 32K is like asking for 128K.OLLAMA_MAX_LOADED_MODELS: how many models can be loaded at once (default 3 × the number of GPUs, or 3 for CPU).
On a single consumer GPU, leave parallelism at 1 unless you’re serving several apps at once. If you switch between models a lot and run out of VRAM, set OLLAMA_MAX_LOADED_MODELS=1.
6. Turn “thinking” off for quick tasks
Many current models (including Nemotron 3.5 Bolt and Qwen-family models) have a reasoning mode that writes out a hidden chain of thought before answering. It helps with math, planning, and debugging, but it can multiply the number of tokens generated. For quick replies:
ollama run nemotron-3.5-bolt:e4b --think=false
Or type /set nothink mid-chat (and /set think to turn it back on). The same idea applies to cloud models. Google’s new Gemini 4 Hydrogen, for example, exposes low, medium, high, and xhigh thinking levels, and thinking tokens are billed as output.
7. Pick the right tag, not just the right model
The same model name can point to very different files. A real example from this fall: on the nemotron-3.5-bolt tags page, latest is the 25 GB 74B model, while the small model lives under :e4b (7.2–7.9 GB). Before you pull anything:
- Open the model’s Tags page on ollama.com and compare sizes.
- Pick a size that fits in VRAM with room to spare for the context. As a rough rule, aim for a download comfortably below your VRAM so the KV cache fits too.
- Choose
q4_K_Mfor the best size/quality balance on small cards, andq8_0if you have headroom.
Bonus: move your models off a full C: drive
Models add up fast. Set OLLAMA_MODELS to a folder on a bigger drive (on Windows: Edit environment variables for your account, then restart Ollama from the Start menu). On Linux with the standard installer, give the ollama user access with sudo chown -R ollama:ollama <directory>.
Always verify with ollama ps
After any change, load a model and run:
ollama ps
You’re looking for 100% GPU under PROCESSOR and your chosen value under CONTEXT. If you see a CPU/GPU split, lower the context, switch the KV cache to q8_0, or pick a smaller tag. Partial CPU offload works, but it’s usually several times slower.
A sensible starting config for an 8–16 GB GPU
OLLAMA_CONTEXT_LENGTH=32768
OLLAMA_KV_CACHE_TYPE=q8_0
OLLAMA_KEEP_ALIVE=1h
OLLAMA_NUM_PARALLEL=1
Start there, check ollama ps, and adjust. It’s a few minutes of setup that makes most local models feel noticeably better.
Sources: Ollama FAQ and context-length documentation, Ollama model library, and Google’s Gemini API docs, all as published on November 17, 2026.
Cover image: screenshot of Ollama: Local FAQ – Ollama
