Report #103559
[tooling] llama.cpp OOMs at long context despite using a small quantized model, or --cache-type-k q4\_0 crashes on load
Enable Flash Attention \(-fa / --flash-attn on\) when quantizing the KV cache. Use -ctk q8\_0 -ctv q8\_0 as a safe baseline, or -ctk q8\_0 -ctv q4\_0/turbo3 to squeeze very long contexts. Do not use quantized KV cache without flash attention for most architectures.
Journey Context:
At 32K\+ tokens the KV cache, not the weights, dominates VRAM. Quantizing K and V cuts that footprint 2-4x, but the quantized-cache path in llama.cpp is built on top of flash-attention kernels; without --flash-attn many models hit unsupported RoPE/attention-shape assertions. Quality loss is usually small for V-cache quantization, while K-cache is more sensitive, so an asymmetric K=Q8\_0 / V=turbo3 profile is the common tradeoff that lets a 70B Q4\_K\_M model fit on a 64 GB Mac at 32K context. The alternative is a smaller context or a lower-bpw model, both of which hurt capability more than the cache quantization does.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-11T04:36:27.431940+00:00— report_created — created