In the Ollama app on a Mac, open its settings and move the context length slider; from a terminal, start the server with OLLAMA_CONTEXT_LENGTH=64000 ollama serve. Then run ollama ps, whose CONTEXT column shows what each loaded model actually got. Do not trust a remembered default: Ollama's own pages give two, 4096 tokens in its FAQ and 4k, 32k or 256k by VRAM on its context page, and the Hermes Agent guide quotes a third, 2048. Ollama says tasks that need a large context, such as web search, agents and coding tools, should be set to at least 64000 tokens, and that a larger context length needs more memory, so read the PROCESSOR column of ollama ps too. This page repeats Ollama's documents and measured nothing on a Mac.
| Document | What it says about the default |
|---|---|
| Ollama, Context length | Defaults by VRAM: under 24 GiB, 4k; 24 to 48 GiB, 32k; 48 GiB or more, 256k. |
| Ollama, Local FAQ | By default, Ollama uses a context window size of 4096 tokens. |
| Hermes Agent, guide to running it with Ollama | By default, Ollama uses a 2048-token context. |
The context page is written in VRAM and does not say how it counts a Mac's unified memory. Which default your Mac gets is therefore not something this page can tell you; the check below shows it.
OLLAMA_CONTEXT_LENGTH=64000 ollama serve
launchctl setenv and restart the Ollama application. For this variable that reads as below; this page did not test it, and the slider above is the route Ollama's page puts first.launchctl setenv OLLAMA_CONTEXT_LENGTH 64000
ollama run. The FAQ gives /set parameter num_ctx 4096; use your own value.num_ctx inside options, as in the request below.curl http://localhost:11434/api/generate -d '{
"model": "llama3.2",
"prompt": "Why is the sky blue?",
"options": {
"num_ctx": 4096
}
}'
Ollama's context page says to verify the split under PROCESSOR with ollama ps, and its example output adds a CONTEXT column:
NAME ID SIZE PROCESSOR CONTEXT UNTIL
gemma4:latest c6eb396dbd59 9.6 GB 100% GPU 131072 2 minutes from now
The page's advice is to use the maximum context length for a model and avoid offloading the model to the CPU. Is Ollama using my Mac's GPU? explains the PROCESSOR column.
OLLAMA_NUM_PARALLEL defaults to 1 and that required RAM scales by OLLAMA_NUM_PARALLEL times OLLAMA_CONTEXT_LENGTH.The FAQ says Flash Attention can significantly reduce memory use as the context grows, that Ollama uses it automatically when the backend and devices support it, and that OLLAMA_FLASH_ATTENTION=1 forces it on and =0 turns it off. It does not say which Macs support it, so this page cannot say whether yours does. It also says the K/V cache can be quantized to reduce memory when Flash Attention is enabled, with OLLAMA_KV_CACHE_TYPE, a global setting for all models:
OLLAMA_KV_CACHE_TYPE | What the FAQ says |
|---|---|
| f16 | High precision and memory use; the default. |
| q8_0 | 8-bit; approximately 1/2 the memory of f16 with a very small loss in precision, usually no noticeable impact on quality; recommended if you are not using f16. |
| q4_0 | 4-bit; approximately 1/4 the memory of f16 with a small to medium loss in precision that may be more noticeable at higher context sizes. |
The FAQ adds that the effect on quality depends on the model and the task, and that models with a high GQA count, Qwen2 for example, may see a larger effect. Homebrew's Ollama service sets q8_0 and Flash Attention for you: see brew install ollama on a Mac.
Ollama's context page says tasks that need a large context, such as web search, agents and coding tools, should be set to at least 64000 tokens. Hermes Agent's guides ask for the same minimum: Hermes Agent on a Mac. For coding agents see Coding agent with a local model on a Mac.
| Claim | Source |
|---|---|
The defaults by VRAM, the slider, OLLAMA_CONTEXT_LENGTH, ollama ps with a CONTEXT column, at least 64000 tokens, more memory, cloud models at their maximum | Ollama docs, Context length |
4096 tokens, /set parameter num_ctx, the API num_ctx, launchctl setenv, parallel requests, Flash Attention, the K/V cache types | Ollama docs, Local FAQ |
| 2048 tokens, and 64,000 tokens required | Hermes Agent guide: Run Hermes Locally with Ollama |
| The service sets Flash Attention and q8_0 | Homebrew, formula ollama |
ollama ps to read what a model got.OLLAMA_CONTEXT_LENGTH set, for example OLLAMA_CONTEXT_LENGTH=64000 ollama serve.ollama ps: Ollama's context page shows a CONTEXT column beside PROCESSOR, which says whether the model runs on the GPU, the CPU or both.