Thursday, December 3, 2026 | London 11°C · Drizzle
DailyGlimpse

AI

Understanding Generative AI: How LLMs Generate Text One Token at a Time

datarekha 1 min read

In the second episode of the Generative AI Podcast, hosts Arjun and Diya unravel the core mechanism behind large language models (LLMs): autoregressive token generation. Many people mistakenly believe that an LLM reads a prompt, pauses to think, and then outputs an entire paragraph. The reality is different: the model produces one token at a time, with each token based on the probability distribution over its entire vocabulary.

For example, when given the prompt "The capital of France is," the model performs a single forward pass and outputs a probability distribution. The token "Paris" wins, and that becomes the first output. The model then incorporates that token into the input and repeats the process to generate the next token, and so on. This is why chat interfaces stream the response letter by letter or word by word—it's not a gimmick, but a direct reflection of how the model works.

The episode also addresses common production edge cases, such as how the generation loop knows when to stop. The answer lies in a special end-of-sequence token: when the model assigns the highest probability to that token, it signals that the generation is complete.

This podcast episode is part of a 37-part series on generative AI, and a full written lesson is available at datarekha.com.

React