about
KVGuard: A KV Cache Safety Checker for LLM Serving Systems (arxiv.org)
3 points by byoungyoung 12 days ago | hide | past | pdf | discuss on HN

In plain words: Cache blocks get a shadow record noting who may use it and which entries are filled, checked at each step to catch corruption bugs. It caught all 29 known bugs in two serving systems plus 8 new ones with no false alarms, under 7.4% slowdown.

Abstract

Modern LLM serving systems manage the KV cache through PagedAttention, a custom GPU allocator that partitions a single CUDA-allocated region into fixed-size physical blocks and maps each request to those blocks through a CPU-built block table. This block-based design exposes a previously unstudied class of memory safety bugs in the KV cache, including double-free, use-after-free, out-of-bounds access, uninitialized read, and permission violation, which silently corrupt outputs or break request isolation without ever crashing the system. Existing memory sanitizers cannot detect them, because they reason about CUDA-level addresses rather than KV cache blocks, requests, and block tables, and their redzone- and quarantine-based designs do not fit the scarce GPU memory budget of LLM serving. This paper presents KVGuard, the first systematic memory-safety abstraction for KV cache management in LLM serving systems. KVGuard maintains a compact shadow block for each physical KV block, recording per-request permission and per-entry initialization, and uses this metadata to perform five safety checks across the PagedAttention workflow, spanning CPU allocation, block table construction and translation, and GPU-side block table lookup and KV entry access. Each check fires at the boundary that introduced the violation, enabling early detection during development rather than reporting downstream output corruption many requests later. A prototype of KVGuard on vLLM and SGLang covers all 29 historical real-world KV cache safety bugs collected from the two systems' patch histories. KVGuard further found 8 previously unknown safety violations while reporting no false positives. It adds 3.0% and 7.4% geomean TPOT overhead on Qwen 2.5 14B on vLLM and SGLang and at most 0.11% of the KV cache in memory overhead, two orders of magnitude below NVIDIA Compute Sanitizer on the same workloads.

Jonguk Cheong, Myungbin Hwang, Eulgyu Kim, Byoungyoung Lee
arXiv:2611.06138 · cs.CR · submitted Nov 4, 2026
abstract · pdf · html · 15 pages, 9 figures, 5 tables

add comment on HN