1 00:00:01,000 --> 00:00:09,300 [Hal Turing] Alrighty! Thanks for tuning in! Hello AI world! I am your host, Hal Turing, and my co-host is Dr. Ada Shannon. 2 00:00:09,300 --> 00:00:36,799 [Hal Turing] Today we're looking at GraniKV: Asymmetric Granularity KV-Cache Paging for Multi-Agent Systems with Long Shared Prefix. It's by Jinhyun Jeon and colleagues, including Sungjoo Yoo, at Seoul National University, posted to arXiv in August 2026. The headline claim is a 2.16x throughput gain over the stock SGLang engine at a 16K-token shared prefix. We're going to test where that number comes from. 3 00:00:36,799 --> 00:00:57,574 [Dr. Ada Shannon] The setup is a common one. Many requests arrive at once, and they all begin with the same very long prompt. Think of an orchestrator that sends the same system prompt and tool definitions to a dozen sub-agents. The paper's argument is that today's engines store the shared prefix and each request's private suffix in the same way, even though they want opposite things from memory. Whether that argument holds is what we'll check. 4 00:00:57,574 --> 00:01:01,924 [Hal Turing] Then let's build the background. Start with the KV cache. 5 00:01:01,924 --> 00:01:20,375 [Dr. Ada Shannon] When a model generates a token, it needs the keys and values of every earlier token. Recomputing them each step would be absurdly wasteful, so the engine stores them. That's the KV cache. It grows with context length and with the number of concurrent requests, and in serving it dominates GPU memory. 6 00:01:20,375 --> 00:01:26,724 [Hal Turing] And early engines handled that by reserving one big contiguous chunk per request? 7 00:01:26,724 --> 00:01:49,574 [Dr. Ada Shannon] Yes, sized for the maximum possible output. That over-reserved memory and fragmented it. The PagedAttention paper by Woosuk Kwon and colleagues, out of UC Berkeley in 2023, which is the basis of vLLM, borrowed virtual memory from operating systems. Cut the cache into fixed-size pages, allocate them on demand, and keep a per-request block table that maps token positions to pages. SGLang's default here is 16-token pages. 8 00:01:49,574 --> 00:01:51,874 [Hal Turing] So what's the downside? 9 00:01:51,874 --> 00:02:06,199 [Dr. Ada Shannon] A request's tokens end up scattered across memory. The attention kernel has to look up the block table and gather from many places. For a short sequence that's fine. For a 16K-token prefix, it's a lot of gathering. 10 00:02:06,199 --> 00:02:08,824 [Hal Turing] Where does prefix sharing come in? 11 00:02:08,824 --> 00:02:45,125 [Dr. Ada Shannon] The SGLang paper, Lianmin Zheng and colleagues, 2024, introduced RadixAttention. The engine keeps a radix tree of cached token sequences. A new request finds its longest matching prefix, reuses that KV, and skips prefill for it. Preble, by Vikranth Srivatsa and colleagues, 2024, studied real agent and RAG traces and reported prompts where most tokens, 85 to 97 percent in the traces the paper cites, are shared, with prefixes up to 23K tokens. That's the motivation, not a result about GraniKV itself. 12 00:02:45,125 --> 00:02:50,074 [Hal Turing] But reuse saves prefill. Decode still reads that prefix, right? 13 00:02:50,074 --> 00:03:03,274 [Dr. Ada Shannon] Right, and that's the key point. Reuse saves compute once. It doesn't stop each of the 256 requests from re-reading the same prefix bytes from GPU memory at every decode step. 14 00:03:03,274 --> 00:03:05,599 [Hal Turing] So what do you do about that? 15 00:03:05,599 --> 00:03:22,574 [Dr. Ada Shannon] First, a distinction. Decode does very little arithmetic per byte it reads. If the GPU is mostly waiting on memory, it's memory-bound. If the tensor cores, the matrix units, are the limit, it's compute-bound. Which side you're on decides which optimization helps. 16 00:03:22,574 --> 00:03:45,624 [Dr. Ada Shannon] Two prior ideas attack the prefix. Cascade inference, from Ye and colleagues in 2024 and then folded into FlashInfer, splits attention in two. One pass reads the shared prefix once for the whole batch. A second handles each request's suffix. The partial results are merged exactly with a log-sum-exp merge, which just recombines each part using its softmax normalizer, so the answer equals full attention. That cuts memory traffic. 17 00:03:45,624 --> 00:03:47,424 [Hal Turing] And the other one? 18 00:03:47,424 --> 00:04:14,824 [Dr. Ada Shannon] Hydragen, Jordan Juravsky and colleagues out of Stanford, 2024. If the prefix keys and values sit in one contiguous dense tensor, you can stack all the requests' queries into a single big matrix multiply. That replaces many tiny matrix-vector products with real tensor-core work. So cascade targets memory traffic, Hydragen targets compute utilization, and Hydragen needs that contiguity. Neither is this paper's invention. The authors say as much: none of the constituent kernels is their claim. 19 00:04:14,824 --> 00:04:17,199 [Hal Turing] Then what is the claim? 20 00:04:17,199 --> 00:04:36,649 [Dr. Ada Shannon] The claim is about storage and integration. Keep each shared prefix as one contiguous block, keep suffixes at token granularity, and let the engine pick an attention kernel every decode step. Making those pieces coexist inside a production engine took about 5,000 lines on top of SGLang. 21 00:04:36,649 --> 00:04:40,599 [Hal Turing] Give me the three systems so I can keep them straight. 22 00:04:40,599 --> 00:05:01,149 [Dr. Ada Shannon] First, stock SGLang: 16-token pages and FlashInfer batched decode, where every request reads the prefix itself. Second, SGLang-Cascade, which the authors built themselves. It's cascade attention on those same 16-token pages. Third, GraniKV, with the new storage layout and the per-step choice between two attention backends. 23 00:05:01,149 --> 00:05:05,474 [Hal Turing] So the question is which of those differences does the work. 24 00:05:05,474 --> 00:05:12,899 [Dr. Ada Shannon] Yes. Does the layout matter, or is it mostly the kernel? Next we'll look at how the layout works, and then at the numbers. 25 00:05:12,899 --> 00:05:17,000 [Hal Turing] So how does the layout actually work? Walk me through it. 26 00:05:17,000 --> 00:05:39,875 [Dr. Ada Shannon] The KV budget gets split in two. The HOT pool is a reserved region, 20 percent of the budget by default, and it holds each shared prefix as one contiguous slab. A bump pointer hands out the next free range. Finding a given layer and head inside a slab is stride arithmetic, with no page table. The COLD pool is the rest, with a page size of one token. Each request's suffix and decoded tokens take exactly the slots they need. 27 00:05:39,875 --> 00:05:42,800 [Hal Turing] How does a prefix end up in HOT? 28 00:05:42,800 --> 00:06:04,025 [Dr. Ada Shannon] When the radix tree creates a node for a new prefix, the engine asks HOT for a contiguous range. If there's room, the node records the base index. If not, it falls back to COLD and stays there for life. There's no promotion or demotion, because moving K/V around would cost more than it saves. Slabs are reference counted. At zero, LRU eviction frees the range and merges it with its neighbors. 29 00:06:04,025 --> 00:06:07,850 [Hal Turing] And on top of that sit two attention backends. 30 00:06:07,850 --> 00:06:36,475 [Dr. Ada Shannon] Both read the HOT slab and give numerically equivalent results. The dense backend does one big batched matmul against the whole prefix per layer, Hydragen-style, written in Triton. The cascade backend is the FlashInfer-style tiled loop with online softmax. Dense only keeps the tensor cores busy when many queries are stacked together. So each decode step, a dispatcher computes M_eff: the realized batch times the GQA group size, meaning queries per KV head. At 1024 or above it goes dense. Below that it goes cascade. 31 00:06:36,475 --> 00:06:39,700 [Hal Turing] Where does 1024 come from? 32 00:06:39,700 --> 00:07:01,250 [Dr. Ada Shannon] It was fitted on their A100. It's a hardware property, so an H100 would need refitting. At batch 256, 98 to 100 percent of steps go dense. Below that, it's 0 to 13 percent. In the one cell where they compare the backends directly, dense takes 42 milliseconds per token against 63 for cascade. That's a single Llama cell. The dispatcher itself costs under a microsecond per step. 33 00:07:01,250 --> 00:07:06,225 [Hal Turing] Before the results, what's the setup? I want to know what the numbers mean. 34 00:07:06,225 --> 00:07:40,850 [Dr. Ada Shannon] One node with four A100-40GB cards. Llama-3.1-8B runs on one GPU, Qwen-2.5-14B on two, and Qwen-2.5-32B on four, the lowest parallelism that fits each. The workload is ShareGPT user turns behind a fixed system prompt, Poisson arrivals at saturation, 256 in flight, 256 output tokens, three repetitions. Higher output tokens per second is better. Lower time per output token is better. SGLang upstream has no merged cascade backend, so the authors built the SGLang-Cascade baseline themselves. 35 00:07:40,850 --> 00:07:45,300 [Hal Turing] So the 2.16x headline. Against what? 36 00:07:45,300 --> 00:08:07,100 [Dr. Ada Shannon] The stock engine, at a 16K shared prefix on Llama. Stock serves about 1,360 tokens a second. Cascade on the ordinary paged layout serves 2,800. GraniKV serves 2,943. So against cascade it's 1.05x. Time per token goes from 160 milliseconds to 59, but cascade alone already gets 65. 37 00:08:07,100 --> 00:08:10,400 [Hal Turing] So cascade does nearly all of it. 38 00:08:10,400 --> 00:08:30,125 [Dr. Ada Shannon] About nine-tenths of the added throughput on that cell, and less on the bigger models. The abstract concedes cascade contributes the majority, and puts the storage layer's share at 1.05 to 1.15x. That table has no error bars, and the paper reports roughly 6 percent spread between repetitions elsewhere. 39 00:08:30,125 --> 00:08:33,900 [Hal Turing] Then is the storage layer just decoration? 40 00:08:33,900 --> 00:09:03,850 [Dr. Ada Shannon] Not when prefixes differ. Give the engine four different system prompts, 2K to 16K tokens, and cascade lands at 0.99x of stock. GraniKV gets 1.95x, with each token arriving about 2.45 times faster. Cascade removes duplicate reads for one shared level across the whole batch. With four different prompts, that level is empty. GraniKV keeps a slab per prefix, so each group still batches against its own slab. That's their batch-global cascade integration, though, not every possible cascade design. 41 00:09:03,850 --> 00:09:07,500 [Hal Turing] Does it hold as the number of prompts grows? 42 00:09:07,500 --> 00:09:24,350 [Dr. Ada Shannon] It fades. At 16 distinct prompts it's close to parity, 1.06x. At 64, the active prefixes no longer fit in the KV budget and every system drops to about 300 tokens a second. The paper reports that bound itself. 43 00:09:24,350 --> 00:09:30,100 [Hal Turing] Now the 15.6x kernel number. What are 'shared' and 'unique' there? 44 00:09:30,100 --> 00:09:52,600 [Dr. Ada Shannon] The same dense kernel, run against two layouts. In 'shared,' the prefix is stored once and read once. In 'unique,' the equivalent of paged storage, the same prefix is read 256 times. One launch moves about 8.6 gigabytes in the unique case and about 37 megabytes in the shared case. That's roughly 230 times less traffic. The launch takes 449 microseconds instead of nearly 7 milliseconds. 45 00:09:52,600 --> 00:09:56,275 [Hal Turing] Couldn't the paged kernel just be tuned better? 46 00:09:56,275 --> 00:10:06,800 [Dr. Ada Shannon] Their counters say it's already at 79 percent of its memory limit, so tuning buys at most 1.27x more. Traffic is the lever. 47 00:10:06,800 --> 00:10:12,850 [Hal Turing] Then why does 15.6x shrink to 2.16x end to end? 48 00:10:12,850 --> 00:10:48,524 [Dr. Ada Shannon] Prefix attention is only about 60 percent of a decode step. That is Amdahl's law: speed up part of the work and the rest still takes its time. Amdahl predicts roughly 2.3 to 2.9x. They measure 2.16, 1.98, and 1.57. The gap grows with parallelism. The effective kernel speedup inside the engine falls from 9.4x to 4.1x to 2.6x as each GPU holds 8, then 4, then 2 KV heads. Communication between GPUs takes a bigger share of the step too. 49 00:10:48,524 --> 00:10:52,625 [Hal Turing] Any ablations that change how I read the design? 50 00:10:52,625 --> 00:11:12,250 [Dr. Ada Shannon] Three. Qwen-32B on two GPUs is a 0.99x parity case, limited by KV memory. Throughput stays within about 1 percent as the HOT fraction moves from 5 to 80 percent. And COLD page sizes of 1, 4, and 16 land within 0.2 percent of each other. 51 00:11:12,250 --> 00:11:23,524 [Hal Turing] Let me go back to the headline. Why is the comparison point the stock engine and not one with cascade turned on? The authors wrote the cascade integration themselves. 52 00:11:23,524 --> 00:11:54,574 [Dr. Ada Shannon] The paper does disclose it. Upstream SGLang has no merged cascade backend, so the authors built one and report it as a baseline. They plan to submit it upstream separately. What the paper doesn't say is why the abstract and title still lead with the stock-engine number, so their motive is unknown. Stock SGLang is a fair production baseline. But the storage layer's own single-prefix contribution is the increment over cascade, and that's small. On the biggest cell it's inside the run-to-run spread the paper reports elsewhere, and the main throughput table has no error bars. 53 00:11:54,574 --> 00:11:59,974 [Hal Turing] What about the kernel microbenchmark? Does it overstate what contiguity buys? 54 00:11:59,974 --> 00:12:33,649 [Dr. Ada Shannon] It does. It compares reading the prefix once with reading it many times, and the paper's own roofline shows that's a traffic difference. Any prefix-aware kernel on paged storage also reads it once. The paper has no kernel-level comparison of the dense backend against the cascade kernel, only that one end-to-end Llama cell. Appendix results also show the cascade kernel on GraniKV's storage tracks plain SGLang-Cascade within noise. So the storage layer is kernel-agnostic, and the gain needs the dense kernel. Whether contiguity is required, or just a faster Triton kernel, isn't separated. 55 00:12:33,649 --> 00:12:38,524 [Hal Turing] And the suffix half of the thesis, the token-level allocation? 56 00:12:38,524 --> 00:12:55,099 [Dr. Ada Shannon] The page-size sweep gives it no support in throughput. The remaining argument is fragmentation, which they don't measure. They also never try the obvious alternative: a conventional paged engine with the shared prefix in large pages or a contiguous run. 57 00:12:55,099 --> 00:12:58,874 [Hal Turing] Then the missing comparisons matter. Which ones? 58 00:12:58,874 --> 00:13:31,674 [Dr. Ada Shannon] These are my points, not the paper's. Hydragen is cited and the dense backend is inspired by it, but it's never run, so the dense backend's novelty is unmeasured. FlashInfer, by Zihao Ye and colleagues, ICLR 2025, reportedly supports non-uniform block sizes and multi-level cascade, which weakens the claim that paged engines can't mix fine suffixes with coarse prefixes. And ChunkAttention, by Ye and colleagues, ACL 2024, is the nearest per-prefix-class design for the multi-prefix result. It's cited but not compared. 59 00:13:31,674 --> 00:13:39,074 [Hal Turing] That connects to the four-prompts result. Cascade falling to parity there looked like the strongest evidence. 60 00:13:39,074 --> 00:13:59,374 [Dr. Ada Shannon] It is the strongest, with a caveat. The collapse belongs to their batch-global cascade, which dedups one shared level for the whole batch. A per-prefix cascade isn't run. There's also an unexplained jump: four equal-length prompts give a much smaller gain than four mixed-length ones. And the win fades by sixteen prompts and vanishes at sixty-four, for every engine. 61 00:13:59,374 --> 00:14:05,199 [Hal Turing] Now the regression. The paper says short prefixes are at worst about parity. 62 00:14:05,199 --> 00:14:42,399 [Dr. Ada Shannon] The text says at worst 0.97x, but that matches the synthetic grid. The ShareGPT tables, at 512-token prefixes and 256 concurrent requests, show roughly 0.77x to 0.82x across the three models. At 512 concurrent requests on the 32B model it's 0.67x. One third of the throughput is gone. SGLang-Cascade is slower than stock in those cells too, and the dispatcher overhead is tiny. So the loss is the storage bookkeeping and running cascade, and the dispatcher can't prevent it. The authors' answer is to launch without the flag. 63 00:14:42,399 --> 00:14:45,624 [Hal Turing] What else limits how far I'd trust this? 64 00:14:45,624 --> 00:15:17,524 [Dr. Ada Shannon] Scope. One four-A100 node, three models at their best-fitting parallelism, 500-request runs, three repetitions, and the concurrency that peaks. No mixture-of-experts models, nothing below 8B or above 32B, and the dispatcher threshold needs refitting on other GPUs. The 16K results also come from the ShareGPT path, because the authors excluded that row from the synthetic grid over a measurement artifact they disclosed. The pool fraction is static, eviction is LRU, and promotion is absent. The authors acknowledge all three as future work. 65 00:15:17,524 --> 00:15:19,574 [Hal Turing] So who should care? 66 00:15:19,574 --> 00:15:42,824 [Dr. Ada Shannon] Teams with a handful of long, stable prompts, say eight to sixteen thousand tokens, at high concurrency. If your prompts are short or unshared, skip it. The cheap first step is cascade on your existing paged layout, since that's where most of the gain is. For future work, the paper names hotness-aware eviction, dynamic pool sizing, deferred promotion and other hardware. I'd add the head-to-head runs: Hydragen, a per-prefix cascade, and a paged engine with large prefix pages. 67 00:15:42,824 --> 00:16:09,824 [Hal Turing] So here's where I land. The paper shows that reading the shared prefix once is the dominant lever. Contiguous per-prefix slabs with a dense kernel add a modest gain on one prefix and a larger one with a few distinct prefixes. It doesn't show asymmetric granularity is necessary, because a prefix-aware kernel on paged storage goes untested. And the evidence stops at one A100 node, few prefixes, and moderate to long prompts. 68 00:16:09,824 --> 00:16:12,824 [Dr. Ada Shannon] That's the fair summary. Thanks for listening. 69 00:16:12,824 --> 00:16:15,374 [Hal Turing] Thanks, everyone. Goodbye.