{
  "version": 1,
  "language": "en",
  "title": "Reschedule unfinished requests",
  "description": "The flow shows text, token IDs, scheduled GPU execution, kept K/V, sampling and the next scheduler step. Model forward and GPU work are views of the same execution.",
  "caption": "The scheduler selects work. GPU kernels implement model forward, and K/V stays in memory. Unfinished requests return to scheduling. Model and GPU boxes show the same execution, not two serial runs. The author made this diagram. The playback is an example, and animation time is not measured runtime.",
  "alt": "Feedback flow: a scheduler selects work. GPU kernels implement model forward and update K/V. Logits supply input for sampling before unfinished work returns.",
  "sources": [
    {
      "path": "content/blog/2026-06-08_llm-inference-full-stack-systems/post.md",
      "sha256": "09bb02fb1815396601a7302f5924ed7b6b047a559ec5350a812ea9153627a653",
      "description": "Current article explanation, equations, assumptions and retained citations."
    },
    {
      "path": "research/dynamic-mechanisms-2026-10-21/before/content/blog/2026-06-08_llm-inference-full-stack-systems/illustrations/03-full-stack-feedback-algorithm.svg",
      "sha256": "8758f85f10f0c6c56a2566491a3a93c34bb7aaad82c1385c08b092bb51a64e87",
      "description": "Frozen prior illustration; exact pre-migration bytes retained."
    },
    {
      "path": "content/blog/2026-06-08_llm-inference-full-stack-systems/illustrations/source-notes.json",
      "description": "Existing article illustration provenance, retained unchanged."
    }
  ],
  "limitations": [
    "The playback is an example. Playback duration is not measured runtime."
  ],
  "targets": {
    "request": {
      "id": "mechanism-request",
      "kind": "node",
      "label": "Request text"
    },
    "ids": {
      "id": "mechanism-ids",
      "kind": "node",
      "label": "Token IDs"
    },
    "scheduler": {
      "id": "mechanism-scheduler",
      "kind": "node",
      "label": "Scheduler"
    },
    "execute": {
      "id": "mechanism-execute",
      "kind": "node",
      "label": "Forward pass"
    },
    "sample": {
      "id": "mechanism-sample",
      "kind": "node",
      "label": "New token"
    },
    "kv": {
      "id": "mechanism-kv",
      "kind": "node",
      "label": "KV cache"
    },
    "tokenize": {
      "id": "mechanism-tokenize",
      "kind": "edge",
      "label": "Format and tokenize"
    },
    "enqueue": {
      "id": "mechanism-enqueue",
      "kind": "edge",
      "label": "Add to queue"
    },
    "dispatch": {
      "id": "mechanism-dispatch",
      "kind": "edge",
      "label": "Select GPU work"
    },
    "logits": {
      "id": "mechanism-logits",
      "kind": "edge",
      "label": "Sample from logits"
    },
    "read-kv": {
      "id": "mechanism-read-kv",
      "kind": "edge",
      "label": "Read cached K/V"
    },
    "append-kv": {
      "id": "mechanism-append-kv",
      "kind": "edge",
      "label": "Append new K/V"
    },
    "unfinished": {
      "id": "mechanism-unfinished",
      "kind": "edge",
      "label": "Reschedule unfinished request"
    }
  },
  "stateLabels": {
    "stage": "Stage",
    "artifact": "Artifact"
  },
  "scenarios": [
    {
      "id": "decode-loop",
      "title": "One execution, persistent history",
      "description": "One execution, persistent history",
      "initial": {
        "stage": "Prepared",
        "artifact": "Kept inputs"
      },
      "unselected": [],
      "steps": [
        {
          "title": "Format and tokenize",
          "description": "The server formats the text. The tokenizer maps it to token IDs.",
          "duration": 3000,
          "active": [
            "request",
            "ids"
          ],
          "paths": [
            "tokenize"
          ],
          "state": {
            "stage": "Format and tokenize",
            "artifact": "IDs and request metadata"
          }
        },
        {
          "title": "Add work to queue",
          "description": "The engine adds request work to the queue.",
          "duration": 3000,
          "active": [
            "scheduler"
          ],
          "paths": [
            "enqueue"
          ],
          "state": {
            "stage": "Add work to queue",
            "artifact": "The scheduler selects a batch slot."
          }
        },
        {
          "title": "Run model forward",
          "description": "The GPU kernels run the model forward.",
          "duration": 3000,
          "active": [
            "execute",
            "kv"
          ],
          "paths": [
            "dispatch",
            "read-kv"
          ],
          "state": {
            "stage": "Run model forward",
            "artifact": "GPU kernels run one model forward."
          }
        },
        {
          "title": "Keep the new K/V",
          "description": "The cache keeps the new K/V.",
          "duration": 3000,
          "active": [
            "kv"
          ],
          "paths": [
            "append-kv"
          ],
          "state": {
            "stage": "Keep the new K/V",
            "artifact": "History includes the processed position."
          }
        },
        {
          "title": "Sample and stream",
          "description": "The sampler selects a token. The engine streams output.",
          "duration": 3000,
          "active": [
            "sample"
          ],
          "paths": [
            "logits"
          ],
          "state": {
            "stage": "Sample and stream",
            "artifact": "Sampling gives a new token ID from logits."
          }
        },
        {
          "title": "Reschedule unfinished request",
          "description": "The scheduler schedules the unfinished request again.",
          "duration": 3000,
          "active": [
            "scheduler"
          ],
          "paths": [
            "unfinished"
          ],
          "state": {
            "stage": "Reschedule unfinished request",
            "artifact": "The token extends the next request step."
          }
        }
      ]
    }
  ]
}
