Six weeks of inference on the CPU
Local models on the homelab were slow enough that I'd stopped using them. I had an explanation ready: the GPU has 2 GB of memory, the models want more, so of course it's slow. That explanation was comfortable, it was plausible, and it was wrong for six weeks.
What actually happened is that the Compose service for the inference container never declared runtime: nvidia. The Docker daemon had the NVIDIA runtime registered, and I'd verified that, so I assumed containers could use it. They can't. Registering the runtime on the daemon is necessary but not sufficient; each service has to ask for it. The container had never seen the GPU at all.
- symptom
- Local models painfully slow. Assumed the 2 GB GPU was the limit.
- cause
- No
runtime: nvidiaon the service. The container ran on CPU for six weeks. - fix
- Add the runtime plus
NVIDIA_VISIBLE_DEVICESandNVIDIA_DRIVER_CAPABILITIES. Prompt evaluation went from 77 tokens/s to 730–870. - rule
- Before blaming hardware, prove the container can see it:
docker exec <container> nvidia-smi. Ten seconds.
The lesson isn't about NVIDIA. It's that a plausible explanation stopped me from running a ten-second check. The thing I'd "verified" was one layer above the thing that mattered. Now, when something is slow, the first question is whether the component can see the resource I think it's using, and the answer has to come from inside the component.