TECHNOLOGY

llama.cpp FP8 KV caches: scale handling must survive a context shift

In this article
THE QUICK TAKE

The b12274 FP8 KV-cache addition includes scale and context-shift semantics; validate long-session transformations rather than only initial allocation.

llama.cpp b12274 adds OCP FP8 KV-cache support with optional static per-tensor scales at runtime. Upstream includes context-shift testing alongside conversion and loading. That lifecycle coverage matters because a cache is transformed and reused after initial creation; a correct first attention call is not complete evidence for a long-running session.

KV precision is separate from weight precision

The new support concerns cached keys and values, not an automatic conversion of every model weight to FP8. A memory or quality comparison should state both weight quantization and cache type. Changing both simultaneously makes attribution difficult. The optional scales also belong in the recorded configuration: two caches with the same nominal FP8 label can differ in how stored values are interpreted by the attention graph.

Scaling has graph-level ownership

Upstream describes applying scale through graph operations rather than changing the flash-attention operator interface. That design lets scaling remain visible in the computation around the cache. A proposed correctness check should trace scales through both flash and standard attention routes that the target configuration supports. Seeing a scale tensor loaded from disk does not establish that every consumer actually applies it to the intended cached values.

Force the lifecycle transition

A local session test should deliberately trigger the supported context-shift behaviour, then compare subsequent attention outputs with a trusted reference configuration. Include non-unit scales where available, since a unit scale can hide missed multiplication. Keep tokens and shift policy fixed between runs. The upstream PR explicitly includes these lifecycle tests; this article proposes retaining their underlying property when adapting coverage to another model or backend.

Memory savings need total accounting

A smaller cache element type does not by itself specify total process or device memory. Scale tensors, attention workspace and other runtime buffers still exist. Measure the full configured session and report quality separately, especially across long-context transitions. The release establishes FP8 cache functionality and upstream coverage; it does not promise one memory ratio or an unchanged evaluation score for every model using the new cache type.

Sources

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles