A bigger context needs extra memory
Increasing Ollama's context can push a model that used to work beyond your available memory. The runtime needs space for the weights, working buffers and context cache. Other loaded models and parallel requests add to that load.
Check the running context, free up unused models, then try a smaller window with one short request.
1. Check the loaded model
Use your existing Ollama installation and a downloaded local model. If you are unsure where it runs, follow the local-or-cloud check.
In a terminal, run:
ollama --version
ollama ls
ollama ps
Note the exact model tag, version and error. In ollama ps, read CONTEXT for the allocation and PROCESSOR for CPU, GPU or split placement. That percentage describes placement, rather than live GPU utilisation. The context guide explains both columns. If loading failed, keep the error and server log instead.
2. Find the context setting
Check your chat app's context slider, OLLAMA_CONTEXT_LENGTH, the model's Modelfile and any client overrides. An API request can use options.num_ctx; an interactive session can use /set parameter num_ctx 4096. See the FAQ.
Use the running allocation as your reference because defaults vary by version and interface. A client override can replace the server default. Environment changes need to reach the server process, with a restart where required.
Also separate context from answer length: num_ctx controls the window, while num_predict limits generated tokens. Asking for fewer words does not reduce a large context allocation. The Modelfile reference covers these parameters.
3. Free up unused models
Pause your own chat apps and background requests. For an unused model you recognise, substitute its exact tag:
ollama stop UNUSED_MODEL_TAG
ollama ps
Check it disappears from the running list. This unloads the model while keeping its downloaded files. On a shared server, leave other people's active models alone.
Parallel requests also increase context memory. If you raised OLLAMA_NUM_PARALLEL, check that setting before restoring a concurrent workload. Ollama's concurrency guidance explains the trade-off.
4. Try a separate smaller-context profile
Use your exact local tag from ollama ls. In a text editor, save the following as Modelfile.context-check, without an extra .txt suffix:
FROM YOUR_MODEL_TAG
PARAMETER num_ctx 4096
PARAMETER num_predict 64
The 4096-token window is a diagnostic starting point. Use a smaller previously working value if you have one, within the model's supported limits. The 64-token output cap keeps the question short.
Choose another profile name if context-check already exists, then run these commands from the file's folder:
ollama create context-check -f ./Modelfile.context-check
ollama show --modelfile context-check
ollama run context-check "Explain RAM in one sentence."
ollama ps
Check the displayed parameters, the answer and the running CONTEXT. If a download starts unexpectedly, cancel and recheck the base-model tag. The Modelfile instructions explain deriving a configuration from existing weights.
Keep the same prompt while changing only context. In your usual chat app, start a fresh conversation, select the new profile and remove any larger override. Check the allocation there too.
5. Save the settings that work
After a successful request, keep your Modelfile and save these records:
ollama ps > context-check-running.txt
ollama show --modelfile context-check > context-check-export.Modelfile
Open both files and keep the model ID, version, hardware and errors beside them. Exported model paths can be specific to your installation; the CLI source covers these commands.
If the smaller window works, supply only the relevant material and keep your full document or chat separately. If it still fails, check server logs and hardware support.
For advanced tuning, weight quantisation and K/V-cache quantisation are separate choices; read the cache guidance first. A supported smaller model is another option. Compare its answers on your actual task before buying hardware or switching to hosting.
Sources
Primary references checked 12 October 2026.