Solution:
Root Cause: VRAM Capacity Exceeded / CPU Layer Fallback
When an Ollama model exceeds your GPU's dedicated Video RAM (VRAM), llama.cpp automatically offloads surplus model layers to system RAM and processing to CPU. Because system RAM bandwidth is significantly slower than VRAM, token generation speed degrades dramatically.
Step-by-Step Fix:
1Check GPU Memory Allocation During Inference:
Open Terminal or PowerShell while Ollama is generating text.Run nvidia-smi (for NVIDIA GPUs) or rocm-smi (for AMD GPUs) to inspect VRAM usage.Execute ollama ps in a separate terminal window to view the GPU/CPU offload ratio (e.g., 100% GPU vs 70%/30% CPU/GPU).2Switch to a Lower Quantization or Smaller Parameter Model:
If offloading shows partial CPU usage, download a higher-quantized or smaller parameter variant (e.g., switch from llama3:8b-instruct-q8_0 to llama3:8b-instruct-q4_K_M).Command: ollama run llama3:8b-instruct-q4_K_M3Update GPU Drivers & CUDA Toolkit:
Verify that your GPU drivers support the latest CUDA runtime by installing updates directly from the NVIDIA Official Driver Downloads page.4Force Full VRAM Offload via Environment Variables:
Set OLLAMA_NUM_PARALLEL=1 to prevent multiple concurrent requests from splitting available VRAM across session instances.