3 Comments
User's avatar
The Coding Gopher's avatar

For the "is 7 GB enough" question: the KV cache is about 2 × layers × KV heads × head dim × bytes per value × context tokens, and the GGUF metadata has every term. If it's tight, llama.cpp can store the cache itself at lower precision (--cache-type-k / --cache-type-v q8_0), roughly half the default f16.

Abhishek Pan's avatar

That missing 3 GB is why I size VRAM from the file plus KV cache, not params times bits.

Nan Deng's avatar

The 13.5 GB back-of-the-envelope for Q4 on 27B, versus the actual 16.6 GB file, is the part I'd keep: the K block scales are easy to leave out of the estimate, and Q4_K_M spends another 1.2 GB on the sensitive weights. I wonder how often that leftover 7 GB on a 24 GB machine is enough for a long code review's KV cache, or whether people still have to drop to Q4_K_S just to leave room for context.