Transformers, lesson 10
Autoregressive generation
Pick a token, append it, run the model again.
You need "Logits and softmax over the vocabulary": a forward pass ends with a probability for each token the model knows.
Part 1. One token, then the next
A forward pass gives you one set of probabilities for the next token. That's one token. To write a sentence, you take a token, glue it onto the end of the text, and run the model again on the longer text.
Example 1.1
Writing after "The cat sat on the"
- The cat sat on the→forward pass→mat 0.41floor 0.20...
Run the model on the prompt. The last position gives probabilities for every token.
- pick→mat
Choose one token from that list. How to choose is a separate decision, covered over the next few lessons.
- The cat sat on the mat→forward pass→. 0.52and 0.21...
Append it and run the model again. The new token is now part of the input, just like the words you typed.
- pick→.The cat sat on the mat.
Pick, append, repeat. Every token in a reply comes out of this same loop. (The probabilities after "mat" are illustrative.)
Autoregressive generation
Producing text one token at a time, where each new token is chosen from a forward pass over everything so far, including the tokens the model itself just wrote.
Your turn
A chatbot writes a 40-token reply to your message. How many times did it pick a token?
Part 2. Knowing when to stop
Keep going with Pro
You've done the first part. Pro opens the rest of this lesson, and every other one.
- Knowing when to stop
- No going back
Transformers overviewSpotted a mistake? Tell us.