Chapter C43 · Interactive Course

From hidden states to an answer

Vocabulary, scores, the output head, targets and stop reasons.

Start chapter in web app

Core Learning Concept

Trace one generated token from its current representation to vocabulary scores, a distribution, and a selection. Then inspect the stopping status separately from the text. This trace explains the output process; it does not by itself establish whether a passage was memorized or whether its factual claims are true.

What You’ll Learn in This Chapter

  1. The output vocabulary

    Activity 1 of 8 · 4 min

    Identify the set of token choices at a generation step.

    A text model’s output vocabulary is the set of token entries it can score at a generation step. Many possible sentences can be assembled from these pieces, including unfamiliar combinations. A fixed vocabulary therefore does not mean a fixed list of whole replies. Special tokens may also represent control information.

    Start activity →

  2. Logits are scores before probabilities

    Activity 2 of 8 · 5 min

    Distinguish raw output scores from normalized probabilities.

    Logits are raw scores before a probability transformation. They can be positive or negative; a negative logit does not mean an impossible token. Softmax compares the scores and converts them into a distribution. Adding the same constant to every logit leaves that softmax distribution unchanged.

    Start activity →

  3. The language-model head

    Activity 3 of 8 · 4 min

    Locate the mapping from a hidden representation to vocabulary scores.

    The language-model head maps a hidden representation to scores for vocabulary entries. It is an output component, distinct from an attention head inside a Transformer block. Follow the arrows from representation to logits to distribution. Similar terminology does not mean the two heads perform the same operation.

    Start activity →

  4. Predicting the next training token

    Activity 4 of 8 · 4 min

    Identify the target used at one position during next-token training.

    In next-token training, the target is the token that followed the context in the training sequence. The model is scored against that observed continuation, even when other continuations would also make sense. This explains the training task without implying that every target sentence is true or ideal.

    Start activity →

  5. Token loss rewards the observed target

    Activity 5 of 8 · 4 min

    Explain why assigning the observed target less probability increases loss.

    Cross-entropy token loss rewards assigning higher probability to the observed target token. For one target, greater assigned probability means lower loss under this objective. Plausible alternatives do not replace the recorded target in that example. Across many examples, the process shapes the predicted distribution of continuations.

    Start activity →

  6. A turn can stop for different reasons

    Activity 6 of 8 · 5 min

    Distinguish a natural stop from an output-budget limit.

    A response can end because a stop token or condition was reached, an output limit was exhausted, a tool call transferred control, or an error intervened. Inspect the status provided by the system. A sentence that looks complete does not establish that the entire requested task finished successfully.

    Start activity →

  7. Remembered patterns can include memorization

    Activity 7 of 8 · 4 min

    Distinguish learned generalization from reproducing training material.

    Models can memorize some training material as well as learn general patterns. A verbatim passage could also come from supplied context or retrieval. The text alone does not identify the mechanism. Inspect available sources and traces before making a confident claim about how that passage was produced.

    Start activity →

  8. Trace one generated token

    Activity 8 of 8 · 5 min

    Label representation, output scores, token selection and completion status in a fictional decoder trace, and identify what the trace leaves unsettled.

    Start activity →