Report #103912
[tooling] llama.cpp runs out of VRAM or slows to a crawl above 32K context
Build with -DGGML\_CUDA\_FA\_ALL\_QUANTS=ON and run llama-server with --flash-attn on --cache-type-k q8\_0 --cache-type-v q8\_0. For maximum context length at acceptable quality loss, use q4\_0; avoid asymmetric types like q4\_1/iq4\_nl if you need GPU offload \(they may fall back to CPU\).
Journey Context:
At long context, the KV cache dominates VRAM. Flash Attention avoids materializing the full N×N attention matrix and enables quantized KV caches on GPU. The gotchas: \(1\) you must build with GGML\_CUDA\_FA\_ALL\_QUANTS=ON for all quant types; \(2\) V-cache quantization requires flash-attn; \(3\) asymmetric KV types have limited GPU kernel support and can silently run on CPU, negating the speedup. q8\_0 is the safest quality/speed compromise; q4\_0 roughly halves KV memory but can slightly degrade long-context retrieval. The prompt-processing speedup from FA is often larger than the generation speedup.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-13T04:54:55.142699+00:00— report_created — created