Example

Step-by-Step Example of Auto-Regressive Sequence Generation

An auto-regressive language model generates text one token at a time, where each new token is predicted based on the sequence of tokens that came before it. The overall probability of the generated sequence is calculated by multiplying the conditional probabilities of each token. The following table illustrates this process for generating the three tokens bb, cc, and dd given the prefix s a\langle s \rangle\ a:

ContextPredicted TokenDecision RuleCumulative Sequence Probability
s a\langle s \rangle\ abb$$\argmax_{x_2 \in V} \Pr(x_{2}\langle s \rangle\ a)$$
s a b\langle s \rangle\ a\ bcc$$\argmax_{x_3 \in V} \Pr(x_{3}\langle s \rangle\ a\ b)$$
s a b c\langle s \rangle\ a\ b\ cdd$$\argmax_{x_4 \in V} \Pr(x_{4}\langle s \rangle\ a\ b\ c)$$

At each step, the model selects a token xix_i from the vocabulary VV so that the conditional probability Pr(xix0,...,xi1)\Pr(x_{i}|x_0,...,x_{i-1}) is maximized. This predicted token is then appended to the end of the context sequence for the next step.

0

1

Updated 2026-05-02

Contributors are:

Who are from:

Tags

Ch.2 Generative Models - Foundations of Large Language Models

Foundations of Large Language Models

Foundations of Large Language Models Course

Computing Sciences

Related