How Language Models Work

Lesson 04

The context window

It has no memory. It re-reads the whole chat, every single time.

The model remembers nothing between messages. Every turn, the app quietly re-sends the entire conversation and the model reads all of it from scratch. That re-sent text has a size limit, and the limit is called the context window.

An elephant folded from slate blue paper, trunk curled under.
It remembers everything inside the window and nothing outside it. The elephant is the flattering half of that; the edge of the window is the rest.

Do thisPress Next message ten times. Watch the window in step 3 fill up, then watch the first message get pushed out of it. At the end, Sam asks the model his own name.

1Send the chat, one message at a time

0 of 10 sent

2The chat, the way you see it

3What the model actually gets, this turn

Step 2 is the chat the way you see it. Step 3 is the text the app actually sends, re-sent in full every turn. This demo uses a deliberately tiny 60-token window so you can watch it overflow; a real one holds tens of thousands.