Model runs on CPU instead of the GPU
Symptom
Very slow generation (a few tokens/s on a big GPU); GPU utilization stays near 0%.
Likely causes
- llama.cpp built without a GPU backend
- -ngl is 0 (default for some builds)
- Model too large and Ollama silently spilled to CPU
- Driver or CUDA runtime mismatch
How to fix it
- Run
ollama psand check the PROCESSOR column (it should read 100% GPU). - For llama.cpp, confirm startup logs say layers were offloaded (
offloaded N/N layers to GPU). - Pass -ngl 99 and rebuild with -DGGML_CUDA=ON (NVIDIA) or use the Metal build on macOS.
- Update GPU drivers; verify with nvidia-smi.
- If memory is the cause, use a smaller quant or context.
bash
ollama ps
llama-cli -m model.gguf -ngl 99 -p "hi" 2>&1 | grep -i offloadStill stuck? Check the lessons or measure first with the benchmark lab.