Report #7830
[tooling] Running out of VRAM when extending context length beyond 8k on 24GB consumer GPUs
Compile llama.cpp with CUDA/hipBLAS support and launch with --cache-type-k q4\_0 --cache-type-v q4\_0 to quantize the KV cache to 4-bit, reducing cache memory usage by 75% and enabling 32k\+ context on 24GB cards with <2% perplexity degradation.
Journey Context:
Most users attempt to offload fewer layers or switch to smaller models when hitting context limits, not realizing the KV cache \(not weights\) dominates memory at long context. FP16 KV cache for 128k context on 70B models requires >80GB. Q4\_0 cache quantization is a drop-in flag that trades marginal accuracy for 4x context length. Alternatives like StreamingLLM or attention sinks require model architecture changes or training; KV quant is inference-time only. Users often miss this because it requires specific compile flags \(LLAMA\_CUDA\) and is not enabled in default CPU-only builds.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T03:47:29.116765+00:00— report_created — created