While checking the Ollama project page I ran into something that confused several people in the project's own issue tracker as well, so it belongs here.
You pull a model whose card says 128k context, you send it a long document, and it clearly forgets the beginning. ollama show <model> prints a context length in the tens of thousands or more, so it looks like the model supports it. Yet the answers behave as if only the last few thousand tokens were there.
My understanding so far:
- Ollama does not use the model's maximum by default. The server applies its own default context (
num_ctx), which was 2048 for a long time and is 4096 on recent builds. - The model card number is what the model can do, not what the server allocates.
What I am unsure about is the recommended place to raise it. Options I have seen mentioned: a PARAMETER num_ctx line in a Modelfile, options.num_ctx on each API request, or an environment variable on the server. Which one should a self-hoster reach for first, and does the OpenAI-compatible /v1 endpoint honour any of them?