{
  "version": 1,
  "language": "en",
  "title": "Full blocks and the same cache key are necessary for reuse",
  "description": "Request A prefills two full prefix blocks. Each block has four tokens. If the cache key is the same and cached KV is still in memory, B can use those eight tokens again. With these conditions, it can prefill its new two-token tail.",
  "caption": "Request B uses two cached full blocks with the same cache key again, then prefills its new tail. P=4 is an example. Prefill can include more work because of implementation details. Playback does not imply cache hits occur without cache-key checks. The author made this explanatory diagram.",
  "alt": "Prefix-cache flow: A prefills two full four-token blocks, and B uses the eight tokens again before it prefills its two-token tail.",
  "sources": [
    {
      "path": "content/blog/2026-06-11_life-of-a-request-vllm/post.md",
      "sha256": "158aa77041646bca8aba059344c4b6b0a6b451329b4a423e9c8027db8ba0304a",
      "description": "Current article explanation, equations, assumptions and retained citations."
    },
    {
      "path": "research/dynamic-mechanisms-2026-10-21/before/content/blog/2026-06-11_life-of-a-request-vllm/illustrations/04-prefix-cache-algorithm.svg",
      "sha256": "f9b43fc8d356556eb06a3e6840e17fd7fd0cad911debdb11a38c11e2cfa07355",
      "description": "Frozen prior illustration; exact pre-migration bytes retained."
    },
    {
      "path": "content/blog/2026-06-11_life-of-a-request-vllm/illustrations/source-notes.json",
      "description": "Existing article illustration provenance, retained unchanged."
    }
  ],
  "limitations": [
    "The execution is an example. Playback duration is not measured runtime."
  ],
  "targets": {
    "a0": {
      "id": "mechanism-a0",
      "kind": "node",
      "label": "p1 p2 p3 p4"
    },
    "cache0": {
      "id": "mechanism-cache0",
      "kind": "node",
      "label": "KV: p1–p4"
    },
    "b0": {
      "id": "mechanism-b0",
      "kind": "node",
      "label": "p1 p2 p3 p4"
    },
    "store0": {
      "id": "mechanism-store0",
      "kind": "edge",
      "label": "store0"
    },
    "reuse0": {
      "id": "mechanism-reuse0",
      "kind": "edge",
      "label": "reuse0"
    },
    "a1": {
      "id": "mechanism-a1",
      "kind": "node",
      "label": "p5 p6 p7 p8"
    },
    "cache1": {
      "id": "mechanism-cache1",
      "kind": "node",
      "label": "KV: p5–p8"
    },
    "b1": {
      "id": "mechanism-b1",
      "kind": "node",
      "label": "p5 p6 p7 p8"
    },
    "store1": {
      "id": "mechanism-store1",
      "kind": "edge",
      "label": "store1"
    },
    "reuse1": {
      "id": "mechanism-reuse1",
      "kind": "edge",
      "label": "reuse1"
    },
    "tail": {
      "id": "mechanism-tail",
      "kind": "node",
      "label": "b1 b2 — —"
    }
  },
  "stateLabels": {
    "stage": "Stage",
    "artifact": "Artifact"
  },
  "scenarios": [
    {
      "id": "compatible-hit",
      "title": "Two reusable full blocks",
      "description": "This example uses two full cache blocks again.",
      "initial": {
        "stage": "Prepared",
        "artifact": "Inputs kept"
      },
      "unselected": [],
      "steps": [
        {
          "title": "A prefills the prefix",
          "description": "A prefills the prefix.",
          "duration": 3000,
          "active": [
            "a0",
            "a1"
          ],
          "paths": [],
          "state": {
            "stage": "A prefills the prefix",
            "artifact": "Two full blocks of prompt K/V"
          }
        },
        {
          "title": "Keep the cache entries",
          "description": "Keep the cache entries.",
          "duration": 3000,
          "active": [
            "cache0",
            "cache1"
          ],
          "paths": [
            "store0",
            "store1"
          ],
          "state": {
            "stage": "Keep the cache entries",
            "artifact": "The entries stay valid and in memory."
          }
        },
        {
          "title": "Compare B's cache key",
          "description": "B and the cache entry have the same key.",
          "duration": 3000,
          "active": [
            "b0",
            "b1"
          ],
          "paths": [],
          "state": {
            "stage": "Compare B's cache key",
            "artifact": "The prefix and cache key are the same. B can use only full blocks again."
          }
        },
        {
          "title": "Use K/V with the same key again",
          "description": "Use the K/V with the same cache key again.",
          "duration": 3000,
          "active": [
            "b0",
            "b1"
          ],
          "paths": [
            "reuse0",
            "reuse1"
          ],
          "state": {
            "stage": "Use K/V with the same key again",
            "artifact": "Prefill is not necessary again for eight prefix positions."
          }
        },
        {
          "title": "Prefill B’s new tail",
          "description": "Prefill B’s new tail.",
          "duration": 3000,
          "active": [
            "tail"
          ],
          "paths": [],
          "state": {
            "stage": "Prefill B’s new tail",
            "artifact": "Model computation is necessary for the new tail."
          }
        }
      ]
    }
  ]
}
