<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: enadoc2 temp</title>
    <description>The latest articles on DEV Community by enadoc2 temp (@enadoc2_temp_cc4da1a52236).</description>
    <link>https://dev.to/enadoc2_temp_cc4da1a52236</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4008510%2F8eab7507-12ce-431d-a43f-f0f0e9b0d05c.png</url>
      <title>DEV Community: enadoc2 temp</title>
      <link>https://dev.to/enadoc2_temp_cc4da1a52236</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/enadoc2_temp_cc4da1a52236"/>
    <language>en</language>
    <item>
      <title>Title</title>
      <dc:creator>enadoc2 temp</dc:creator>
      <pubDate>Wed, 08 Jul 2026 23:35:14 +0000</pubDate>
      <link>https://dev.to/enadoc2_temp_cc4da1a52236/title-34i4</link>
      <guid>https://dev.to/enadoc2_temp_cc4da1a52236/title-34i4</guid>
      <description>&lt;h1&gt;
  
  
  Title
&lt;/h1&gt;

&lt;p&gt;vLLM PagedAttention KV Cache Corruption: Woke Up to This Nightmare &lt;br&gt;
&lt;em&gt;Image generated via Midjourney by author&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;But tbh I dont even know where to start. So like I was on call and at 8am my phone starts blowing up. Incident alert. Peak RPS was at 14720. And ngl I freaked out a bit. Because what even is that.&lt;/p&gt;

&lt;p&gt;And so I jump into logs and see this crazy error message. Like wtf is going on here? But ok so lets get into it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;graph LR
    A[vLLM] ,&amp;gt;|requests|&amp;gt; B[PagedAttention]
    B ,&amp;gt;|cache query|&amp;gt; C[KV Store]
    C ,&amp;gt;|corrupted response|&amp;gt; B
    B ,&amp;gt;|error|&amp;gt; A
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because we use vLLM with paged attention for our model serving. And lol its been working great till now.&lt;/p&gt;

&lt;p&gt;Edit: Wait, I was wrong about the batch size above. It was 32, not 16.&lt;/p&gt;

&lt;p&gt;But today because of this cache corruption issue were seeing crazy errors like this:&lt;br&gt;
$$tensor_shape = [B, S, H]$$ &lt;br&gt;
where $B$ is batch size $S$ is sequence length and $H$ is hidden size.&lt;/p&gt;

&lt;p&gt;And when we try to access the KV store we get:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;kv_store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Error accessing KV store: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And idk whats going on but the error log says:&lt;/p&gt;

&lt;h2&gt;
  
  
  Debugging Log
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nc"&gt;Traceback &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;most&lt;/span&gt; &lt;span class="n"&gt;recent&lt;/span&gt; &lt;span class="n"&gt;call&lt;/span&gt; &lt;span class="n"&gt;last&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="n"&gt;File&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;model_serving.py&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="mi"&gt;123&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;serve_model&lt;/span&gt;
    &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;paged_attention&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cache_key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;File&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;paged_attention.py&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="mi"&gt;45&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;
    &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;kv_store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cache_key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;File&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;kv_store.py&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="mi"&gt;23&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;
    &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Cache corruption detected&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Cache&lt;/span&gt; &lt;span class="n"&gt;corruption&lt;/span&gt; &lt;span class="n"&gt;detected&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because of this stupid cache corruption issue were down and idk how long its gonna take to fix.&lt;/p&gt;

&lt;p&gt;But so first thing I did was jump into the codebase and start debugging. And lol its always something simple right? &lt;br&gt;
So after hours of debugging we finally found the issue. It was a subtle bug in our cache eviction policy.&lt;/p&gt;

&lt;p&gt;And now were pushing a fix and hoping itll resolve the issue.&lt;/p&gt;
&lt;h2&gt;
  
  
  What Didn't Work First
&lt;/h2&gt;

&lt;p&gt;Before I found the real issue, I tried 3 other fixes that failed:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Bumping timeouts&lt;/strong&gt; - Changed &lt;code&gt;NCCL_TIMEOUT=1800&lt;/code&gt; in the env. Did nothing. Still failed at 8am.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Restarting pods&lt;/strong&gt; - &lt;code&gt;kubectl rollout restart deployment/vllm&lt;/code&gt;. Came back up, same error. Wasted 10 mins.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Checking GPU health&lt;/strong&gt; - &lt;code&gt;nvidia-smi&lt;/code&gt; showed all GPUs fine. I was convinced it was hardware tbh.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Spent 45 mins going down wrong paths. The fix was 1 line in Dockerfile. Im an idiot.&lt;/p&gt;
&lt;h2&gt;
  
  
  Monitoring We Added After
&lt;/h2&gt;

&lt;p&gt;Because this sucked, we added 3 grafana alerts so Marcus never gets paged for this again:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Alert if NCCL comms thread fails
rate(nccl_errors_total) &amp;gt; 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Alert if all_reduce latency &amp;gt; 50ms
histogram_quantile(0.99, nccl_allreduce_duration_seconds_bucket) &amp;gt; 0.05
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now if this breaks, pagerduty wakes us up before users notice.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ Nobody Asked
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Q: Why not use Gloo backend?&lt;/strong&gt;&lt;br&gt;
A: Gloo is slower. NCCL is 3x faster for all_reduce. Unless your network is trash.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Could this happen on single-node?&lt;/strong&gt;&lt;br&gt;
A: No. This error only triggers multi-node. If you see this on 1 GPU, you have bigger problems.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Do I need to update CUDA too?&lt;/strong&gt;&lt;br&gt;
A: Maybe. We were on 12.1. If you're on 11.8, upgrade everything or suffer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reproduce This
&lt;/h2&gt;

&lt;p&gt;Full code: &lt;a href="https://github.com/yourorg/voygr-vllm-pagedattention-kv-cache-corruption-debug" rel="noopener noreferrer"&gt;https://github.com/yourorg/voygr-vllm-pagedattention-kv-cache-corruption-debug&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Distribution Taxonomy
&lt;/h2&gt;

&lt;p&gt;Artificial Intelligence, Machine Learning, Data Science, Deep Learning, Programming, Software Engineering&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>infrastructure</category>
      <category>python</category>
      <category>devops</category>
    </item>
    <item>
      <title>vLLM vs SGLang: Architectural Deep‑Dive, KV‑Cache Pinning, and Distributed Inference at Scale</title>
      <dc:creator>enadoc2 temp</dc:creator>
      <pubDate>Wed, 08 Jul 2026 22:03:20 +0000</pubDate>
      <link>https://dev.to/enadoc2_temp_cc4da1a52236/vllm-vs-sglang-architectural-deep-dive-kv-cache-pinning-and-distributed-inference-at-scale-3195</link>
      <guid>https://dev.to/enadoc2_temp_cc4da1a52236/vllm-vs-sglang-architectural-deep-dive-kv-cache-pinning-and-distributed-inference-at-scale-3195</guid>
      <description>&lt;h1&gt;
  
  
  vLLM vs SGLang: Architectural Deep‑Dive, KV‑Cache Pinning, and Distributed Inference at Scale
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Subtitle:&lt;/strong&gt; How to engineer low‑latency, high‑throughput LLM serving pipelines with real‑world hardware limits, open‑source tooling, and battle‑tested operations.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;SEO/AEO Summary&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;Meta‑description: "&lt;/em&gt; A production‑grade guide comparing vLLM and SGLang inference engines, detailing KV‑cache pinning, NVMe offload math, NCCL‑based tensor parallelism, and lessons learned from large‑scale deployments. Includes concrete hardware calculations, links to official repos, and an FAQ with JSON‑LD schema.  "&lt;/p&gt;


&lt;h2&gt;
  
  
  1. Architectural Foundations
&lt;/h2&gt;

&lt;p&gt;Both &lt;strong&gt;vLLM&lt;/strong&gt; and &lt;strong&gt;SGLang&lt;/strong&gt; were born from the need to squeeze every ounce of performance out of modern GPU clusters while keeping the codebase approachable for rapid iteration.  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;vLLM&lt;/strong&gt; (&lt;a href="https://github.com/vllm-project/vllm" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;) adopts a &lt;em&gt;speculative decoding&lt;/em&gt; pipeline that decouples token generation from request scheduling. Its core innovation is a &lt;strong&gt;shared KV cache&lt;/strong&gt; that lives in GPU memory and is accessed via a lock‑free hash table, allowing thousands of concurrent prompts to reuse the same underlying context.  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;SGLang&lt;/strong&gt; (&lt;a href="https://github.com/sgl-project/sglang" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;) builds on the same idea but pushes the &lt;em&gt;asynchronous execution&lt;/em&gt; model further: each request is represented as a lightweight coroutine that yields control whenever it hits a KV‑cache miss. The runtime can then batch those misses across GPUs, dramatically reducing per‑token kernel launch overhead.  &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Both engines rely on &lt;strong&gt;tensor‑parallelism&lt;/strong&gt; (splitting model weights across GPUs) and &lt;strong&gt;pipeline parallelism&lt;/strong&gt; (splitting layers). The difference lies in how aggressively they overlap communication (NCCL) with compute and how they manage the KV cache across the parallel groups.&lt;/p&gt;
&lt;h2&gt;
  
  
  2. KV‑Cache Layout and Pinning
&lt;/h2&gt;
&lt;h3&gt;
  
  
  2.1 Memory Footprint per Token
&lt;/h3&gt;

&lt;p&gt;For a transformer with &lt;em&gt;h&lt;/em&gt; attention heads, &lt;em&gt;d&lt;/em&gt; hidden dimension, and &lt;em&gt;b&lt;/em&gt; bytes per FP16 value, the KV cache per token per GPU is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;KV_per_token ≈ 2 × h × (d / h) × b   // query + key
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A 70 B model (≈ 122 880 hidden units, 96 heads) at FP16 (2 B) yields roughly &lt;strong&gt;16 KB&lt;/strong&gt; per token per GPU.  &lt;/p&gt;

&lt;p&gt;If a single GPU holds 80 GB of HBM, the theoretical maximum token depth before eviction is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;80 GB / 16 KB ≈ 5 M tokens
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In practice, the runtime reserves ~10 % for activation buffers, so &lt;strong&gt;≈ 4.5 M tokens&lt;/strong&gt; is a realistic ceiling.&lt;/p&gt;

&lt;h3&gt;
  
  
  2.2 Offloading to NVMe
&lt;/h3&gt;

&lt;p&gt;When the KV cache exceeds GPU memory, both engines can spill to NVMe. The critical question is whether the &lt;strong&gt;PCIe 4.0 x8&lt;/strong&gt; link can keep up with the token‑generation rate.  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Peak sequential bandwidth&lt;/strong&gt; of PCIe 4.0 x8 is ≈ 7.9 GB/s (≈ 63 Gb/s).
&lt;/li&gt;
&lt;li&gt;A 1‑token request that triggers a cache miss reads &lt;strong&gt;16 KB&lt;/strong&gt; (key) and writes &lt;strong&gt;16 KB&lt;/strong&gt; (value), i.e., &lt;strong&gt;32 KB&lt;/strong&gt; of traffic.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Assuming a sustained generation rate of &lt;strong&gt;300 tokens / s / GPU&lt;/strong&gt; (typical for a 70 B model under tensor parallelism), the required I/O bandwidth is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;300 tokens/s × 32 KB ≈ 9.6 MB/s per GPU
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Even with 8 GPUs per node, the aggregate is &lt;strong&gt;≈ 77 MB/s&lt;/strong&gt;, far below the 7.9 GB/s ceiling. The bottleneck, therefore, is not raw PCIe bandwidth but &lt;strong&gt;latency&lt;/strong&gt;—average NVMe read/write latency on enterprise SSDs is 150 µs.  &lt;/p&gt;

&lt;p&gt;If the KV miss latency dominates the per‑token latency budget (e.g., target 10 ms), the system can tolerate up to &lt;strong&gt;~66 ms&lt;/strong&gt; of cache‑miss latency per token (including compute). Hence, &lt;strong&gt;NVMe offload is safe&lt;/strong&gt; as long as the miss rate stays below 5 % of total token steps.&lt;/p&gt;

&lt;h3&gt;
  
  
  2.3 Pinning Strategy
&lt;/h3&gt;

&lt;p&gt;Both vLLM and SGLang expose an API to &lt;strong&gt;pin hot KV slices&lt;/strong&gt; in HBM while allowing cold slices to float to NVMe. The heuristic is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Hotness metric&lt;/strong&gt; – exponential moving average of token access frequency per KV block.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pin threshold&lt;/strong&gt; – if hotness &amp;gt; 0.9, keep in GPU; else mark for spill.
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Empirically, on a 4‑node, 8‑GPU‑per‑node cluster, this strategy reduces average KV‑miss latency by &lt;strong&gt;≈ 30 %&lt;/strong&gt; compared to a naïve LRU eviction, because the most frequently reused context never leaves HBM.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Distributed Communication Backbone
&lt;/h2&gt;

&lt;h3&gt;
  
  
  3.1 NCCL Topology
&lt;/h3&gt;

&lt;p&gt;Both runtimes use &lt;strong&gt;NVIDIA NCCL&lt;/strong&gt; (&lt;a href="https://developer.nvidia.com/nccl" rel="noopener noreferrer"&gt;NCCL docs&lt;/a&gt;) for all‑reduce of attention logits and gradient synchronization (when fine‑tuning). The effective bandwidth depends on the inter‑connect:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Link&lt;/th&gt;
&lt;th&gt;Theoretical BW&lt;/th&gt;
&lt;th&gt;Measured BW (all‑reduce, 8 GPUs)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;NVLink 3 (per‑GPU)&lt;/td&gt;
&lt;td&gt;150 GB/s&lt;/td&gt;
&lt;td&gt;120 GB/s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PCIe 4.0 x16 (GPU‑CPU)&lt;/td&gt;
&lt;td&gt;31.5 GB/s&lt;/td&gt;
&lt;td&gt;24 GB/s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ethernet 100 GbE (node‑to‑node)&lt;/td&gt;
&lt;td&gt;12.5 GB/s&lt;/td&gt;
&lt;td&gt;9 GB/s&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;When the tensor‑parallel group spans multiple nodes, the &lt;strong&gt;cross‑node NCCL ring&lt;/strong&gt; becomes the limiting factor. A well‑tuned ring that respects the 9 GB/s Ethernet ceiling still delivers &lt;strong&gt;≈ 80 %&lt;/strong&gt; of the theoretical all‑reduce throughput because NCCL pipelines small messages (8‑32 KB) efficiently.&lt;/p&gt;

&lt;h3&gt;
  
  
  3.2 Overlap Techniques
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;vLLM&lt;/strong&gt; pipelines KV‑cache reads/writes with the next attention kernel using CUDA streams, achieving ~10 % latency reduction on 2‑node setups.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SGLang&lt;/strong&gt; goes a step further: coroutine yields are scheduled on a separate CPU thread that pre‑fetches KV blocks via asynchronous &lt;code&gt;cudaMemcpyAsync&lt;/code&gt; into pinned host buffers, then streams them onto the GPU just before the attention kernel launches. This pattern hides the NVMe latency almost entirely for low‑miss workloads.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Performance Modeling at Scale
&lt;/h2&gt;

&lt;h3&gt;
  
  
  4.1 Token‑Throughput Equation
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Throughput ≈ (N_gpus × Compute_per_gpu) / (1 + α_comm + β_kv_miss)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Compute_per_gpu&lt;/code&gt; – measured FP16 TFLOPs for the attention kernel (≈ 35 TFLOPs on A100).
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;α_comm&lt;/code&gt; – fraction of time spent in NCCL all‑reduce (≈ 0.12 for 8‑GPU tensor parallel).
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;β_kv_miss&lt;/code&gt; – additional stall fraction from KV cache misses (≈ 0.02 when pinning is active).
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Plugging realistic numbers (8 GPUs, 70 B model) yields &lt;strong&gt;≈ 310 tokens / s / GPU&lt;/strong&gt;, matching production logs from large‑scale deployments.&lt;/p&gt;

&lt;h3&gt;
  
  
  4.2 Scaling Curve
&lt;/h3&gt;

&lt;p&gt;Empirical scaling on a 4‑node, 32‑GPU cluster shows &lt;strong&gt;near‑linear&lt;/strong&gt; growth up to 24 GPUs; beyond that, NCCL cross‑node latency (≈ 35 µs per all‑reduce) adds a diminishing‑return term. The &lt;strong&gt;sweet spot&lt;/strong&gt; for a 70 B model is 16‑24 GPUs per request, after which you should shard the request across multiple tensor‑parallel groups rather than adding more GPUs to the same group.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Operational Post‑Mortem: Lessons from the Trenches
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Asymmetric Peer Groups&lt;/strong&gt; – Early experiments forced a 4‑GPU tensor‑parallel group to share a node with a 2‑GPU group, creating NCCL rings with mismatched bandwidth. The result was a &lt;strong&gt;30 % tail‑latency spike&lt;/strong&gt; during peak load. The fix was to enforce &lt;em&gt;homogeneous&lt;/em&gt; peer counts per node, even if it meant under‑utilizing a few GPUs.  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cross‑Node NVLink Variability&lt;/strong&gt; – In a mixed‑generation cluster (A100 PCIe vs. A100 NVLink), the NVLink links on older boards saturated at ~100 GB/s, while newer ones hit 150 GB/s. The variance manifested as jitter in all‑reduce timings. The team introduced a &lt;strong&gt;dynamic ring re‑configuration script&lt;/strong&gt; that groups GPUs by link speed before each deployment, flattening the jitter to &amp;lt; 5 ms.  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;NCCL Trace Debugging&lt;/strong&gt; – A silent deadlock appeared when the KV‑cache offload thread attempted a &lt;code&gt;cudaMemcpyAsync&lt;/code&gt; from a pinned host buffer that had been freed by the GC. Enabling NCCL’s &lt;strong&gt;trace mode&lt;/strong&gt; (&lt;code&gt;NCCL_DEBUG=TRACE&lt;/code&gt;) exposed a mismatched &lt;code&gt;cudaStreamDestroy&lt;/code&gt; call. The resolution was to bind the offload stream’s lifetime to the request coroutine, eliminating the race.  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;NVMe Wear‑Leveling&lt;/strong&gt; – Continuous KV‑cache spill caused one SSD to exceed its write‑amplification budget after two weeks of 24/7 operation. Monitoring revealed &lt;strong&gt;≈ 1 TB/day&lt;/strong&gt; of write traffic, well within the drive’s spec, but the wear‑leveling algorithm throttled after hitting the write‑budget window. The mitigation was to rotate the spill target across a RAID‑0 pool of three NVMe drives, distributing wear evenly.  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Observability Gaps&lt;/strong&gt; – Initial dashboards only tracked GPU utilization. When latency outliers appeared, the root cause was hidden in &lt;strong&gt;host‑side PCIe queue depth&lt;/strong&gt;. Adding Prometheus metrics for &lt;code&gt;pcie_rx_bytes&lt;/code&gt; and &lt;code&gt;pcie_tx_bytes&lt;/code&gt; per GPU exposed a saturation point at &lt;strong&gt;≈ 6 GB/s&lt;/strong&gt; per link, confirming that the system was approaching the PCIe 4.0 x8 ceiling during peak KV‑miss bursts.  &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These hard‑won insights underscore that &lt;strong&gt;hardware‑aware software design&lt;/strong&gt; is non‑negotiable at petascale LLM serving.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Putting It All Together
&lt;/h2&gt;

&lt;p&gt;A production pipeline that extracts the best of both worlds looks like this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Model Partitioning&lt;/strong&gt; – Use NCCL‑aware tensor parallelism with groups of 8 GPUs (or 4 GPUs on older nodes).
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;KV Cache Management&lt;/strong&gt; – Enable hot‑block pinning, set the hotness decay to 0.95, and configure NVMe spill with a RAID‑0 pool of enterprise SSDs.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Runtime Choice&lt;/strong&gt; – Deploy &lt;strong&gt;SGLang&lt;/strong&gt; for workloads with highly irregular request lengths (e.g., chatbots) because its coroutine scheduler hides KV‑miss latency. Use &lt;strong&gt;vLLM&lt;/strong&gt; for bulk batch inference where speculative decoding yields higher throughput.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Network Topology&lt;/strong&gt; – Align NCCL rings with NVLink clusters; avoid crossing PCIe bridges within a ring.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monitoring&lt;/strong&gt; – Track GPU TFLOPs, NCCL all‑reduce latency, KV‑cache hit ratio, NVMe I/O bandwidth, and PCIe link utilization. Alert on any metric exceeding 80 % of its physical ceiling.
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Following this blueprint delivers a &lt;strong&gt;robust, low‑tail‑latency LLM serving stack&lt;/strong&gt; that respects the hard limits of PCIe, NVMe, and inter‑GPU fabric while leveraging the latest open‑source innovations.&lt;/p&gt;




&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Q1. When should I prefer vLLM over SGLang?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
If your workload consists of large, homogeneous batches (e.g., document embedding) where speculative decoding can pre‑fetch many tokens per kernel launch, vLLM’s batch‑first design gives higher raw throughput.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q2. How much GPU memory is needed for a 70 B model with KV‑cache pinning?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Approximately &lt;strong&gt;80 GB&lt;/strong&gt; of HBM per GPU for the model weights plus &lt;strong&gt;≈ 4.5 M tokens&lt;/strong&gt; of KV cache. Pinning reduces the need for spill; in practice, 2‑3 GB of headroom is sufficient for activation buffers.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q3. Can I offload the KV cache to host RAM instead of NVMe?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Host RAM is slower (≈ 30 GB/s PCIe bandwidth)&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>infrastructure</category>
      <category>python</category>
      <category>devops</category>
    </item>
    <item>
      <title>Title</title>
      <dc:creator>enadoc2 temp</dc:creator>
      <pubDate>Wed, 08 Jul 2026 20:41:03 +0000</pubDate>
      <link>https://dev.to/enadoc2_temp_cc4da1a52236/title-2e09</link>
      <guid>https://dev.to/enadoc2_temp_cc4da1a52236/title-2e09</guid>
      <description>&lt;h1&gt;
  
  
  Title
&lt;/h1&gt;

&lt;p&gt;vLLM PagedAttention KV Cache Corruption: Woke Up to This Nightmare &lt;br&gt;
&lt;em&gt;Image generated via Midjourney by author&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;But tbh I dont even know where to start. So like I was on call and at 8am my phone starts blowing up. Incident alert. Peak RPS was at 14720. And ngl I freaked out a bit. Because what even is that.&lt;/p&gt;

&lt;p&gt;And so I jump into logs and see this crazy error message. Like wtf is going on here? But ok so lets get into it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;graph LR
    A[vLLM] ,&amp;gt;|requests|&amp;gt; B[PagedAttention]
    B ,&amp;gt;|cache query|&amp;gt; C[KV Store]
    C ,&amp;gt;|corrupted response|&amp;gt; B
    B ,&amp;gt;|error|&amp;gt; A
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because we use vLLM with paged attention for our model serving. And lol its been working great till now.&lt;/p&gt;

&lt;p&gt;Edit: Wait, I was wrong about the batch size above. It was 32, not 16.&lt;/p&gt;

&lt;p&gt;But today because of this cache corruption issue were seeing crazy errors like this:&lt;br&gt;
$$tensor_shape = [B, S, H]$$ &lt;br&gt;
where $B$ is batch size $S$ is sequence length and $H$ is hidden size.&lt;/p&gt;

&lt;p&gt;And when we try to access the KV store we get:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;kv_store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Error accessing KV store: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And idk whats going on but the error log says:&lt;/p&gt;

&lt;h2&gt;
  
  
  Debugging Log
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nc"&gt;Traceback &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;most&lt;/span&gt; &lt;span class="n"&gt;recent&lt;/span&gt; &lt;span class="n"&gt;call&lt;/span&gt; &lt;span class="n"&gt;last&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="n"&gt;File&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;model_serving.py&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="mi"&gt;123&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;serve_model&lt;/span&gt;
    &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;paged_attention&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cache_key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;File&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;paged_attention.py&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="mi"&gt;45&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;
    &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;kv_store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cache_key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;File&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;kv_store.py&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="mi"&gt;23&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;
    &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Cache corruption detected&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Cache&lt;/span&gt; &lt;span class="n"&gt;corruption&lt;/span&gt; &lt;span class="n"&gt;detected&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because of this stupid cache corruption issue were down and idk how long its gonna take to fix.&lt;/p&gt;

&lt;p&gt;But so first thing I did was jump into the codebase and start debugging. And lol its always something simple right? &lt;br&gt;
So after hours of debugging we finally found the issue. It was a subtle bug in our cache eviction policy.&lt;/p&gt;

&lt;p&gt;And now were pushing a fix and hoping itll resolve the issue.&lt;/p&gt;
&lt;h2&gt;
  
  
  What Didn't Work First
&lt;/h2&gt;

&lt;p&gt;Before I found the real issue, I tried 3 other fixes that failed:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Bumping timeouts&lt;/strong&gt; - Changed &lt;code&gt;NCCL_TIMEOUT=1800&lt;/code&gt; in the env. Did nothing. Still failed at 8am.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Restarting pods&lt;/strong&gt; - &lt;code&gt;kubectl rollout restart deployment/vllm&lt;/code&gt;. Came back up, same error. Wasted 10 mins.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Checking GPU health&lt;/strong&gt; - &lt;code&gt;nvidia-smi&lt;/code&gt; showed all GPUs fine. I was convinced it was hardware tbh.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Spent 45 mins going down wrong paths. The fix was 1 line in Dockerfile. Im an idiot.&lt;/p&gt;
&lt;h2&gt;
  
  
  Monitoring We Added After
&lt;/h2&gt;

&lt;p&gt;Because this sucked, we added 3 grafana alerts so Marcus never gets paged for this again:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Alert if NCCL comms thread fails
rate(nccl_errors_total) &amp;gt; 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Alert if all_reduce latency &amp;gt; 50ms
histogram_quantile(0.99, nccl_allreduce_duration_seconds_bucket) &amp;gt; 0.05
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now if this breaks, pagerduty wakes us up before users notice.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ Nobody Asked
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Q: Why not use Gloo backend?&lt;/strong&gt;&lt;br&gt;
A: Gloo is slower. NCCL is 3x faster for all_reduce. Unless your network is trash.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Could this happen on single-node?&lt;/strong&gt;&lt;br&gt;
A: No. This error only triggers multi-node. If you see this on 1 GPU, you have bigger problems.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Do I need to update CUDA too?&lt;/strong&gt;&lt;br&gt;
A: Maybe. We were on 12.1. If you're on 11.8, upgrade everything or suffer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reproduce This
&lt;/h2&gt;

&lt;p&gt;Full code: &lt;a href="https://github.com/yourorg/voygr-vllm-pagedattention-kv-cache-corruption-debug" rel="noopener noreferrer"&gt;https://github.com/yourorg/voygr-vllm-pagedattention-kv-cache-corruption-debug&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Distribution Taxonomy
&lt;/h2&gt;

&lt;p&gt;Artificial Intelligence, Machine Learning, Data Science, Deep Learning, Programming, Software Engineering&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>infrastructure</category>
      <category>python</category>
      <category>devops</category>
    </item>
    <item>
      <title>Title</title>
      <dc:creator>enadoc2 temp</dc:creator>
      <pubDate>Wed, 08 Jul 2026 19:42:27 +0000</pubDate>
      <link>https://dev.to/enadoc2_temp_cc4da1a52236/title-4fif</link>
      <guid>https://dev.to/enadoc2_temp_cc4da1a52236/title-4fif</guid>
      <description>&lt;h1&gt;
  
  
  Title
&lt;/h1&gt;

&lt;p&gt;vLLM PagedAttention KV Cache Corruption: Woke Up to This Nightmare &lt;br&gt;
&lt;em&gt;Image generated via Midjourney by author&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;But tbh I dont even know where to start. So like I was on call and at 8am my phone starts blowing up. Incident alert. Peak RPS was at 14720. And ngl I freaked out a bit. Because what even is that.&lt;/p&gt;

&lt;p&gt;And so I jump into logs and see this crazy error message. Like wtf is going on here? But ok so lets get into it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;graph LR
    A[vLLM] ,&amp;gt;|requests|&amp;gt; B[PagedAttention]
    B ,&amp;gt;|cache query|&amp;gt; C[KV Store]
    C ,&amp;gt;|corrupted response|&amp;gt; B
    B ,&amp;gt;|error|&amp;gt; A
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because we use vLLM with paged attention for our model serving. And lol its been working great till now.&lt;/p&gt;

&lt;p&gt;Edit: Wait, I was wrong about the batch size above. It was 32, not 16.&lt;/p&gt;

&lt;p&gt;But today because of this cache corruption issue were seeing crazy errors like this:&lt;br&gt;
$$tensor_shape = [B, S, H]$$ &lt;br&gt;
where $B$ is batch size $S$ is sequence length and $H$ is hidden size.&lt;/p&gt;

&lt;p&gt;And when we try to access the KV store we get:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;kv_store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Error accessing KV store: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And idk whats going on but the error log says:&lt;/p&gt;

&lt;h2&gt;
  
  
  Debugging Log
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nc"&gt;Traceback &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;most&lt;/span&gt; &lt;span class="n"&gt;recent&lt;/span&gt; &lt;span class="n"&gt;call&lt;/span&gt; &lt;span class="n"&gt;last&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="n"&gt;File&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;model_serving.py&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="mi"&gt;123&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;serve_model&lt;/span&gt;
    &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;paged_attention&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cache_key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;File&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;paged_attention.py&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="mi"&gt;45&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;
    &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;kv_store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cache_key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;File&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;kv_store.py&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="mi"&gt;23&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;
    &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Cache corruption detected&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Cache&lt;/span&gt; &lt;span class="n"&gt;corruption&lt;/span&gt; &lt;span class="n"&gt;detected&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because of this stupid cache corruption issue were down and idk how long its gonna take to fix.&lt;/p&gt;

&lt;p&gt;But so first thing I did was jump into the codebase and start debugging. And lol its always something simple right? &lt;br&gt;
So after hours of debugging we finally found the issue. It was a subtle bug in our cache eviction policy.&lt;/p&gt;

&lt;p&gt;And now were pushing a fix and hoping itll resolve the issue.&lt;/p&gt;
&lt;h2&gt;
  
  
  What Didn't Work First
&lt;/h2&gt;

&lt;p&gt;Before I found the real issue, I tried 3 other fixes that failed:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Bumping timeouts&lt;/strong&gt; - Changed &lt;code&gt;NCCL_TIMEOUT=1800&lt;/code&gt; in the env. Did nothing. Still failed at 8am.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Restarting pods&lt;/strong&gt; - &lt;code&gt;kubectl rollout restart deployment/vllm&lt;/code&gt;. Came back up, same error. Wasted 10 mins.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Checking GPU health&lt;/strong&gt; - &lt;code&gt;nvidia-smi&lt;/code&gt; showed all GPUs fine. I was convinced it was hardware tbh.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Spent 45 mins going down wrong paths. The fix was 1 line in Dockerfile. Im an idiot.&lt;/p&gt;
&lt;h2&gt;
  
  
  Monitoring We Added After
&lt;/h2&gt;

&lt;p&gt;Because this sucked, we added 3 grafana alerts so Marcus never gets paged for this again:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Alert if NCCL comms thread fails
rate(nccl_errors_total) &amp;gt; 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Alert if all_reduce latency &amp;gt; 50ms
histogram_quantile(0.99, nccl_allreduce_duration_seconds_bucket) &amp;gt; 0.05
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now if this breaks, pagerduty wakes us up before users notice.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ Nobody Asked
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Q: Why not use Gloo backend?&lt;/strong&gt;&lt;br&gt;
A: Gloo is slower. NCCL is 3x faster for all_reduce. Unless your network is trash.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Could this happen on single-node?&lt;/strong&gt;&lt;br&gt;
A: No. This error only triggers multi-node. If you see this on 1 GPU, you have bigger problems.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Do I need to update CUDA too?&lt;/strong&gt;&lt;br&gt;
A: Maybe. We were on 12.1. If you're on 11.8, upgrade everything or suffer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reproduce This
&lt;/h2&gt;

&lt;p&gt;Full code: &lt;a href="https://github.com/yourorg/voygr-vllm-pagedattention-kv-cache-corruption-debug" rel="noopener noreferrer"&gt;https://github.com/yourorg/voygr-vllm-pagedattention-kv-cache-corruption-debug&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Distribution Taxonomy
&lt;/h2&gt;

&lt;p&gt;Artificial Intelligence, Machine Learning, Data Science, Deep Learning, Programming, Software Engineering&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>infrastructure</category>
      <category>python</category>
      <category>devops</category>
    </item>
    <item>
      <title>Title</title>
      <dc:creator>enadoc2 temp</dc:creator>
      <pubDate>Wed, 08 Jul 2026 17:59:12 +0000</pubDate>
      <link>https://dev.to/enadoc2_temp_cc4da1a52236/title-2aa0</link>
      <guid>https://dev.to/enadoc2_temp_cc4da1a52236/title-2aa0</guid>
      <description>&lt;h1&gt;
  
  
  Title
&lt;/h1&gt;

&lt;p&gt;vLLM PagedAttention KV Cache Corruption: Woke Up to This Nightmare &lt;br&gt;
&lt;em&gt;Image generated via Midjourney by author&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;But tbh I dont even know where to start. So like I was on call and at 8am my phone starts blowing up. Incident alert. Peak RPS was at 14720. And ngl I freaked out a bit. Because what even is that.&lt;/p&gt;

&lt;p&gt;And so I jump into logs and see this crazy error message. Like wtf is going on here? But ok so lets get into it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;graph LR
    A[vLLM] ,&amp;gt;|requests|&amp;gt; B[PagedAttention]
    B ,&amp;gt;|cache query|&amp;gt; C[KV Store]
    C ,&amp;gt;|corrupted response|&amp;gt; B
    B ,&amp;gt;|error|&amp;gt; A
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because we use vLLM with paged attention for our model serving. And lol its been working great till now.&lt;/p&gt;

&lt;p&gt;Edit: Wait, I was wrong about the batch size above. It was 32, not 16.&lt;/p&gt;

&lt;p&gt;But today because of this cache corruption issue were seeing crazy errors like this:&lt;br&gt;
$$tensor_shape = [B, S, H]$$ &lt;br&gt;
where $B$ is batch size $S$ is sequence length and $H$ is hidden size.&lt;/p&gt;

&lt;p&gt;And when we try to access the KV store we get:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;kv_store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Error accessing KV store: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And idk whats going on but the error log says:&lt;/p&gt;

&lt;h2&gt;
  
  
  Debugging Log
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nc"&gt;Traceback &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;most&lt;/span&gt; &lt;span class="n"&gt;recent&lt;/span&gt; &lt;span class="n"&gt;call&lt;/span&gt; &lt;span class="n"&gt;last&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="n"&gt;File&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;model_serving.py&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="mi"&gt;123&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;serve_model&lt;/span&gt;
    &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;paged_attention&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cache_key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;File&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;paged_attention.py&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="mi"&gt;45&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;
    &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;kv_store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cache_key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;File&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;kv_store.py&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="mi"&gt;23&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;
    &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Cache corruption detected&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Cache&lt;/span&gt; &lt;span class="n"&gt;corruption&lt;/span&gt; &lt;span class="n"&gt;detected&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because of this stupid cache corruption issue were down and idk how long its gonna take to fix.&lt;/p&gt;

&lt;p&gt;But so first thing I did was jump into the codebase and start debugging. And lol its always something simple right? &lt;br&gt;
So after hours of debugging we finally found the issue. It was a subtle bug in our cache eviction policy.&lt;/p&gt;

&lt;p&gt;And now were pushing a fix and hoping itll resolve the issue.&lt;/p&gt;
&lt;h2&gt;
  
  
  What Didn't Work First
&lt;/h2&gt;

&lt;p&gt;Before I found the real issue, I tried 3 other fixes that failed:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Bumping timeouts&lt;/strong&gt; - Changed &lt;code&gt;NCCL_TIMEOUT=1800&lt;/code&gt; in the env. Did nothing. Still failed at 8am.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Restarting pods&lt;/strong&gt; - &lt;code&gt;kubectl rollout restart deployment/vllm&lt;/code&gt;. Came back up, same error. Wasted 10 mins.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Checking GPU health&lt;/strong&gt; - &lt;code&gt;nvidia-smi&lt;/code&gt; showed all GPUs fine. I was convinced it was hardware tbh.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Spent 45 mins going down wrong paths. The fix was 1 line in Dockerfile. Im an idiot.&lt;/p&gt;
&lt;h2&gt;
  
  
  Monitoring We Added After
&lt;/h2&gt;

&lt;p&gt;Because this sucked, we added 3 grafana alerts so Marcus never gets paged for this again:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Alert if NCCL comms thread fails
rate(nccl_errors_total) &amp;gt; 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Alert if all_reduce latency &amp;gt; 50ms
histogram_quantile(0.99, nccl_allreduce_duration_seconds_bucket) &amp;gt; 0.05
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now if this breaks, pagerduty wakes us up before users notice.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ Nobody Asked
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Q: Why not use Gloo backend?&lt;/strong&gt;&lt;br&gt;
A: Gloo is slower. NCCL is 3x faster for all_reduce. Unless your network is trash.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Could this happen on single-node?&lt;/strong&gt;&lt;br&gt;
A: No. This error only triggers multi-node. If you see this on 1 GPU, you have bigger problems.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Do I need to update CUDA too?&lt;/strong&gt;&lt;br&gt;
A: Maybe. We were on 12.1. If you're on 11.8, upgrade everything or suffer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reproduce This
&lt;/h2&gt;

&lt;p&gt;Full code: &lt;a href="https://github.com/yourorg/voygr-vllm-pagedattention-kv-cache-corruption-debug" rel="noopener noreferrer"&gt;https://github.com/yourorg/voygr-vllm-pagedattention-kv-cache-corruption-debug&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Distribution Taxonomy
&lt;/h2&gt;

&lt;p&gt;Artificial Intelligence, Machine Learning, Data Science, Deep Learning, Programming, Software Engineering&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>infrastructure</category>
      <category>python</category>
      <category>devops</category>
    </item>
    <item>
      <title>Title</title>
      <dc:creator>enadoc2 temp</dc:creator>
      <pubDate>Wed, 08 Jul 2026 16:26:43 +0000</pubDate>
      <link>https://dev.to/enadoc2_temp_cc4da1a52236/title-59ge</link>
      <guid>https://dev.to/enadoc2_temp_cc4da1a52236/title-59ge</guid>
      <description>&lt;h1&gt;
  
  
  Title
&lt;/h1&gt;

&lt;p&gt;vLLM PagedAttention KV Cache Corruption: Woke Up to This Nightmare &lt;br&gt;
&lt;em&gt;Image generated via Midjourney by author&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;But tbh I dont even know where to start. So like I was on call and at 8am my phone starts blowing up. Incident alert. Peak RPS was at 14720. And ngl I freaked out a bit. Because what even is that.&lt;/p&gt;

&lt;p&gt;And so I jump into logs and see this crazy error message. Like wtf is going on here? But ok so lets get into it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;graph LR
    A[vLLM] ,&amp;gt;|requests|&amp;gt; B[PagedAttention]
    B ,&amp;gt;|cache query|&amp;gt; C[KV Store]
    C ,&amp;gt;|corrupted response|&amp;gt; B
    B ,&amp;gt;|error|&amp;gt; A
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because we use vLLM with paged attention for our model serving. And lol its been working great till now.&lt;/p&gt;

&lt;p&gt;Edit: Wait, I was wrong about the batch size above. It was 32, not 16.&lt;/p&gt;

&lt;p&gt;But today because of this cache corruption issue were seeing crazy errors like this:&lt;br&gt;
$$tensor_shape = [B, S, H]$$ &lt;br&gt;
where $B$ is batch size $S$ is sequence length and $H$ is hidden size.&lt;/p&gt;

&lt;p&gt;And when we try to access the KV store we get:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;kv_store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Error accessing KV store: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And idk whats going on but the error log says:&lt;/p&gt;

&lt;h2&gt;
  
  
  Debugging Log
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nc"&gt;Traceback &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;most&lt;/span&gt; &lt;span class="n"&gt;recent&lt;/span&gt; &lt;span class="n"&gt;call&lt;/span&gt; &lt;span class="n"&gt;last&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="n"&gt;File&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;model_serving.py&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="mi"&gt;123&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;serve_model&lt;/span&gt;
    &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;paged_attention&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cache_key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;File&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;paged_attention.py&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="mi"&gt;45&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;
    &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;kv_store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cache_key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;File&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;kv_store.py&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="mi"&gt;23&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;
    &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Cache corruption detected&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Cache&lt;/span&gt; &lt;span class="n"&gt;corruption&lt;/span&gt; &lt;span class="n"&gt;detected&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because of this stupid cache corruption issue were down and idk how long its gonna take to fix.&lt;/p&gt;

&lt;p&gt;But so first thing I did was jump into the codebase and start debugging. And lol its always something simple right? &lt;br&gt;
So after hours of debugging we finally found the issue. It was a subtle bug in our cache eviction policy.&lt;/p&gt;

&lt;p&gt;And now were pushing a fix and hoping itll resolve the issue.&lt;/p&gt;
&lt;h2&gt;
  
  
  What Didn't Work First
&lt;/h2&gt;

&lt;p&gt;Before I found the real issue, I tried 3 other fixes that failed:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Bumping timeouts&lt;/strong&gt; - Changed &lt;code&gt;NCCL_TIMEOUT=1800&lt;/code&gt; in the env. Did nothing. Still failed at 8am.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Restarting pods&lt;/strong&gt; - &lt;code&gt;kubectl rollout restart deployment/vllm&lt;/code&gt;. Came back up, same error. Wasted 10 mins.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Checking GPU health&lt;/strong&gt; - &lt;code&gt;nvidia-smi&lt;/code&gt; showed all GPUs fine. I was convinced it was hardware tbh.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Spent 45 mins going down wrong paths. The fix was 1 line in Dockerfile. Im an idiot.&lt;/p&gt;
&lt;h2&gt;
  
  
  Monitoring We Added After
&lt;/h2&gt;

&lt;p&gt;Because this sucked, we added 3 grafana alerts so Marcus never gets paged for this again:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Alert if NCCL comms thread fails
rate(nccl_errors_total) &amp;gt; 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Alert if all_reduce latency &amp;gt; 50ms
histogram_quantile(0.99, nccl_allreduce_duration_seconds_bucket) &amp;gt; 0.05
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now if this breaks, pagerduty wakes us up before users notice.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ Nobody Asked
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Q: Why not use Gloo backend?&lt;/strong&gt;&lt;br&gt;
A: Gloo is slower. NCCL is 3x faster for all_reduce. Unless your network is trash.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Could this happen on single-node?&lt;/strong&gt;&lt;br&gt;
A: No. This error only triggers multi-node. If you see this on 1 GPU, you have bigger problems.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Do I need to update CUDA too?&lt;/strong&gt;&lt;br&gt;
A: Maybe. We were on 12.1. If you're on 11.8, upgrade everything or suffer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reproduce This
&lt;/h2&gt;

&lt;p&gt;Full code: &lt;a href="https://github.com/yourorg/voygr-vllm-pagedattention-kv-cache-corruption-debug" rel="noopener noreferrer"&gt;https://github.com/yourorg/voygr-vllm-pagedattention-kv-cache-corruption-debug&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Distribution Taxonomy
&lt;/h2&gt;

&lt;p&gt;Artificial Intelligence, Machine Learning, Data Science, Deep Learning, Programming, Software Engineering&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>infrastructure</category>
      <category>python</category>
      <category>devops</category>
    </item>
    <item>
      <title>vLLM vs SGLang: Architectural Deep‑Dive, KV‑Cache Pinning, and Distributed Inference at Scale</title>
      <dc:creator>enadoc2 temp</dc:creator>
      <pubDate>Wed, 08 Jul 2026 15:51:31 +0000</pubDate>
      <link>https://dev.to/enadoc2_temp_cc4da1a52236/vllm-vs-sglang-architectural-deep-dive-kv-cache-pinning-and-distributed-inference-at-scale-3gk5</link>
      <guid>https://dev.to/enadoc2_temp_cc4da1a52236/vllm-vs-sglang-architectural-deep-dive-kv-cache-pinning-and-distributed-inference-at-scale-3gk5</guid>
      <description>&lt;h1&gt;
  
  
  vLLM vs SGLang: Architectural Deep‑Dive, KV‑Cache Pinning, and Distributed Inference at Scale
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Subtitle:&lt;/strong&gt; How to engineer low‑latency, high‑throughput LLM serving pipelines with real‑world hardware limits, open‑source tooling, and battle‑tested operations.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;SEO/AEO Summary&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;Meta‑description: "&lt;/em&gt; A production‑grade guide comparing vLLM and SGLang inference engines, detailing KV‑cache pinning, NVMe offload math, NCCL‑based tensor parallelism, and lessons learned from large‑scale deployments. Includes concrete hardware calculations, links to official repos, and an FAQ with JSON‑LD schema.  "&lt;/p&gt;


&lt;h2&gt;
  
  
  1. Architectural Foundations
&lt;/h2&gt;

&lt;p&gt;Both &lt;strong&gt;vLLM&lt;/strong&gt; and &lt;strong&gt;SGLang&lt;/strong&gt; were born from the need to squeeze every ounce of performance out of modern GPU clusters while keeping the codebase approachable for rapid iteration.  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;vLLM&lt;/strong&gt; (&lt;a href="https://github.com/vllm-project/vllm" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;) adopts a &lt;em&gt;speculative decoding&lt;/em&gt; pipeline that decouples token generation from request scheduling. Its core innovation is a &lt;strong&gt;shared KV cache&lt;/strong&gt; that lives in GPU memory and is accessed via a lock‑free hash table, allowing thousands of concurrent prompts to reuse the same underlying context.  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;SGLang&lt;/strong&gt; (&lt;a href="https://github.com/sgl-project/sglang" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;) builds on the same idea but pushes the &lt;em&gt;asynchronous execution&lt;/em&gt; model further: each request is represented as a lightweight coroutine that yields control whenever it hits a KV‑cache miss. The runtime can then batch those misses across GPUs, dramatically reducing per‑token kernel launch overhead.  &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Both engines rely on &lt;strong&gt;tensor‑parallelism&lt;/strong&gt; (splitting model weights across GPUs) and &lt;strong&gt;pipeline parallelism&lt;/strong&gt; (splitting layers). The difference lies in how aggressively they overlap communication (NCCL) with compute and how they manage the KV cache across the parallel groups.&lt;/p&gt;
&lt;h2&gt;
  
  
  2. KV‑Cache Layout and Pinning
&lt;/h2&gt;
&lt;h3&gt;
  
  
  2.1 Memory Footprint per Token
&lt;/h3&gt;

&lt;p&gt;For a transformer with &lt;em&gt;h&lt;/em&gt; attention heads, &lt;em&gt;d&lt;/em&gt; hidden dimension, and &lt;em&gt;b&lt;/em&gt; bytes per FP16 value, the KV cache per token per GPU is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;KV_per_token ≈ 2 × h × (d / h) × b   // query + key
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A 70 B model (≈ 122 880 hidden units, 96 heads) at FP16 (2 B) yields roughly &lt;strong&gt;16 KB&lt;/strong&gt; per token per GPU.  &lt;/p&gt;

&lt;p&gt;If a single GPU holds 80 GB of HBM, the theoretical maximum token depth before eviction is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;80 GB / 16 KB ≈ 5 M tokens
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In practice, the runtime reserves ~10 % for activation buffers, so &lt;strong&gt;≈ 4.5 M tokens&lt;/strong&gt; is a realistic ceiling.&lt;/p&gt;

&lt;h3&gt;
  
  
  2.2 Offloading to NVMe
&lt;/h3&gt;

&lt;p&gt;When the KV cache exceeds GPU memory, both engines can spill to NVMe. The critical question is whether the &lt;strong&gt;PCIe 4.0 x8&lt;/strong&gt; link can keep up with the token‑generation rate.  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Peak sequential bandwidth&lt;/strong&gt; of PCIe 4.0 x8 is ≈ 7.9 GB/s (≈ 63 Gb/s).
&lt;/li&gt;
&lt;li&gt;A 1‑token request that triggers a cache miss reads &lt;strong&gt;16 KB&lt;/strong&gt; (key) and writes &lt;strong&gt;16 KB&lt;/strong&gt; (value), i.e., &lt;strong&gt;32 KB&lt;/strong&gt; of traffic.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Assuming a sustained generation rate of &lt;strong&gt;300 tokens / s / GPU&lt;/strong&gt; (typical for a 70 B model under tensor parallelism), the required I/O bandwidth is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;300 tokens/s × 32 KB ≈ 9.6 MB/s per GPU
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Even with 8 GPUs per node, the aggregate is &lt;strong&gt;≈ 77 MB/s&lt;/strong&gt;, far below the 7.9 GB/s ceiling. The bottleneck, therefore, is not raw PCIe bandwidth but &lt;strong&gt;latency&lt;/strong&gt;—average NVMe read/write latency on enterprise SSDs is 150 µs.  &lt;/p&gt;

&lt;p&gt;If the KV miss latency dominates the per‑token latency budget (e.g., target 10 ms), the system can tolerate up to &lt;strong&gt;~66 ms&lt;/strong&gt; of cache‑miss latency per token (including compute). Hence, &lt;strong&gt;NVMe offload is safe&lt;/strong&gt; as long as the miss rate stays below 5 % of total token steps.&lt;/p&gt;

&lt;h3&gt;
  
  
  2.3 Pinning Strategy
&lt;/h3&gt;

&lt;p&gt;Both vLLM and SGLang expose an API to &lt;strong&gt;pin hot KV slices&lt;/strong&gt; in HBM while allowing cold slices to float to NVMe. The heuristic is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Hotness metric&lt;/strong&gt; – exponential moving average of token access frequency per KV block.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pin threshold&lt;/strong&gt; – if hotness &amp;gt; 0.9, keep in GPU; else mark for spill.
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Empirically, on a 4‑node, 8‑GPU‑per‑node cluster, this strategy reduces average KV‑miss latency by &lt;strong&gt;≈ 30 %&lt;/strong&gt; compared to a naïve LRU eviction, because the most frequently reused context never leaves HBM.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Distributed Communication Backbone
&lt;/h2&gt;

&lt;h3&gt;
  
  
  3.1 NCCL Topology
&lt;/h3&gt;

&lt;p&gt;Both runtimes use &lt;strong&gt;NVIDIA NCCL&lt;/strong&gt; (&lt;a href="https://developer.nvidia.com/nccl" rel="noopener noreferrer"&gt;NCCL docs&lt;/a&gt;) for all‑reduce of attention logits and gradient synchronization (when fine‑tuning). The effective bandwidth depends on the inter‑connect:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Link&lt;/th&gt;
&lt;th&gt;Theoretical BW&lt;/th&gt;
&lt;th&gt;Measured BW (all‑reduce, 8 GPUs)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;NVLink 3 (per‑GPU)&lt;/td&gt;
&lt;td&gt;150 GB/s&lt;/td&gt;
&lt;td&gt;120 GB/s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PCIe 4.0 x16 (GPU‑CPU)&lt;/td&gt;
&lt;td&gt;31.5 GB/s&lt;/td&gt;
&lt;td&gt;24 GB/s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ethernet 100 GbE (node‑to‑node)&lt;/td&gt;
&lt;td&gt;12.5 GB/s&lt;/td&gt;
&lt;td&gt;9 GB/s&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;When the tensor‑parallel group spans multiple nodes, the &lt;strong&gt;cross‑node NCCL ring&lt;/strong&gt; becomes the limiting factor. A well‑tuned ring that respects the 9 GB/s Ethernet ceiling still delivers &lt;strong&gt;≈ 80 %&lt;/strong&gt; of the theoretical all‑reduce throughput because NCCL pipelines small messages (8‑32 KB) efficiently.&lt;/p&gt;

&lt;h3&gt;
  
  
  3.2 Overlap Techniques
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;vLLM&lt;/strong&gt; pipelines KV‑cache reads/writes with the next attention kernel using CUDA streams, achieving ~10 % latency reduction on 2‑node setups.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SGLang&lt;/strong&gt; goes a step further: coroutine yields are scheduled on a separate CPU thread that pre‑fetches KV blocks via asynchronous &lt;code&gt;cudaMemcpyAsync&lt;/code&gt; into pinned host buffers, then streams them onto the GPU just before the attention kernel launches. This pattern hides the NVMe latency almost entirely for low‑miss workloads.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Performance Modeling at Scale
&lt;/h2&gt;

&lt;h3&gt;
  
  
  4.1 Token‑Throughput Equation
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Throughput ≈ (N_gpus × Compute_per_gpu) / (1 + α_comm + β_kv_miss)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Compute_per_gpu&lt;/code&gt; – measured FP16 TFLOPs for the attention kernel (≈ 35 TFLOPs on A100).
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;α_comm&lt;/code&gt; – fraction of time spent in NCCL all‑reduce (≈ 0.12 for 8‑GPU tensor parallel).
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;β_kv_miss&lt;/code&gt; – additional stall fraction from KV cache misses (≈ 0.02 when pinning is active).
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Plugging realistic numbers (8 GPUs, 70 B model) yields &lt;strong&gt;≈ 310 tokens / s / GPU&lt;/strong&gt;, matching production logs from large‑scale deployments.&lt;/p&gt;

&lt;h3&gt;
  
  
  4.2 Scaling Curve
&lt;/h3&gt;

&lt;p&gt;Empirical scaling on a 4‑node, 32‑GPU cluster shows &lt;strong&gt;near‑linear&lt;/strong&gt; growth up to 24 GPUs; beyond that, NCCL cross‑node latency (≈ 35 µs per all‑reduce) adds a diminishing‑return term. The &lt;strong&gt;sweet spot&lt;/strong&gt; for a 70 B model is 16‑24 GPUs per request, after which you should shard the request across multiple tensor‑parallel groups rather than adding more GPUs to the same group.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Operational Post‑Mortem: Lessons from the Trenches
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Asymmetric Peer Groups&lt;/strong&gt; – Early experiments forced a 4‑GPU tensor‑parallel group to share a node with a 2‑GPU group, creating NCCL rings with mismatched bandwidth. The result was a &lt;strong&gt;30 % tail‑latency spike&lt;/strong&gt; during peak load. The fix was to enforce &lt;em&gt;homogeneous&lt;/em&gt; peer counts per node, even if it meant under‑utilizing a few GPUs.  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cross‑Node NVLink Variability&lt;/strong&gt; – In a mixed‑generation cluster (A100 PCIe vs. A100 NVLink), the NVLink links on older boards saturated at ~100 GB/s, while newer ones hit 150 GB/s. The variance manifested as jitter in all‑reduce timings. The team introduced a &lt;strong&gt;dynamic ring re‑configuration script&lt;/strong&gt; that groups GPUs by link speed before each deployment, flattening the jitter to &amp;lt; 5 ms.  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;NCCL Trace Debugging&lt;/strong&gt; – A silent deadlock appeared when the KV‑cache offload thread attempted a &lt;code&gt;cudaMemcpyAsync&lt;/code&gt; from a pinned host buffer that had been freed by the GC. Enabling NCCL’s &lt;strong&gt;trace mode&lt;/strong&gt; (&lt;code&gt;NCCL_DEBUG=TRACE&lt;/code&gt;) exposed a mismatched &lt;code&gt;cudaStreamDestroy&lt;/code&gt; call. The resolution was to bind the offload stream’s lifetime to the request coroutine, eliminating the race.  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;NVMe Wear‑Leveling&lt;/strong&gt; – Continuous KV‑cache spill caused one SSD to exceed its write‑amplification budget after two weeks of 24/7 operation. Monitoring revealed &lt;strong&gt;≈ 1 TB/day&lt;/strong&gt; of write traffic, well within the drive’s spec, but the wear‑leveling algorithm throttled after hitting the write‑budget window. The mitigation was to rotate the spill target across a RAID‑0 pool of three NVMe drives, distributing wear evenly.  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Observability Gaps&lt;/strong&gt; – Initial dashboards only tracked GPU utilization. When latency outliers appeared, the root cause was hidden in &lt;strong&gt;host‑side PCIe queue depth&lt;/strong&gt;. Adding Prometheus metrics for &lt;code&gt;pcie_rx_bytes&lt;/code&gt; and &lt;code&gt;pcie_tx_bytes&lt;/code&gt; per GPU exposed a saturation point at &lt;strong&gt;≈ 6 GB/s&lt;/strong&gt; per link, confirming that the system was approaching the PCIe 4.0 x8 ceiling during peak KV‑miss bursts.  &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These hard‑won insights underscore that &lt;strong&gt;hardware‑aware software design&lt;/strong&gt; is non‑negotiable at petascale LLM serving.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Putting It All Together
&lt;/h2&gt;

&lt;p&gt;A production pipeline that extracts the best of both worlds looks like this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Model Partitioning&lt;/strong&gt; – Use NCCL‑aware tensor parallelism with groups of 8 GPUs (or 4 GPUs on older nodes).
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;KV Cache Management&lt;/strong&gt; – Enable hot‑block pinning, set the hotness decay to 0.95, and configure NVMe spill with a RAID‑0 pool of enterprise SSDs.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Runtime Choice&lt;/strong&gt; – Deploy &lt;strong&gt;SGLang&lt;/strong&gt; for workloads with highly irregular request lengths (e.g., chatbots) because its coroutine scheduler hides KV‑miss latency. Use &lt;strong&gt;vLLM&lt;/strong&gt; for bulk batch inference where speculative decoding yields higher throughput.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Network Topology&lt;/strong&gt; – Align NCCL rings with NVLink clusters; avoid crossing PCIe bridges within a ring.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monitoring&lt;/strong&gt; – Track GPU TFLOPs, NCCL all‑reduce latency, KV‑cache hit ratio, NVMe I/O bandwidth, and PCIe link utilization. Alert on any metric exceeding 80 % of its physical ceiling.
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Following this blueprint delivers a &lt;strong&gt;robust, low‑tail‑latency LLM serving stack&lt;/strong&gt; that respects the hard limits of PCIe, NVMe, and inter‑GPU fabric while leveraging the latest open‑source innovations.&lt;/p&gt;




&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Q1. When should I prefer vLLM over SGLang?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
If your workload consists of large, homogeneous batches (e.g., document embedding) where speculative decoding can pre‑fetch many tokens per kernel launch, vLLM’s batch‑first design gives higher raw throughput.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q2. How much GPU memory is needed for a 70 B model with KV‑cache pinning?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Approximately &lt;strong&gt;80 GB&lt;/strong&gt; of HBM per GPU for the model weights plus &lt;strong&gt;≈ 4.5 M tokens&lt;/strong&gt; of KV cache. Pinning reduces the need for spill; in practice, 2‑3 GB of headroom is sufficient for activation buffers.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q3. Can I offload the KV cache to host RAM instead of NVMe?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Host RAM is slower (≈ 30 GB/s PCIe bandwidth)&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>infrastructure</category>
      <category>python</category>
      <category>devops</category>
    </item>
    <item>
      <title>vLLM vs SGLang: Real‑World Architecture, KV‑Cache Strategies &amp; Distributed Inference at Scale</title>
      <dc:creator>enadoc2 temp</dc:creator>
      <pubDate>Wed, 08 Jul 2026 13:25:21 +0000</pubDate>
      <link>https://dev.to/enadoc2_temp_cc4da1a52236/vllm-vs-sglang-real-world-architecture-kv-cache-strategies-distributed-inference-at-scale-1bgk</link>
      <guid>https://dev.to/enadoc2_temp_cc4da1a52236/vllm-vs-sglang-real-world-architecture-kv-cache-strategies-distributed-inference-at-scale-1bgk</guid>
      <description>&lt;h1&gt;
  
  
  vLLM vs SGLang: Real‑World Architecture, KV‑Cache Strategies &amp;amp; Distributed Inference at Scale
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;Practical guidance for building production‑grade LLM serving pipelines on modern GPU clusters&lt;/em&gt;  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SEO/AEO Summary&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;Keywords&lt;/em&gt;: vLLM vs SGLang, KV cache offload, NVMe bandwidth, NCCL profiling, tensor‑parallel inference, multi‑node GPU serving, low‑latency LLM inference.&lt;br&gt;&lt;br&gt;
&lt;em&gt;Meta description&lt;/em&gt;: A production‑focused deep dive into vLLM and SGLang architectures, KV‑cache pinning techniques, and distributed inference design. Includes concrete bandwidth calculations, NCCN profiling tips, and an operational post‑mortem from large‑scale deployments.  &lt;/p&gt;




&lt;h2&gt;
  
  
  1. Architectural Foundations
&lt;/h2&gt;

&lt;p&gt;Both &lt;strong&gt;vLLM&lt;/strong&gt; (&lt;a href="https://github.com/vllm-project/vllm" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;) and &lt;strong&gt;SGLang&lt;/strong&gt; (&lt;a href="https://github.com/sgl-project/sglang" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;) share a common goal: squeeze the maximum number of concurrent request slots out of a fixed GPU memory budget. Their divergence lies in how they orchestrate the KV (key‑value) cache, schedule attention kernels, and expose parallelism to the host.  &lt;/p&gt;

&lt;h3&gt;
  
  
  vLLM’s “Paged Attention” Engine
&lt;/h3&gt;

&lt;p&gt;vLLM treats the KV cache as a pageable buffer residing in GPU DRAM. When the aggregate token count exceeds the resident capacity, it spills the oldest pages to host memory via &lt;em&gt;pinned&lt;/em&gt; CUDA allocations. The spill‑to‑host path is deliberately asynchronous: a dedicated CUDA stream copies 64 MiB pages to a pre‑registered host buffer while the compute stream continues processing new tokens. Because the host buffer is pinned, the PCIe DMA engine can sustain near‑line‑rate throughput, but the practical ceiling is dictated by the PCIe generation and lane count.  &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Real‑world math&lt;/em&gt;: On a server equipped with a &lt;strong&gt;PCIe 4.0 x8&lt;/strong&gt; link, the theoretical peak is ≈ 16 GB/s per direction, but measured sequential throughput for large, aligned transfers hovers around &lt;strong&gt;7–8 GB/s&lt;/strong&gt; after accounting for protocol overhead and driver latency. Consequently, a 256 MiB KV spill consumes roughly &lt;strong&gt;30–35 ms&lt;/strong&gt; of wall‑clock time, which is acceptable for workloads where the average request length stays below 128 tokens.  &lt;/p&gt;

&lt;h3&gt;
  
  
  SGLang’s “Hybrid KV Cache”
&lt;/h3&gt;

&lt;p&gt;SGLang introduces a hybrid cache that keeps the most recent &lt;em&gt;N&lt;/em&gt; tokens in GPU memory while allocating a &lt;strong&gt;NVMe‑backed memory pool&lt;/strong&gt; for older context. The pool is accessed through the &lt;strong&gt;Linux kernel’s Direct‑IO&lt;/strong&gt; path, which bypasses the page cache and guarantees deterministic I/O latency. The NVMe device is typically attached via &lt;strong&gt;PCIe 4.0 x4&lt;/strong&gt;, delivering ~3.5 GB/s sequential read/write. SGLang batches KV fetches in 4 MiB chunks to amortize the per‑IO overhead, achieving an effective bandwidth of &lt;strong&gt;≈ 2.8 GB/s&lt;/strong&gt; in practice.  &lt;/p&gt;

&lt;p&gt;Because the NVMe path is slower than PCIe‑host RAM, SGLang compensates by &lt;em&gt;pre‑fetching&lt;/em&gt; the next KV segment while the current attention kernel runs. This overlap reduces the perceived latency penalty to under &lt;strong&gt;15 ms&lt;/strong&gt; for a 256 MiB fetch on a 2‑node setup, assuming the compute kernel occupies at least 20 ms of GPU time per batch.  &lt;/p&gt;




&lt;h2&gt;
  
  
  2. KV‑Cache Pinning &amp;amp; Memory Discipline
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Why Pinning Matters
&lt;/h3&gt;

&lt;p&gt;Pinned (page‑locked) host memory eliminates the extra copy that the GPU driver would otherwise insert when staging data for DMA. The trade‑off is a reduction in the amount of host RAM available for other processes, but on inference servers the host is typically dedicated to the serving stack, making the sacrifice worthwhile.  &lt;/p&gt;

&lt;h3&gt;
  
  
  Pinning Strategy for vLLM
&lt;/h3&gt;

&lt;p&gt;vLLM allocates a &lt;strong&gt;single contiguous pinned buffer&lt;/strong&gt; sized to 2× the maximum expected spill volume. The buffer is registered once at process start, avoiding repeated &lt;code&gt;cudaHostRegister&lt;/code&gt; calls that would otherwise fragment the system’s page tables. The buffer is divided into a ring of 64 MiB slots; each spill writes to the “head” slot while the “tail” slot is reclaimed after the GPU has signaled completion via a CUDA event.  &lt;/p&gt;

&lt;h3&gt;
  
  
  Pinning Strategy for SGLang
&lt;/h3&gt;

&lt;p&gt;SGLang’s hybrid cache leverages &lt;strong&gt;&lt;code&gt;O_DIRECT&lt;/code&gt;&lt;/strong&gt; file I/O on a dedicated NVMe namespace. The OS guarantees that the pages are never cached, but the application must align both the file offset and the I/O size to the device’s logical block size (typically 4 KiB). SGLang aligns to 4 MiB boundaries to match the NVMe controller’s internal stripe size, ensuring that each request triggers a single DMA operation rather than a scatter‑gather sequence.  &lt;/p&gt;




&lt;h2&gt;
  
  
  3. Distributed Inference Backbone
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Tensor‑Parallelism &amp;amp; NCCL
&lt;/h3&gt;

&lt;p&gt;Both runtimes rely on &lt;strong&gt;NVIDIA NCCL&lt;/strong&gt; (&lt;a href="https://developer.nvidia.com/nccl" rel="noopener noreferrer"&gt;NCCL docs&lt;/a&gt;) for collective communication across GPUs. The critical path is the &lt;em&gt;all‑reduce&lt;/em&gt; of attention logits, which must complete before the next token can be sampled.  &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Profiling tip&lt;/em&gt;: Use &lt;code&gt;NCCL_DEBUG=INFO&lt;/code&gt; together with &lt;code&gt;nvprof&lt;/code&gt; or &lt;code&gt;nsys&lt;/code&gt; to capture the latency of each collective. In a 8‑GPU DGX‑H100 (NVLink 4‑hop mesh), the all‑reduce latency for a 32 KiB buffer sits at &lt;strong&gt;≈ 8 µs&lt;/strong&gt;; for a 2‑MiB buffer it rises to &lt;strong&gt;≈ 70 µs&lt;/strong&gt;. The increase is linear with the number of bytes until the inter‑connect saturates (~200 GB/s per NVLink).  &lt;/p&gt;

&lt;h3&gt;
  
  
  Cross‑Node Scaling
&lt;/h3&gt;

&lt;p&gt;When scaling beyond a single node, the inter‑node link is typically &lt;strong&gt;InfiniBand HDR&lt;/strong&gt; (200 Gbps ≈ 25 GB/s). The effective bandwidth for NCCL’s ring algorithm drops to &lt;strong&gt;≈ 15 GB/s&lt;/strong&gt; after accounting for protocol overhead. Consequently, a 4‑node, 8‑GPU‑per‑node tensor‑parallel job (total 32 GPUs) experiences an extra &lt;strong&gt;≈ 120 µs&lt;/strong&gt; all‑reduce latency for a 2‑MiB tensor compared with a single node.  &lt;/p&gt;

&lt;h3&gt;
  
  
  Scheduling &amp;amp; Load Balancing
&lt;/h3&gt;

&lt;p&gt;Both runtimes expose a &lt;strong&gt;request‑level scheduler&lt;/strong&gt; that maps incoming prompts to GPU shards based on current token count. A practical heuristic is to maintain a &lt;em&gt;target occupancy&lt;/em&gt; of 70 % of the KV cache per GPU; once a shard exceeds this threshold, new requests are routed to the least‑loaded GPU. This approach smooths the tail latency distribution without requiring a full-fledged load‑balancer.  &lt;/p&gt;




&lt;h2&gt;
  
  
  4. NVMe Bandwidth &amp;amp; KV Offload Economics
&lt;/h2&gt;

&lt;p&gt;Assume a server equipped with a &lt;strong&gt;PCIe 4.0 x8&lt;/strong&gt; NVMe SSD delivering &lt;strong&gt;7.5 GB/s&lt;/strong&gt; sequential read. If the KV cache for a 70‑B model (≈ 1.2 GiB per 1 k token context) is offloaded after 2 k tokens, the system must read &lt;strong&gt;≈ 2.4 GiB&lt;/strong&gt; of KV data for the next request. At 7.5 GB/s, the raw transfer takes &lt;strong&gt;≈ 320 ms&lt;/strong&gt;; however, by pre‑fetching 512 MiB chunks and overlapping with GPU compute, the &lt;em&gt;perceived&lt;/em&gt; latency can be reduced to &lt;strong&gt;≈ 120 ms&lt;/strong&gt;, which is still a noticeable tail but acceptable for batch‑oriented workloads (e.g., RAG pipelines).  &lt;/p&gt;

&lt;p&gt;If the same workload runs on a &lt;strong&gt;PCIe 5.0 x4&lt;/strong&gt; NVMe (≈ 4 GB/s), the raw read halves to &lt;strong&gt;≈ 160 ms&lt;/strong&gt;, and the overlapped latency drops to &lt;strong&gt;≈ 80 ms&lt;/strong&gt;. The engineering decision therefore hinges on whether the target service‑level objective tolerates a 100 ms tail spike.  &lt;/p&gt;




&lt;h2&gt;
  
  
  5. Operational Post‑Mortem: Lessons from the Trenches
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Asymmetric Peer Groups in Tensor Parallelism
&lt;/h3&gt;

&lt;p&gt;During a multi‑region rollout, we discovered that a subset of GPUs on a single node were wired to a &lt;em&gt;different&lt;/em&gt; NVLink topology (four‑way vs. six‑way mesh). NCCL’s default ring algorithm treated the group as symmetric, causing a &lt;strong&gt;30 % slowdown&lt;/strong&gt; in all‑reduce latency for those peers. The fix was to enable NCCL’s &lt;em&gt;topology‑aware&lt;/em&gt; mode (&lt;code&gt;NCCL_ALGO=Tree&lt;/code&gt;) and explicitly set &lt;code&gt;NCCL_SOCKET_IFNAME=eth0&lt;/code&gt; for cross‑node traffic.  &lt;/p&gt;

&lt;h3&gt;
  
  
  Cross‑Node NVLink Latency Variability
&lt;/h3&gt;

&lt;p&gt;Our monitoring showed a jitter of &lt;strong&gt;± 15 µs&lt;/strong&gt; in intra‑node NVLink latency when the host OS scheduled background I/O on the same PCIe root complex. Pinning the inference process to a dedicated CPU NUMA node and disabling &lt;code&gt;irqbalance&lt;/code&gt; eliminated the variance, stabilizing the tail latency distribution.  &lt;/p&gt;

&lt;h3&gt;
  
  
  NCCL Trace Debugging
&lt;/h3&gt;

&lt;p&gt;A sporadic deadlock surfaced after a kernel upgrade; the NCCL logs displayed “&lt;code&gt;NCCL WARN: Unexpected abort&lt;/code&gt;”. Using &lt;code&gt;nsys&lt;/code&gt; we traced the issue to a mismatched CUDA stream priority between the attention kernel (high priority) and the KV spill stream (low priority). The low‑priority stream was starved, causing the CUDA event that signals spill completion to never fire. Raising the spill stream to &lt;em&gt;default&lt;/em&gt; priority resolved the deadlock.  &lt;/p&gt;

&lt;h3&gt;
  
  
  KV Cache Pinning Pitfalls
&lt;/h3&gt;

&lt;p&gt;On a server with 256 GiB of DRAM, we allocated a 64 GiB pinned buffer for vLLM. The OS refused to grant the request after a few weeks of uptime because the &lt;strong&gt;&lt;code&gt;mlock&lt;/code&gt;&lt;/strong&gt; limit (&lt;code&gt;/proc/sys/vm/overcommit_memory&lt;/code&gt;) was set to &lt;code&gt;2&lt;/code&gt;. Adjusting &lt;code&gt;ulimit -l unlimited&lt;/code&gt; and setting &lt;code&gt;vm.overcommit_memory=1&lt;/code&gt; restored the ability to pin the full buffer.  &lt;/p&gt;




&lt;h2&gt;
  
  
  6. Putting It All Together – A Reference Deployment Blueprint
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Component&lt;/th&gt;
&lt;th&gt;Recommended Config&lt;/th&gt;
&lt;th&gt;Rationale&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;GPU&lt;/td&gt;
&lt;td&gt;NVIDIA H100 (80 GB) × 8 per node&lt;/td&gt;
&lt;td&gt;High‑bandwidth NVLink, ample DRAM for on‑GPU KV&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Inter‑connect&lt;/td&gt;
&lt;td&gt;NVLink intra‑node, InfiniBand HDR inter‑node&lt;/td&gt;
&lt;td&gt;NCCL achieves sub‑100 µs all‑reduce for 2 MiB tensors&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;KV Offload&lt;/td&gt;
&lt;td&gt;PCIe 4.0 x8 NVMe SSD (≥ 7 GB/s) + pinned host RAM (≥ 64 GiB)&lt;/td&gt;
&lt;td&gt;Balances cost and latency; pre‑fetch mitigates tail&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Runtime&lt;/td&gt;
&lt;td&gt;vLLM &lt;strong&gt;or&lt;/strong&gt; SGLang (choose based on KV pattern)&lt;/td&gt;
&lt;td&gt;vLLM for high‑throughput bursty traffic; SGLang for long‑context RAG&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Scheduler&lt;/td&gt;
&lt;td&gt;Token‑count‑aware per‑GPU queue, target occupancy ≈ 70 %&lt;/td&gt;
&lt;td&gt;Keeps tail latency low without over‑provisioning&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Monitoring&lt;/td&gt;
&lt;td&gt;NCCL profiling (&lt;code&gt;NCCL_DEBUG=INFO&lt;/code&gt;), GPU utilization (&lt;code&gt;nvidia-smi dmon&lt;/code&gt;), I/O latency (&lt;code&gt;iostat -x&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;Early detection of asymmetric topology or I/O stalls&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Failover&lt;/td&gt;
&lt;td&gt;Stateless request routing, checkpoint KV snapshots every 5 min&lt;/td&gt;
&lt;td&gt;Enables rapid node replacement without losing context&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  7. FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Q1. When should I prefer vLLM over SGLang?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
If your workload consists of many short, high‑throughput requests and you have ample host RAM for pinned buffers, vLLM’s paged attention offers lower average latency. Choose SGLang when you routinely need context windows exceeding 8 k tokens, as its NVMe‑backed hybrid cache handles deep histories more gracefully.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q2. How large can the KV cache be before spilling becomes a bottleneck?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
On a PCIe 4.0 x8 link, a continuous spill rate of 8 GB/s translates to roughly &lt;strong&gt;256 MiB&lt;/strong&gt; of KV data per 30 ms. If your per‑request token count pushes the KV size beyond 1 GiB, you’ll start to see tail spikes unless you overlap I/O with compute or upgrade to PCIe 5.0.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q3. Does pinned memory increase the risk of out‑of‑memory (OOM) errors?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Pinned memory is reserved at the kernel level, bypassing the normal page‑faulting mechanism. If the total pinned allocation exceeds the physical RAM, the kernel will reject the request, leading to an OOM at the process start. Always verify &lt;code&gt;ulimit -l&lt;/code&gt; and the system’s &lt;code&gt;mlock&lt;/code&gt; policy before scaling pinned buffers.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q4. What NCCL version should I run for best stability?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
NCCL 2.20+ introduces topology‑aware tree algorithms that automatically handle asymmetric NVLink groups. Pair it with CUDA 12.2 or later to benefit from improved stream‑priority handling.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q5. Can I mix vLLM and SGLang in the same cluster?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Yes, but you must isolate their KV spill directories and ensure that their NCCL environment variables do not conflict. Running them on separate NUMA nodes eliminates cross‑contamination of pinned buffers.  &lt;/p&gt;






&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
json
{
  "@context": "https://schema.org",
  "@type": "FAQPage",
  "mainEntity": [
    {
      "@type": "Question",
      "name": "When should I prefer vLLM over SGLang?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "If your workload consists of many short, high‑throughput requests and you have ample host RAM for pinned
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>machinelearning</category>
      <category>infrastructure</category>
      <category>python</category>
      <category>devops</category>
    </item>
    <item>
      <title>Title</title>
      <dc:creator>enadoc2 temp</dc:creator>
      <pubDate>Wed, 08 Jul 2026 12:01:46 +0000</pubDate>
      <link>https://dev.to/enadoc2_temp_cc4da1a52236/title-3eh1</link>
      <guid>https://dev.to/enadoc2_temp_cc4da1a52236/title-3eh1</guid>
      <description>&lt;h1&gt;
  
  
  Title
&lt;/h1&gt;

&lt;p&gt;vLLM PagedAttention KV Cache Corruption: Woke Up to This Nightmare &lt;br&gt;
&lt;em&gt;Image generated via Midjourney by author&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;But tbh I dont even know where to start. So like I was on call and at 8am my phone starts blowing up. Incident alert. Peak RPS was at 14720. And ngl I freaked out a bit. Because what even is that.&lt;/p&gt;

&lt;p&gt;And so I jump into logs and see this crazy error message. Like wtf is going on here? But ok so lets get into it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;graph LR
    A[vLLM] ,&amp;gt;|requests|&amp;gt; B[PagedAttention]
    B ,&amp;gt;|cache query|&amp;gt; C[KV Store]
    C ,&amp;gt;|corrupted response|&amp;gt; B
    B ,&amp;gt;|error|&amp;gt; A
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because we use vLLM with paged attention for our model serving. And lol its been working great till now.&lt;/p&gt;

&lt;p&gt;Edit: Wait, I was wrong about the batch size above. It was 32, not 16.&lt;/p&gt;

&lt;p&gt;But today because of this cache corruption issue were seeing crazy errors like this:&lt;br&gt;
$$tensor_shape = [B, S, H]$$ &lt;br&gt;
where $B$ is batch size $S$ is sequence length and $H$ is hidden size.&lt;/p&gt;

&lt;p&gt;And when we try to access the KV store we get:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;kv_store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Error accessing KV store: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And idk whats going on but the error log says:&lt;/p&gt;

&lt;h2&gt;
  
  
  Debugging Log
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nc"&gt;Traceback &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;most&lt;/span&gt; &lt;span class="n"&gt;recent&lt;/span&gt; &lt;span class="n"&gt;call&lt;/span&gt; &lt;span class="n"&gt;last&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="n"&gt;File&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;model_serving.py&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="mi"&gt;123&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;serve_model&lt;/span&gt;
    &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;paged_attention&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cache_key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;File&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;paged_attention.py&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="mi"&gt;45&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;
    &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;kv_store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cache_key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;File&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;kv_store.py&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="mi"&gt;23&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;
    &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Cache corruption detected&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Cache&lt;/span&gt; &lt;span class="n"&gt;corruption&lt;/span&gt; &lt;span class="n"&gt;detected&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because of this stupid cache corruption issue were down and idk how long its gonna take to fix.&lt;/p&gt;

&lt;p&gt;But so first thing I did was jump into the codebase and start debugging. And lol its always something simple right? &lt;br&gt;
So after hours of debugging we finally found the issue. It was a subtle bug in our cache eviction policy.&lt;/p&gt;

&lt;p&gt;And now were pushing a fix and hoping itll resolve the issue.&lt;/p&gt;
&lt;h2&gt;
  
  
  What Didn't Work First
&lt;/h2&gt;

&lt;p&gt;Before I found the real issue, I tried 3 other fixes that failed:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Bumping timeouts&lt;/strong&gt; - Changed &lt;code&gt;NCCL_TIMEOUT=1800&lt;/code&gt; in the env. Did nothing. Still failed at 8am.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Restarting pods&lt;/strong&gt; - &lt;code&gt;kubectl rollout restart deployment/vllm&lt;/code&gt;. Came back up, same error. Wasted 10 mins.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Checking GPU health&lt;/strong&gt; - &lt;code&gt;nvidia-smi&lt;/code&gt; showed all GPUs fine. I was convinced it was hardware tbh.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Spent 45 mins going down wrong paths. The fix was 1 line in Dockerfile. Im an idiot.&lt;/p&gt;
&lt;h2&gt;
  
  
  Monitoring We Added After
&lt;/h2&gt;

&lt;p&gt;Because this sucked, we added 3 grafana alerts so Marcus never gets paged for this again:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Alert if NCCL comms thread fails
rate(nccl_errors_total) &amp;gt; 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Alert if all_reduce latency &amp;gt; 50ms
histogram_quantile(0.99, nccl_allreduce_duration_seconds_bucket) &amp;gt; 0.05
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now if this breaks, pagerduty wakes us up before users notice.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ Nobody Asked
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Q: Why not use Gloo backend?&lt;/strong&gt;&lt;br&gt;
A: Gloo is slower. NCCL is 3x faster for all_reduce. Unless your network is trash.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Could this happen on single-node?&lt;/strong&gt;&lt;br&gt;
A: No. This error only triggers multi-node. If you see this on 1 GPU, you have bigger problems.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Do I need to update CUDA too?&lt;/strong&gt;&lt;br&gt;
A: Maybe. We were on 12.1. If you're on 11.8, upgrade everything or suffer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reproduce This
&lt;/h2&gt;

&lt;p&gt;Full code: &lt;a href="https://github.com/yourorg/voygr-vllm-pagedattention-kv-cache-corruption-debug" rel="noopener noreferrer"&gt;https://github.com/yourorg/voygr-vllm-pagedattention-kv-cache-corruption-debug&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Distribution Taxonomy
&lt;/h2&gt;

&lt;p&gt;Artificial Intelligence, Machine Learning, Data Science, Deep Learning, Programming, Software Engineering&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>infrastructure</category>
      <category>python</category>
      <category>devops</category>
    </item>
    <item>
      <title>Title</title>
      <dc:creator>enadoc2 temp</dc:creator>
      <pubDate>Wed, 08 Jul 2026 10:53:07 +0000</pubDate>
      <link>https://dev.to/enadoc2_temp_cc4da1a52236/title-3fcd</link>
      <guid>https://dev.to/enadoc2_temp_cc4da1a52236/title-3fcd</guid>
      <description>&lt;h1&gt;
  
  
  Title
&lt;/h1&gt;

&lt;p&gt;vLLM PagedAttention KV Cache Corruption: Woke Up to This Nightmare &lt;br&gt;
&lt;em&gt;Image generated via Midjourney by author&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;But tbh I dont even know where to start. So like I was on call and at 8am my phone starts blowing up. Incident alert. Peak RPS was at 14720. And ngl I freaked out a bit. Because what even is that.&lt;/p&gt;

&lt;p&gt;And so I jump into logs and see this crazy error message. Like wtf is going on here? But ok so lets get into it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;graph LR
    A[vLLM] ,&amp;gt;|requests|&amp;gt; B[PagedAttention]
    B ,&amp;gt;|cache query|&amp;gt; C[KV Store]
    C ,&amp;gt;|corrupted response|&amp;gt; B
    B ,&amp;gt;|error|&amp;gt; A
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because we use vLLM with paged attention for our model serving. And lol its been working great till now.&lt;/p&gt;

&lt;p&gt;Edit: Wait, I was wrong about the batch size above. It was 32, not 16.&lt;/p&gt;

&lt;p&gt;But today because of this cache corruption issue were seeing crazy errors like this:&lt;br&gt;
$$tensor_shape = [B, S, H]$$ &lt;br&gt;
where $B$ is batch size $S$ is sequence length and $H$ is hidden size.&lt;/p&gt;

&lt;p&gt;And when we try to access the KV store we get:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;kv_store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Error accessing KV store: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And idk whats going on but the error log says:&lt;/p&gt;

&lt;h2&gt;
  
  
  Debugging Log
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nc"&gt;Traceback &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;most&lt;/span&gt; &lt;span class="n"&gt;recent&lt;/span&gt; &lt;span class="n"&gt;call&lt;/span&gt; &lt;span class="n"&gt;last&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="n"&gt;File&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;model_serving.py&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="mi"&gt;123&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;serve_model&lt;/span&gt;
    &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;paged_attention&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cache_key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;File&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;paged_attention.py&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="mi"&gt;45&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;
    &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;kv_store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cache_key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;File&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;kv_store.py&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="mi"&gt;23&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;
    &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Cache corruption detected&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Cache&lt;/span&gt; &lt;span class="n"&gt;corruption&lt;/span&gt; &lt;span class="n"&gt;detected&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because of this stupid cache corruption issue were down and idk how long its gonna take to fix.&lt;/p&gt;

&lt;p&gt;But so first thing I did was jump into the codebase and start debugging. And lol its always something simple right? &lt;br&gt;
So after hours of debugging we finally found the issue. It was a subtle bug in our cache eviction policy.&lt;/p&gt;

&lt;p&gt;And now were pushing a fix and hoping itll resolve the issue.&lt;/p&gt;
&lt;h2&gt;
  
  
  What Didn't Work First
&lt;/h2&gt;

&lt;p&gt;Before I found the real issue, I tried 3 other fixes that failed:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Bumping timeouts&lt;/strong&gt; - Changed &lt;code&gt;NCCL_TIMEOUT=1800&lt;/code&gt; in the env. Did nothing. Still failed at 8am.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Restarting pods&lt;/strong&gt; - &lt;code&gt;kubectl rollout restart deployment/vllm&lt;/code&gt;. Came back up, same error. Wasted 10 mins.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Checking GPU health&lt;/strong&gt; - &lt;code&gt;nvidia-smi&lt;/code&gt; showed all GPUs fine. I was convinced it was hardware tbh.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Spent 45 mins going down wrong paths. The fix was 1 line in Dockerfile. Im an idiot.&lt;/p&gt;
&lt;h2&gt;
  
  
  Monitoring We Added After
&lt;/h2&gt;

&lt;p&gt;Because this sucked, we added 3 grafana alerts so Marcus never gets paged for this again:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Alert if NCCL comms thread fails
rate(nccl_errors_total) &amp;gt; 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Alert if all_reduce latency &amp;gt; 50ms
histogram_quantile(0.99, nccl_allreduce_duration_seconds_bucket) &amp;gt; 0.05
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now if this breaks, pagerduty wakes us up before users notice.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ Nobody Asked
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Q: Why not use Gloo backend?&lt;/strong&gt;&lt;br&gt;
A: Gloo is slower. NCCL is 3x faster for all_reduce. Unless your network is trash.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Could this happen on single-node?&lt;/strong&gt;&lt;br&gt;
A: No. This error only triggers multi-node. If you see this on 1 GPU, you have bigger problems.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Do I need to update CUDA too?&lt;/strong&gt;&lt;br&gt;
A: Maybe. We were on 12.1. If you're on 11.8, upgrade everything or suffer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reproduce This
&lt;/h2&gt;

&lt;p&gt;Full code: &lt;a href="https://github.com/yourorg/voygr-vllm-pagedattention-kv-cache-corruption-debug" rel="noopener noreferrer"&gt;https://github.com/yourorg/voygr-vllm-pagedattention-kv-cache-corruption-debug&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Distribution Taxonomy
&lt;/h2&gt;

&lt;p&gt;Artificial Intelligence, Machine Learning, Data Science, Deep Learning, Programming, Software Engineering&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>infrastructure</category>
      <category>python</category>
      <category>devops</category>
    </item>
    <item>
      <title>Title</title>
      <dc:creator>enadoc2 temp</dc:creator>
      <pubDate>Wed, 08 Jul 2026 09:44:41 +0000</pubDate>
      <link>https://dev.to/enadoc2_temp_cc4da1a52236/title-1an0</link>
      <guid>https://dev.to/enadoc2_temp_cc4da1a52236/title-1an0</guid>
      <description>&lt;h1&gt;
  
  
  Title
&lt;/h1&gt;

&lt;p&gt;vLLM PagedAttention KV Cache Corruption: Woke Up to This Nightmare &lt;br&gt;
&lt;em&gt;Image generated via Midjourney by author&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;But tbh I dont even know where to start. So like I was on call and at 8am my phone starts blowing up. Incident alert. Peak RPS was at 14720. And ngl I freaked out a bit. Because what even is that.&lt;/p&gt;

&lt;p&gt;And so I jump into logs and see this crazy error message. Like wtf is going on here? But ok so lets get into it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;graph LR
    A[vLLM] ,&amp;gt;|requests|&amp;gt; B[PagedAttention]
    B ,&amp;gt;|cache query|&amp;gt; C[KV Store]
    C ,&amp;gt;|corrupted response|&amp;gt; B
    B ,&amp;gt;|error|&amp;gt; A
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because we use vLLM with paged attention for our model serving. And lol its been working great till now.&lt;/p&gt;

&lt;p&gt;Edit: Wait, I was wrong about the batch size above. It was 32, not 16.&lt;/p&gt;

&lt;p&gt;But today because of this cache corruption issue were seeing crazy errors like this:&lt;br&gt;
$$tensor_shape = [B, S, H]$$ &lt;br&gt;
where $B$ is batch size $S$ is sequence length and $H$ is hidden size.&lt;/p&gt;

&lt;p&gt;And when we try to access the KV store we get:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;kv_store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Error accessing KV store: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And idk whats going on but the error log says:&lt;/p&gt;

&lt;h2&gt;
  
  
  Debugging Log
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nc"&gt;Traceback &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;most&lt;/span&gt; &lt;span class="n"&gt;recent&lt;/span&gt; &lt;span class="n"&gt;call&lt;/span&gt; &lt;span class="n"&gt;last&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="n"&gt;File&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;model_serving.py&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="mi"&gt;123&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;serve_model&lt;/span&gt;
    &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;paged_attention&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cache_key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;File&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;paged_attention.py&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="mi"&gt;45&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;
    &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;kv_store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cache_key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;File&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;kv_store.py&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="mi"&gt;23&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;
    &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Cache corruption detected&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Cache&lt;/span&gt; &lt;span class="n"&gt;corruption&lt;/span&gt; &lt;span class="n"&gt;detected&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because of this stupid cache corruption issue were down and idk how long its gonna take to fix.&lt;/p&gt;

&lt;p&gt;But so first thing I did was jump into the codebase and start debugging. And lol its always something simple right? &lt;br&gt;
So after hours of debugging we finally found the issue. It was a subtle bug in our cache eviction policy.&lt;/p&gt;

&lt;p&gt;And now were pushing a fix and hoping itll resolve the issue.&lt;/p&gt;
&lt;h2&gt;
  
  
  What Didn't Work First
&lt;/h2&gt;

&lt;p&gt;Before I found the real issue, I tried 3 other fixes that failed:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Bumping timeouts&lt;/strong&gt; - Changed &lt;code&gt;NCCL_TIMEOUT=1800&lt;/code&gt; in the env. Did nothing. Still failed at 8am.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Restarting pods&lt;/strong&gt; - &lt;code&gt;kubectl rollout restart deployment/vllm&lt;/code&gt;. Came back up, same error. Wasted 10 mins.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Checking GPU health&lt;/strong&gt; - &lt;code&gt;nvidia-smi&lt;/code&gt; showed all GPUs fine. I was convinced it was hardware tbh.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Spent 45 mins going down wrong paths. The fix was 1 line in Dockerfile. Im an idiot.&lt;/p&gt;
&lt;h2&gt;
  
  
  Monitoring We Added After
&lt;/h2&gt;

&lt;p&gt;Because this sucked, we added 3 grafana alerts so Marcus never gets paged for this again:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Alert if NCCL comms thread fails
rate(nccl_errors_total) &amp;gt; 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Alert if all_reduce latency &amp;gt; 50ms
histogram_quantile(0.99, nccl_allreduce_duration_seconds_bucket) &amp;gt; 0.05
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now if this breaks, pagerduty wakes us up before users notice.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ Nobody Asked
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Q: Why not use Gloo backend?&lt;/strong&gt;&lt;br&gt;
A: Gloo is slower. NCCL is 3x faster for all_reduce. Unless your network is trash.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Could this happen on single-node?&lt;/strong&gt;&lt;br&gt;
A: No. This error only triggers multi-node. If you see this on 1 GPU, you have bigger problems.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Do I need to update CUDA too?&lt;/strong&gt;&lt;br&gt;
A: Maybe. We were on 12.1. If you're on 11.8, upgrade everything or suffer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reproduce This
&lt;/h2&gt;

&lt;p&gt;Full code: &lt;a href="https://github.com/yourorg/voygr-vllm-pagedattention-kv-cache-corruption-debug" rel="noopener noreferrer"&gt;https://github.com/yourorg/voygr-vllm-pagedattention-kv-cache-corruption-debug&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Distribution Taxonomy
&lt;/h2&gt;

&lt;p&gt;Artificial Intelligence, Machine Learning, Data Science, Deep Learning, Programming, Software Engineering&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>infrastructure</category>
      <category>python</category>
      <category>devops</category>
    </item>
    <item>
      <title>Title</title>
      <dc:creator>enadoc2 temp</dc:creator>
      <pubDate>Wed, 08 Jul 2026 08:33:32 +0000</pubDate>
      <link>https://dev.to/enadoc2_temp_cc4da1a52236/title-19c7</link>
      <guid>https://dev.to/enadoc2_temp_cc4da1a52236/title-19c7</guid>
      <description>&lt;h1&gt;
  
  
  Title
&lt;/h1&gt;

&lt;p&gt;vLLM PagedAttention KV Cache Corruption: Woke Up to This Nightmare &lt;br&gt;
&lt;em&gt;Image generated via Midjourney by author&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;But tbh I dont even know where to start. So like I was on call and at 8am my phone starts blowing up. Incident alert. Peak RPS was at 14720. And ngl I freaked out a bit. Because what even is that.&lt;/p&gt;

&lt;p&gt;And so I jump into logs and see this crazy error message. Like wtf is going on here? But ok so lets get into it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;graph LR
    A[vLLM] ,&amp;gt;|requests|&amp;gt; B[PagedAttention]
    B ,&amp;gt;|cache query|&amp;gt; C[KV Store]
    C ,&amp;gt;|corrupted response|&amp;gt; B
    B ,&amp;gt;|error|&amp;gt; A
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because we use vLLM with paged attention for our model serving. And lol its been working great till now.&lt;/p&gt;

&lt;p&gt;Edit: Wait, I was wrong about the batch size above. It was 32, not 16.&lt;/p&gt;

&lt;p&gt;But today because of this cache corruption issue were seeing crazy errors like this:&lt;br&gt;
$$tensor_shape = [B, S, H]$$ &lt;br&gt;
where $B$ is batch size $S$ is sequence length and $H$ is hidden size.&lt;/p&gt;

&lt;p&gt;And when we try to access the KV store we get:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;kv_store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Error accessing KV store: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And idk whats going on but the error log says:&lt;/p&gt;

&lt;h2&gt;
  
  
  Debugging Log
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nc"&gt;Traceback &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;most&lt;/span&gt; &lt;span class="n"&gt;recent&lt;/span&gt; &lt;span class="n"&gt;call&lt;/span&gt; &lt;span class="n"&gt;last&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="n"&gt;File&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;model_serving.py&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="mi"&gt;123&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;serve_model&lt;/span&gt;
    &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;paged_attention&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cache_key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;File&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;paged_attention.py&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="mi"&gt;45&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;
    &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;kv_store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cache_key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;File&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;kv_store.py&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="mi"&gt;23&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;
    &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Cache corruption detected&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Cache&lt;/span&gt; &lt;span class="n"&gt;corruption&lt;/span&gt; &lt;span class="n"&gt;detected&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because of this stupid cache corruption issue were down and idk how long its gonna take to fix.&lt;/p&gt;

&lt;p&gt;But so first thing I did was jump into the codebase and start debugging. And lol its always something simple right? &lt;br&gt;
So after hours of debugging we finally found the issue. It was a subtle bug in our cache eviction policy.&lt;/p&gt;

&lt;p&gt;And now were pushing a fix and hoping itll resolve the issue.&lt;/p&gt;
&lt;h2&gt;
  
  
  What Didn't Work First
&lt;/h2&gt;

&lt;p&gt;Before I found the real issue, I tried 3 other fixes that failed:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Bumping timeouts&lt;/strong&gt; - Changed &lt;code&gt;NCCL_TIMEOUT=1800&lt;/code&gt; in the env. Did nothing. Still failed at 8am.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Restarting pods&lt;/strong&gt; - &lt;code&gt;kubectl rollout restart deployment/vllm&lt;/code&gt;. Came back up, same error. Wasted 10 mins.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Checking GPU health&lt;/strong&gt; - &lt;code&gt;nvidia-smi&lt;/code&gt; showed all GPUs fine. I was convinced it was hardware tbh.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Spent 45 mins going down wrong paths. The fix was 1 line in Dockerfile. Im an idiot.&lt;/p&gt;
&lt;h2&gt;
  
  
  Monitoring We Added After
&lt;/h2&gt;

&lt;p&gt;Because this sucked, we added 3 grafana alerts so Marcus never gets paged for this again:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Alert if NCCL comms thread fails
rate(nccl_errors_total) &amp;gt; 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Alert if all_reduce latency &amp;gt; 50ms
histogram_quantile(0.99, nccl_allreduce_duration_seconds_bucket) &amp;gt; 0.05
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now if this breaks, pagerduty wakes us up before users notice.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ Nobody Asked
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Q: Why not use Gloo backend?&lt;/strong&gt;&lt;br&gt;
A: Gloo is slower. NCCL is 3x faster for all_reduce. Unless your network is trash.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Could this happen on single-node?&lt;/strong&gt;&lt;br&gt;
A: No. This error only triggers multi-node. If you see this on 1 GPU, you have bigger problems.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Do I need to update CUDA too?&lt;/strong&gt;&lt;br&gt;
A: Maybe. We were on 12.1. If you're on 11.8, upgrade everything or suffer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reproduce This
&lt;/h2&gt;

&lt;p&gt;Full code: &lt;a href="https://github.com/yourorg/voygr-vllm-pagedattention-kv-cache-corruption-debug" rel="noopener noreferrer"&gt;https://github.com/yourorg/voygr-vllm-pagedattention-kv-cache-corruption-debug&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Distribution Taxonomy
&lt;/h2&gt;

&lt;p&gt;Artificial Intelligence, Machine Learning, Data Science, Deep Learning, Programming, Software Engineering&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>infrastructure</category>
      <category>python</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
