Modern open-weight models often advertise context windows of 32,768, 65,536 or 128,000 tokens in their model cards, but the runtime does not automatically configure that full length. Ollama, for example, sets its default from available VRAM, and its own documentation carries different defaults on different pages. The only number that matters is the one your running server actually uses, so check it there.
Prerequisites
- The model’s advertised context window, from its model card or library page.
- The runtime you use, such as Ollama, and its documentation.
- A way to read the running context length, such as ollama ps.
Steps
Step 1: Read the model card
Read the advertised context window from the model card. For example, Llama 3.1 8B is listed with a 128k context window on the Ollama model library. Write the number down.
Step 2: Read the runtime default
Read the runtime’s default for your hardware. Ollama’s current rule picks from VRAM: 4,096 tokens below 24 GiB, 32,768 from 24 to 48 GiB, and 262,144 at 48 GiB or more. Note that Ollama’s FAQ still says 4096 and its Modelfile reference says 2048, so the pages disagree.
Step 3: Check the running value
Run the command that shows the running value, such as ollama ps, and read the CONTEXT column. That number, not a doc page, is the window that actually loaded. If it is smaller than the advertised window, set it explicitly.
Worked example: Cedar Street Library Llama 3.1 8B check
The fictional Cedar Street Library runs Llama 3.1 8B on a machine with less than 24 GiB of VRAM.
| Source | Context window stated | Trust it |
|---|---|---|
| Model card | 128,000 tokens | Advertised maximum |
| Ollama docs, VRAM tiers | 4,096 tokens under 24 GiB | Current rule |
| Ollama FAQ | 4,096 tokens | Older text, same number here |
| ollama ps CONTEXT column | 4,096 tokens | Yes: the running value |
The model advertises 128,000 tokens, but the running value is 4,096 tokens, so a long document would be cut unless num_ctx is set explicitly.
Expected result. You can state the advertised window, the runtime default and the running value, and they are not assumed to be the same. UNTESTED: this guide was not run against a live model or API. The worked example below is fictional practice material, and its result is the expected result, not a measured one.
Limits
- The VRAM tiers are Ollama’s current rule; other runtimes have their own defaults.
- A larger window needs more memory for the KV cache; setting it without the memory to back it will fail.
- This guide does not cover setting num_ctx; that is a separate guide.
