llama.cpp's V cache quantization silently requires Flash Attention, cutting context in half
A developer building an offline desktop app powered by llama.cpp discovered that enabling V cache quantization requires Flash Attention to be turned on, or the context window is effectively halved without obvious warning. The error surfaces through three different messages at startup, but the root cause — that quantized V cache storage is architecturally incompatible with non-Flash Attention paths — is rarely documented clearly. The developer also found that calculating the KV cache cost per token from model metadata alone can be wrong by a factor of two or more, particularly for architectures like Gemma that interleave attention layers. A reliable fix involves probing llama.cpp at runtime with a small context using the same flags as production, rather than relying on metadata estimates. With correct measurement and matching flags, the same 24 GB machine and model yielded either 8,123 or 16,384 tokens of context depending on whether production settings were accurately reflected.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in