// Error · Run models on your own machine
Ollama truncates long documents and the model “forgets” earlier text
Ollama’s default context length is much smaller than many models support (the default changes between versions). When input exceeds it, earlier content is dropped.
verified 2026-10-101 official sources
Scenario: Run models on your own machine →
🖥️Self-hosted computeSelf-hosted compute: decide → size → build → run, with calculators→Symptoms
- Answers about a long document only cover its last part
- An agent forgets earlier instructions after several turns
Common causes
- The context length (num_ctx) is still the default
How to fix
- Temporarily: in an
ollama runsession type/set parameter num_ctx 16384 - Globally: set the
OLLAMA_CONTEXT_LENGTHenvironment variable before starting the server (newer versions; see the official FAQ) - Via the API: pass
num_ctxin the requestoptions - Or write a Modelfile with
PARAMETER num_ctx 16384andollama createa new model - A larger context uses more memory; size it to your hardware
Official references
Compiled from official documentation and public discussions on 2026-10-10; not yet reproduced in our own environment. Follow the official docs if they differ.