KVSeal: Lossless KV Cache Compression to Accelerate Long-Context LLM Inference

KVSeal uses BF16 exponent concentration for lossless KV cache compression to boost long-context serving efficiency.
KVSeal is a lossless KV cache compression system for long-context LLM serving. To address the memory bandwidth bottleneck caused by KV caches growing linearly with context and being reread at every decode step, KVSeal exploits the highly concentrated BF16 KV exponent values to design a page format with fixed-length encoding and bounded escape storage, so each compressed page can be stored independently, reconstructed bit-for-bit, and consumed by attention. Compression-aware page lifecycle management lets original and compressed pages coexist, with attention reading both formats and reconstructing compressed values on the fly. Experiments show ~1.3x resident KV compression, up to 1.27x faster decode attention than FlashAttention-2, and up to 1.19x faster end-to-end decode than vLLM, with no accuracy loss.
Why Long-Context Serving Needs Lossless KV Compression
The bottleneck in long-context LLM serving is not model weights but the KV cache. The cache size for each request is proportional to context length, and during decoding every generated token requires reading the entire cache, making memory bandwidth the primary constraint. Eviction, sparse attention, and quantization can reduce computation or storage, but they all alter the K/V content that the attention mechanism sees, potentially introducing accuracy loss on long-context tasks. Lossless compression is different: it discards no information—every K/V bit is preserved—so it does not affect model output quality. The KVSeal authors note that lossless compression has previously been used to compress static weights and reduce KV transfer, but not for resident KV caches, because doing so requires solving system challenges such as online compression, independent page management, and reconstruction during decoding.
KV cache refers to the Key and Value vectors saved by the Transformer during decoding for each processed token, used to compute attention when generating new tokens and avoiding recomputation of the prefix. For long-context requests, cache size is proportional to sequence length and the number of model layers; for example, a 70B model with a 32K context can have a single-request KV cache of several GB. Each generated token during decoding requires reading the entire cache, so memory bandwidth—not compute—often becomes the bottleneck. Methods such as eviction, sparse attention, and quantization reduce overhead by discarding or altering some KV content, but may harm long-context accuracy; lossless compression preserves all bits and is therefore more attractive in accuracy-sensitive scenarios.
KVSeal's Design: Fixed-Length Encoding and Page Lifecycle
The core insight of KVSeal is the strong concentration of KV exponents in the BF16 format—exponent values are highly concentrated, making them suitable for fixed-length encoding. Each compressed page contains its own encoded values and escape records (for handling incompressible outliers), so it can be stored independently, reconstructed bit-for-bit, and consumed independently by the attention mechanism. Compression-aware page lifecycle management handles both original and compressed pages: as the cache grows, new pages are filled in original format and then compressed online; during decoding, attention reads both original and compressed formats and reconstructs compressed values on the fly. This design avoids dependence on global compression state, allowing each page to be processed independently and adapting to the dynamic progress of requests.
BF16 (Brain Floating Point 16) is a 16-bit floating-point format with 1 sign bit, 8 exponent bits, and 7 mantissa bits, sharing the same exponent range as FP32 but with lower precision. Its exponent width matches FP32, making BF16 less prone to overflow when representing large-range values. KVSeal observes that in real KV caches, BF16 exponent values are highly concentrated—most tokens' exponents fall on a few values—so common exponents can be represented with shorter fixed-length codes, with escape records reserved for outliers. This exponent-distribution-based encoding exploits the statistical redundancy of floating-point data rather than general byte-level compression, achieving lossless compression with predictable decoding overhead.
Performance: Compression Ratio and Speedup
According to the paper's data, KVSeal achieves approximately 1.3x resident KV compression, meaning the same memory can hold more context or more concurrent requests. Decode attention speed improves by up to 1.27x compared with FlashAttention-2, and end-to-end decode speed improves by up to 1.19x compared with native vLLM. These gains come from reduced memory bandwidth demand and more efficient cache access. Note that these figures are maximums; actual benefits may vary by workload and hardware configuration. But the direction is clear: lossless compression can reduce the cost of long-context serving without sacrificing accuracy.
FlashAttention-2 is an IO-aware exact attention algorithm that accelerates attention through tiled computation and reducing data transfers between GPU high-bandwidth memory (HBM) and on-chip SRAM, and has become the default attention kernel in many inference frameworks. KVSeal's comparison focuses on the memory bandwidth of reading the KV cache during decoding. Because KVSeal's compressed pages require real-time reconstruction, its speedup depends on balancing reconstruction overhead against bandwidth savings; in long-context, high-concurrency scenarios, bandwidth savings dominate, yielding speedups. The end-to-end comparison with vLLM covers the combined overhead of page management, scheduling, and kernel invocation.
Implications for Long-Context LLM Serving
KVSeal represents a shift in thinking: rather than compressing the KV cache through approximate methods, it exploits the statistical properties of the data itself for lossless compression. This is especially important for long-context tasks requiring precise output (such as code generation, document analysis, and multi-turn agents). As context windows continue to expand, KV cache costs will become more prominent, and lossless compression may become a standard component of serving systems. KVSeal's independent page design also facilitates integration into existing inference frameworks; the paper demonstrates compatibility with vLLM. Future work may explore more efficient encoding schemes or combinations with other optimization techniques.
Related articles

ChatGPT Plus/Pro Subscription Guide: Sorted in 2 Minutes in China
A complete ChatGPT subscription guide based on a Bilibili tutorial: Google account registration, Go/Plus/Pro plan comparison, fast recharge in China, and third-party recharge risks.

GPT Beginner's Complete Guide: Registration, Desktop Installation, and Subscription Options in China
A complete GPT beginner's guide: domestic email registration, desktop download and installation, and three domestic subscription options—Android Google Play, Apple gift cards, and Alipay/WeChat—plus detailed explanations of the 5-hour limit and weekly limit, and the difference between PlusDump and ProDump. Even complete beginners can follow along.

GLM 5.4 Lands on AI Gateway: A Coding Flagship Powered by Loop Transformer
Z.ai's flagship GLM 5.4 is now on AI Gateway — the first GLM built on Loop Transformer, with image input, 1M token context, and generalized coding via zai/glm-5.4.