A trained decoder produces one vocabulary-logit row for the next token. To generate a sequence, an inference loop chooses a token from that row, appends it to the context, and asks the model for another row.
This chapter reuses the trained 368-parameter model from Chapter 7. No parameter changes during generation. The work separates into three parts:
- the model calculates logits from a known prefix;
- a decoding policy chooses the next token;
- a key-value cache reuses stable attention projections from earlier tokens.
Changing the policy can change the selected token. A correct cache must not change logits beyond the declared floating-point tolerance.
The frozen model has a context length of four input positions. It can use the
fourth position to predict a fifth token such as <eos>, but it cannot feed
that fifth token back as another input. This small limit makes stopping and
position accounting visible.
The complete CPU artifact compares every valid prefix of the four-pattern corpus. Its largest cached-versus-uncached logit difference is , below the frozen tolerance .