{
  "version": 1,
  "language": "en",
  "title": "Token IDs become next-token logits",
  "description": "Formatted text becomes IDs, embedding vectors and contextual states. Sampling appends a new ID for embedding at the next position. The loop does not carry one unchanged token through all stages.",
  "caption": "Tokenization gives IDs, embeddings give vectors, and Transformer blocks add context. Vocabulary projection and sampling give a new token ID. Each step embeds the newly appended ID, and no single token travels unchanged through the loop. The author made this explanatory diagram. The playback is an example. Animation time is not measured runtime.",
  "alt": "Flow diagram: token IDs become vectors and next-token logits. Sampling appends a new ID for embedding in the next step.",
  "sources": [
    {
      "path": "content/blog/2026-06-09_life-of-a-token-transformer/post.md",
      "sha256": "aca6d72d9a2cb565f5e2e514e33cc16c3f73abb24785570c2dd1a2ea672af45d",
      "description": "Current article explanation, equations, assumptions and retained citations."
    },
    {
      "path": "research/dynamic-mechanisms-2026-10-21/before/content/blog/2026-06-09_life-of-a-token-transformer/illustrations/04-token-to-logits-algorithm.svg",
      "sha256": "d646dabd542215c09fc0cf4df21849c05c74c353e15651a9ef81fbfe33159ab2",
      "description": "Frozen prior illustration; exact pre-migration bytes retained."
    },
    {
      "path": "content/blog/2026-06-09_life-of-a-token-transformer/illustrations/source-notes.json",
      "description": "Existing article illustration provenance, retained unchanged."
    }
  ],
  "limitations": [
    "The playback is an example. Playback duration is not measured runtime."
  ],
  "targets": {
    "ids": {
      "id": "mechanism-ids",
      "kind": "node",
      "label": "Text → IDs"
    },
    "embed": {
      "id": "mechanism-embed",
      "kind": "node",
      "label": "Embeddings"
    },
    "transform": {
      "id": "mechanism-transform",
      "kind": "node",
      "label": "Transformer"
    },
    "final": {
      "id": "mechanism-final",
      "kind": "node",
      "label": "Prediction state"
    },
    "logits": {
      "id": "mechanism-logits",
      "kind": "node",
      "label": "Vocabulary logits"
    },
    "sample": {
      "id": "mechanism-sample",
      "kind": "node",
      "label": "New token ID"
    },
    "ids-embed": {
      "id": "mechanism-ids-embed",
      "kind": "edge",
      "label": "look up embeddings"
    },
    "embed-transform": {
      "id": "mechanism-embed-transform",
      "kind": "edge",
      "label": "apply blocks"
    },
    "transform-final": {
      "id": "mechanism-transform-final",
      "kind": "edge",
      "label": "select prediction state"
    },
    "final-logits": {
      "id": "mechanism-final-logits",
      "kind": "edge",
      "label": "project vocabulary"
    },
    "logits-sample": {
      "id": "mechanism-logits-sample",
      "kind": "edge",
      "label": "sample token"
    },
    "append": {
      "id": "mechanism-append",
      "kind": "edge",
      "label": "append ID"
    }
  },
  "stateLabels": {
    "stage": "Stage",
    "artifact": "Artifact"
  },
  "scenarios": [
    {
      "id": "next-position",
      "title": "From current context to a new token",
      "description": "From current context to a new token",
      "initial": {
        "stage": "Prepared",
        "artifact": "Inputs kept"
      },
      "unselected": [],
      "steps": [
        {
          "title": "Format and tokenize",
          "description": "Formatting and tokenization give discrete IDs for the input positions.",
          "duration": 3000,
          "active": [
            "ids"
          ],
          "paths": [],
          "state": {
            "stage": "Format and tokenize",
            "artifact": "Discrete IDs for input positions"
          }
        },
        {
          "title": "Look up embeddings",
          "description": "Embedding lookup gives one vector for each input position.",
          "duration": 3000,
          "active": [
            "embed"
          ],
          "paths": [
            "ids-embed"
          ],
          "state": {
            "stage": "Look up embeddings",
            "artifact": "One vector for each input position"
          }
        },
        {
          "title": "Calculate contextual states",
          "description": "Transformer blocks calculate contextual hidden states.",
          "duration": 3000,
          "active": [
            "transform"
          ],
          "paths": [
            "embed-transform"
          ],
          "state": {
            "stage": "Calculate contextual states",
            "artifact": "Causal context affects hidden states."
          }
        },
        {
          "title": "Select the prediction position",
          "description": "The model selects the last input position for next-token prediction.",
          "duration": 3000,
          "active": [
            "final"
          ],
          "paths": [
            "transform-final"
          ],
          "state": {
            "stage": "Select the prediction position",
            "artifact": "The last input position predicts the next ID."
          }
        },
        {
          "title": "Project to vocabulary logits",
          "description": "Vocabulary projection gives one score for each vocabulary entry.",
          "duration": 3000,
          "active": [
            "logits"
          ],
          "paths": [
            "final-logits"
          ],
          "state": {
            "stage": "Project to vocabulary logits",
            "artifact": "One score for each vocabulary entry"
          }
        },
        {
          "title": "Sample a new ID",
          "description": "Sampling gives an ID for a new position.",
          "duration": 3000,
          "active": [
            "sample"
          ],
          "paths": [
            "logits-sample"
          ],
          "state": {
            "stage": "Sample a new ID",
            "artifact": "A newly generated position"
          }
        },
        {
          "title": "Append and embed ID",
          "description": "The next execution embeds the newly appended ID.",
          "duration": 3000,
          "active": [
            "embed"
          ],
          "paths": [
            "append"
          ],
          "state": {
            "stage": "Append and embed ID",
            "artifact": "The new ID becomes input to the next execution."
          }
        }
      ]
    }
  ]
}
