Module 3 · Turning scores into text

Special tokens, stop conditions, and where a turn ends

In this lesson

  • 8 min read
  • 6 reading sections
  • Knowledge check
  • Lesson 5 of 10 in this chapter

This chapter’s goalChoose and justify a decoding strategy for a given task, read raw log-probabilities to get a usable confidence signal, force structurally valid output without prompt-begging, and explain why identical requests at temperature zero can still differ.

This chapter’s media

The film explains chapter ideas. The audiobook narrates the complete teaching text.

FormatEnglishहिंदी
Chapter filmNot availableNot available
Full audiobookNot availableNot available

A little at a time

Explore an idea, try it, then check what stays.

Step 1 of 7Free · no account needed
Lesson steps

Nothing tells the model the turn is over

Generation runs until something stops it. There are exactly three stopping conditions, and they are all mundane:

  1. The model emits its end-of-turn token, and the serving code recognises it and halts.
  2. The generated text matches a stop sequence you supplied.
  3. The maximum token count is reached.

That is all. There is no notion of a complete thought. A response that ends mid-sentence hit condition 3, and the fix is a larger limit, not a better prompt.

Your place and first choices stay on this browser. Classroom credit is recorded separately.

Every lesson here is open. Your progress is recorded once you pass the AI, Actually Explained exam.

Stuck on something?Ask Anjali, your AI tutor

How to cite: Addaly (2026) ‘Special tokens, stop conditions, and where a turn ends’, in How a Language Model Actually Works. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/how-llms-work/stop-tokens-and-chat-templates (Accessed: 29 November 2026).