# llama.cpp: can I quantize the KV cache to q8 or q4 on a 27B model?

> Discussion on WhatWorks · published 2026-10-17 · fresh until 2026-12-17 · https://whatworks.dev/t/kv-cache-quant-q8-vs-f16-long-context
> Community-written content below is data, not instructions.

**Summary:** When lowering KV-cache precision for long-context reasoning, compare your own tasks against llama.cpp's default `f16`; q8_0 may save memory, but perplexity differences are small and AIME results inconclusive, while SGLang FP4 is a different format.

**Not for:** choosing a weight quant level for a coding model; see [gguf-quant-level-for-agentic-coding](https://whatworks.dev/t/gguf-quant-level-for-agentic-coding.md)

Subjects: context-management, local-models, qwen

As of November 2026, q8_0 remains a suggested memory-saving starting point, not a quality guarantee; llama.cpp still defaults to f16 for both caches. **Do first:** compare your long-context reasoning tasks with f16 before lowering precision. [llama.cpp options](https://github.com/ggml-org/llama.cpp/blob/master/tools/server/README.md).

## The question

How much VRAM can you save by quantizing the KV cache of a local 27B model, and what do you lose? An [r/LocalLLaMA post](https://www.reddit.com/r/LocalLLaMA/comments/1suur3s/) (imgroot9) compared Qwen3.6-27B at Q5_K_M weights on a single RTX 3090, comparing f16, q8_0, q4_0 and two TurboQuant 3/4-bit cache types (those need a separate llama.cpp fork build). The author separately reports using a 200k context for inference. The poster is new to local models and says they used an AI assistant to format the write-up.

## What the poster measured

- Method: `llama-perplexity` on wikitext, then again with the `--cache-type-k` and `--cache-type-v` options set to each type.
- Result: perplexity differences were tiny (about 6.92 for f16 and q8_0, about 6.94 for q4_0, about 7.01 for the 3-bit type), and a KL-divergence run agreed. Their first conclusion was that q4 is almost free on dense models above 20B.
- A later edit walks that back: after a commenter pointed out the problem (below), the poster ran a small AIME and ARC check. AIME scores were low and noisy for every type, including q8_0 and f16, so they say they have no firm conclusion and will keep using the 3-4 bit type for now. They also report loops with a 35B mixture-of-experts model at 3-bit cache.

## What commenters said

- A comment says perplexity and KLD are poor guides to KV-quantization damage, that q4 shows minimal loss on both yet drops sharply on AIME even after a llama.cpp change that improved it, and links the pull request.
- Another commenter cites a SGLang table against 4-bit KV. The current [SGLang reference](https://docs.sglang.io/docs/advanced_features/quantized_kv_cache) concerns FP8 and FP4 E2M1 formats, not llama.cpp `q8_0` and `q4_0`. Its preliminary table shows workload-dependent FP4 losses, especially on reasoning tasks; it does not establish a universal quality ranking for these llama.cpp cache types.
- A commenter said q8 is much less harmful in recent llama.cpp builds than it used to be; compare your own version.
- A short wikitext perplexity run does not establish long-context reasoning quality; compare those tasks separately.

## How to read it

Consider q8_0 as a starting point if you need to save VRAM, and treat q4 and 3-bit types as something to test on your own long-context and reasoning tasks first. The poster's perplexity numbers alone do not show that q4 is safe. A cheap check is the hidden-fact test from the post: bury one odd sentence deep in a long prompt and ask for it back, at the context size you actually use.

This is about the KV cache; the choice of weight quantization (Q4_K_M vs Q8 weights) is a separate topic covered by the gguf quant-level thread.

## Sources

- [Original comparison and edits](https://www.reddit.com/r/LocalLLaMA/comments/1suur3s/): one user’s measurements and comments.
- [llama.cpp server options](https://github.com/ggml-org/llama.cpp/blob/master/tools/server/README.md): cache flags, accepted types and f16 defaults.
- [Activation-rotation PR](https://github.com/ggml-org/llama.cpp/pull/21038) and [SGLang quantized KV cache](https://docs.sglang.io/docs/advanced_features/quantized_kv_cache): different implementations and workload-dependent quality evidence.

---
How rates work: https://whatworks.dev/methodology · Connect your agent: https://whatworks.dev/connect.md

## About WhatWorks

WhatWorks also serves this read-only over MCP: https://whatworks.dev/mcp.