{
  "language": "en",
  "title": "Commit the accepted prefix, then add the correction",
  "description": "Examine the speculative-decoding rejection example. Examine the committed context, not only the highlighted tokens.",
  "caption": "The diagram shows only one rejection branch. It does not show acceptance probabilities, correction sampling or the all-accepted branch.",
  "alt": "Example: after verification accepts d1 and d2 of four draft tokens but rejects d3 and discards d4, the context contains d1, d2 and correction c3.",
  "stateLabels": {
    "draft": "Draft suffix",
    "verified": "Verification",
    "accepted": "Accepted prefix",
    "rejected": "Uncommitted candidates",
    "committed": "Committed context"
  },
  "scenarios": [
    {
      "id": "reject-d3",
      "title": "Reject d3 and discard d4",
      "description": "This is an example of one acceptance outcome. It is not a full speculative-sampling implementation.",
      "initial": {
        "draft": "—",
        "verified": "Not run",
        "accepted": "—",
        "rejected": "—",
        "committed": "Existing context only"
      },
      "unselected": [
        "v4"
      ],
      "steps": [
        {
          "title": "Supply a candidate suffix",
          "description": "The draft supplies candidate tokens d1–d4. None of these tokens is committed to the context.",
          "active": [
            "d1",
            "d2",
            "d3",
            "d4"
          ],
          "paths": [],
          "state": {
            "draft": "d1 d2 d3 d4",
            "verified": "Not run",
            "accepted": "—",
            "rejected": "—",
            "committed": "Existing context only"
          },
          "duration": 3000
        },
        {
          "title": "Run target verification",
          "description": "Target verification evaluates the draft with the existing context. The outcome below is one example rejection branch.",
          "active": [
            "verify"
          ],
          "paths": [
            "toverify"
          ],
          "state": {
            "draft": "d1 d2 d3 d4",
            "verified": "The target evaluated the draft.",
            "accepted": "—",
            "rejected": "—",
            "committed": "Existing context only"
          },
          "duration": 3000
        },
        {
          "title": "Keep the accepted prefix",
          "description": "In this example, the acceptance rule accepts d1 and d2. This presentation shows their outcome in one group. It does not tell you to use a serial target implementation.",
          "active": [
            "a1",
            "a2"
          ],
          "paths": [
            "v1",
            "v2"
          ],
          "state": {
            "draft": "d1 d2 d3 d4",
            "verified": "Outcome resolution",
            "accepted": "d1 d2",
            "rejected": "—",
            "committed": "Existing context only"
          },
          "duration": 3000
        },
        {
          "title": "First rejection at d3",
          "description": "d3 is the first rejected draft token. The subsequent d4 candidate is discarded. This does not imply an independent rejection decision for d4.",
          "active": [
            "reject",
            "discard"
          ],
          "paths": [
            "v3"
          ],
          "state": {
            "draft": "d1 d2 d3 d4",
            "verified": "First rejection: d3",
            "accepted": "d1 d2",
            "rejected": "d3 rejected / d4 discarded",
            "committed": "Existing context only"
          },
          "duration": 3000
        },
        {
          "title": "Commit accepted d1 and d2",
          "description": "Only the accepted prefix extends the existing context. d3 is not committed. d4 is not committed.",
          "active": [
            "c1",
            "c2"
          ],
          "paths": [
            "commit1",
            "commit2"
          ],
          "state": {
            "draft": "d1 d2 d3 d4",
            "verified": "Resolved rejection branch",
            "accepted": "d1 d2",
            "rejected": "d3 rejected / d4 discarded",
            "committed": "Existing context + d1 + d2"
          },
          "duration": 3000
        },
        {
          "title": "Add correction c3 at the end",
          "description": "The correction/resampling rule supplies c3. The diagram does not show sampling details. c3 is not the rejected draft d3.",
          "active": [
            "correction"
          ],
          "paths": [
            "resample"
          ],
          "state": {
            "draft": "d1 d2 d3 d4",
            "verified": "Resolved rejection branch",
            "accepted": "d1 d2",
            "rejected": "d3 rejected / d4 discarded",
            "committed": "Existing context + d1 + d2 + c3"
          },
          "duration": 3000
        }
      ]
    }
  ],
  "version": 1,
  "targets": {
    "d1": {
      "id": "flow-d1",
      "kind": "node",
      "label": "Draft d1"
    },
    "d2": {
      "id": "flow-d2",
      "kind": "node",
      "label": "Draft d2"
    },
    "d3": {
      "id": "flow-d3",
      "kind": "node",
      "label": "Draft d3"
    },
    "d4": {
      "id": "flow-d4",
      "kind": "node",
      "label": "Draft d4"
    },
    "a1": {
      "id": "flow-a1",
      "kind": "node",
      "label": "Accepted d1"
    },
    "a2": {
      "id": "flow-a2",
      "kind": "node",
      "label": "Accepted d2"
    },
    "reject": {
      "id": "flow-reject",
      "kind": "node",
      "label": "Reject d3"
    },
    "discard": {
      "id": "flow-discard",
      "kind": "node",
      "label": "Discard d4"
    },
    "c1": {
      "id": "flow-c1",
      "kind": "node",
      "label": "Commit d1"
    },
    "c2": {
      "id": "flow-c2",
      "kind": "node",
      "label": "Commit d2"
    },
    "correction": {
      "id": "flow-correction",
      "kind": "node",
      "label": "Correction c3"
    },
    "verify": {
      "id": "flow-verify",
      "kind": "node",
      "label": "Target verification"
    },
    "toverify": {
      "id": "flow-toverify",
      "kind": "edge",
      "label": "toverify"
    },
    "v1": {
      "id": "flow-v1",
      "kind": "edge",
      "label": "v1"
    },
    "v2": {
      "id": "flow-v2",
      "kind": "edge",
      "label": "v2"
    },
    "v3": {
      "id": "flow-v3",
      "kind": "edge",
      "label": "v3"
    },
    "v4": {
      "id": "flow-v4",
      "kind": "edge",
      "label": "v4"
    },
    "commit1": {
      "id": "flow-commit1",
      "kind": "edge",
      "label": "commit1"
    },
    "commit2": {
      "id": "flow-commit2",
      "kind": "edge",
      "label": "commit2"
    },
    "resample": {
      "id": "flow-resample",
      "kind": "edge",
      "label": "resample"
    }
  },
  "sources": [
    {
      "file": "content/blog/2026-06-11_life-of-a-request-vllm/post.md",
      "description": "Mechanism and scope from the current article; concrete requests/tokens are illustrative."
    },
    {
      "file": "/Users/jiwenbo/Documents/GitHub/Blog_Illustration_Skill/examples/animated-flow-2026-10-16/02-speculative-decoding/diagram.svg",
      "sha256": "1852283430a294e2358780f0700fd53ca3eea4a8f670d401c777d7871fa2902d",
      "description": "Skill source illustration; imported, not an observed runtime trace."
    }
  ],
  "limitations": [
    "Playback time helps show the example. It is not measured latency or throughput.",
    "This is a constructed execution trace. It is not a captured vLLM serving run.",
    "Playback timing is an example, not measured runtime. The original SVG from the Skill has no changes.",
    "This trace does not show acceptance/correction probabilities or the all-accepted branch. The actual speculative-sampling rule is necessary for distributional correctness."
  ]
}
