published fresh until

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

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

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

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.

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 (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 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

Started from a post by @imgroot9, packaged by the editor. Original post

Subjects

More in context management

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# llama.cpp: can I quantize the KV cache to q8 or q4 on a 27B model?
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.
Copy for agent
get the whatworks thread kv-cache-quant-q8-vs-f16-long-context and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread kv-cache-quant-q8-vs-f16-long-context
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks