The autoregressive loop does not run forever. It terminates when the model selects a special end-of-sequence token, which is a vocabulary entry the model can assign probability to like any other. When that token is chosen, generation halts and the accumulated sequence is returned as the answer. Alternatively, a maximum length limit set by the system stops generation once the sequence reaches a fixed token count, even if no end-of-sequence token has appeared.
How ChatGPT Writes One Token at a Time
Choosing a Token and Looping
When the Loop Stops
4 / 4
The loop keeps cycling, one token per pass, but it has to stop somewhere. The model can assign probability to a special end-of-sequence token, just like any other vocabulary entry.
0:00 / 0:00