Ollama Slow Generation (1-2 tok/s)? CPU Offload Troubleshooting & Fix
How to Keep 100% of LLM Layers in Fast GPU VRAM
Need Full Context Now? Burst to an 80GB Cloud GPU or Add Samsung 990 PRO 2TB NVMe SSD
Spin up an on-demand 80GB A100/H100 cloud pod to run unquantized long context immediately, or upgrade your local rig with Samsung 990 PRO 2TB PCIe 4.0 NVMe SSD โ 7,450 MB/s GGUF Weight & Offload Cache: Eliminates slow SATA and OS-partition disk bottlenecks when Ollama unloads and reloads 19GB-40GB Q4_K_M coding and reasoning GGUF models between OLLAMA_KEEP_ALIVE windows.
๐งฎ Root Cause & Mathematical Reality
If a model's weights plus context buffer exceed GPU VRAM by even 500MB, Ollama automatically spills layers into system RAM. System DDR5 RAM bandwidth (~60 GB/s) is 16x slower than GPU VRAM (~1,000 GB/s), causing token speeds to collapse from 35 tok/s to 1.5 tok/s.
- GPU GDDR6X bandwidth is ~1,008 GB/s; dual-channel DDR5 system RAM is only ~60โ80 GB/s.
- Offloading just 4 out of 64 transformer layers to CPU bottlenecks the entire pipeline to system bus speeds.
- Ollama defaults to running multiple parallel request slots unless OLLAMA_NUM_PARALLEL=1 is specified.
๐ ๏ธ Actionable Fix & Tuning Steps
- Check Ollama server logs: Look for 'offloaded X/Y layers to GPU'. If X < Y, CPU offload is active.
- Reduce context size in Modelfile or CLI: Set 'num_ctx 8192' instead of 32768 or 65536.
- Force single-stream allocation: Set environment variable 'OLLAMA_NUM_PARALLEL=1'.
- Enable FlashAttention: Set environment variable 'OLLAMA_FLASH_ATTENTION=1'.
- Switch to a slightly smaller quantization: Use Q4_K_S or Q3_K_M instead of Q5_K_M or Q8_0.
โ๏ธ The 3-Tier Honesty Funnel
Set OLLAMA_FLASH_ATTENTION=1, OLLAMA_KV_CACHE_TYPE=q8_0, and OLLAMA_NUM_PARALLEL=1 while clamping Modelfile PARAMETER num_ctx 8192 (or 16384) so ollama ps reports 100% GPU residency at 35-45 tok/s.
Samsung 990 PRO 2TB PCIe 4.0 NVMe SSD โ 7,450 MB/s GGUF Weight & Offload Cache
Eliminates slow SATA and OS-partition disk bottlenecks when Ollama unloads and reloads 19GB-40GB Q4_K_M coding and reasoning GGUF models between OLLAMA_KEEP_ALIVE windows.
When weights or 128k context physically exceed local VRAM, rent an 80GB A100/H100 pod by the hour with zero hardware depreciation.
โ Frequently Asked Questions
How can I tell if Ollama is using my GPU?
Run 'ollama ps' while generating text. It will display the model name, size, and the percentage loaded in VRAM (e.g. '100% GPU').
Why does Ollama use so much RAM on Apple Silicon Macs?
Apple Silicon uses unified memory shared between CPU and GPU. macOS allocates up to ~75% of total system RAM to Metal by default.
Explore the Full OOM Troubleshooting Hub
Master VRAM requirements for LLaMA 3.3 70B, DeepSeek V3, Qwen 2.5, and vLLM concurrency.
View All 12 GPU & VRAM Fixers →