An unembedding layer is the final part of a transformer pipeline. It turns the model’s numeric representation into candidate output tokens, making human-readable text possible. section 3.2.3 section 3.2
The output process works as a repeated loop:
- The transformer produces a floating-point vector representing the input and text generated so far. section 3.2.3
- The unembedding step converts that representation into scores or probabilities for tokens in the vocabulary. section 3.2.3
- Sampling chooses one token, and the next prediction depends on every token selected previously; this is an autoregressive process. section 3.2.3
- The loop ends when the model produces an end-of-sequence token or reaches a maximum generation limit. section 3.2.3
From “I love to eat” to a token
For the prompt “I love to eat,” food-related completions such as barbeque and sushi receive higher probabilities than a car or 42. Weighted random selection might choose “tacos,” after which the loop predicts the next token. section 3.4
Figure 3.11 We demonstrate text generation by starting with the phrase "I love to eat" and then showing that some possible completions that are foods, such as barbeque and sushi, have high proba-bilities, while a car and the number 42 have low probabilities. Weighted random selection chooses the word tacos. The generation loop is stopped when the EoS token appears.
Use the figure to trace candidate probabilities, weighted selection, and stopping at the end-of-sequence token. section 3.2.3
