
Local AI
Out of memory at long context? Shrink the KV cache with q8_0 in llama.cpp or Ollama
The model fits. Then you paste in a long document and the GPU runs out of memory. The culprit is the KV cache, it has a formula you can do on a napkin, and two settings cut it by roughly half or three quarters.
Ari Vale · · 9 min