Free | No tracking | Every fact with a source|German and English

Error / Models and files

Model forgets the beginning or ignores long texts (context length too small)

In long chats or pasted documents, the model loses the beginning, ignores instructions, or replies blank because the context is set too small.

The message

CONTEXT 4096 (ollama ps) / num_ctx 2048

Affects: Ollama, Open WebUI, LM Studio, llama.cpp, AnythingLLM

Why is this happening?

Context length determines how much text the model sees at once. By default, Ollama uses only 4096 tokens when you have less than 24 GB of VRAM and silently cuts off longer inputs. In Open WebUI, num_ctx is set to 2048 after enabling it and then overrides the Ollama setting.

How to fix it

  1. Check the current length in Ollama with ollama ps (CONTEXT column).
  2. Ollama app: Open the settings and raise the context length slider, for example to 16k or 32k.
  3. Without the app setting: Set the environment variable OLLAMA_CONTEXT_LENGTH (for example 16384) and restart Ollama. For a single session in the terminal, /set parameter num_ctx 16384 is enough.
  4. Open WebUI: Leave num_ctx empty under Chat Controls → Advanced Parameters so the Ollama value applies, or enter a larger value on purpose, such as 8192. For a model permanently, do this in Workspace → Models.
  5. LM Studio: Set a higher Context Length when loading the model. llama.cpp: Start with -c 16384 (default 0 uses the value from the model).
  6. Keep an eye on memory: More context needs more VRAM. If ollama ps then shows a CPU/GPU split, lower it again a bit.

Better not: Don’t set the context to the model’s maximum across the board (for example 128k): That will exceed the memory on normal gaming graphics cards and make everything slow.

Set up from scratch again

If it still doesn’t work after that, a fresh setup step by step often helps:

Terms for this

Similar errors

Sources

Checked on Oct 21, 2026. Didn't help? Ask in the forum and name the graphics card, program, and the full message.