How does a generative language model produce text?
Instruction: Explain your approach, give a practical example, and describe its limits.
Updated
Example Answer
For a typical autoregressive language model, the input is converted into tokens, and the model predicts a distribution for the next token from the available context. Generation selects a token, appends it, and repeats until a stopping condition is reached. Greedy decoding selects the highest-scoring next token; sampling chooses from a configured distribution.
That process can produce coherent text, but fluency is not a factuality check. The generated sequence also depends on the decoding settings and supplied context. I would state which architecture I mean, because language models include designs beyond the decoder-only models commonly used for chat.
Concrete example
A low-probability token can still be selected under sampling. Greedily choosing the best next token at each step also does not guarantee the most probable complete sequence.
Follow-up to practice
Why can the same prompt produce different responses?