32K tokens (about 66 pages of text)
FITS
29.8 GB needed / 36.0 GB usable
Fits on MacBook Pro M4 Max, 48 GB with 6.2 GB to spare.
# macOS or Linux: start Ollama with the context window set to 32K tokens OLLAMA_CONTEXT_LENGTH=32768 ollama serve # Windows PowerShell: same thing $env:OLLAMA_CONTEXT_LENGTH="32768"; ollama serve # Then, in a second terminal, download and chat with the model ollama run qwen2.5:32b # Already chatting? You can also set the window inside the chat: /set parameter num_ctx 32768
Estimates, not guarantees. Real use varies by app, settings and model version. Speed is a rough guide based on memory bandwidth.
Downloading a 32B or 70B model onto a 16 GB or 24 GB machine without accounting for the KV context cache, causing silent swap spill into system RAM and 2 tokens/sec crawl speeds.
Calculating exact model weight GB + layer/KV-head context cache GB + runtime overhead against usable GPU/Mac memory before downloading, and launching Ollama with the exact context flag.
| Memory Component | Exact Sizing Formula | Qwen2.5 32B (Q4_K_M @ 32K) Example | Hardware Fit Rule |
|---|---|---|---|
| Model Weights (GB) | params_billions * bits_per_weight / 8 | 19.9 GB (32.8B * 4.85 / 8) | Q4_K_M (~4.85 bpw) balances quality and VRAM footprint |
| KV Context Cache (GB) | 2 * layers * kv_heads * head_dim * kv_bytes * ctx_tokens / 1e9 | 8.60 GB (64 layers, 8 KV heads, 32K f16) | Scales linearly with context length; halve with q8_0 cache |
| Runtime Overhead (GB) | 0.5 GB + (0.012 GB * ctx_K) + (0.02 * weights_GB) | 1.3 GB | Covers compute buffers, activations, and scratchpad tensors |
| Usable Hardware Memory | GPU: VRAM - 0.5 GB | Mac: 66% (<=36 GB) or 75% (>36 GB) | 36.0 GB usable on 48 GB MacBook Pro M4 Max | Leaves headroom for display server and OS kernel |
Not fully in GPU memory. Llama 3.3 70B at Q4_K_M needs about 43 GB for the weights alone, so plan on two 24 GB cards, a 48 GB card, or a Mac with 64 GB or more of unified memory.
It depends on the model's design. For Llama 3.1 8B, every 1,000 tokens of context takes about 0.13 GB at 16-bit, so a 128K context needs about 17 GB on top of the weights.
By default macOS lets the GPU use roughly two thirds to three quarters of unified memory. You can raise the limit, but leave room for the system and other apps.
Q4_K_M is the usual balance of size and quality. Use Q5_K_M or Q6_K if you have room, and Q8_0 when you want to stay close to the original. Quality drops faster below 4 bits.
Start the server with OLLAMA_CONTEXT_LENGTH set, for example OLLAMA_CONTEXT_LENGTH=32768 ollama serve, or type /set parameter num_ctx 32768 inside a chat.