# The context windowcontext windowThe context window is the maximum amount of text (measured in tokens) a language model can process at once, including both the input prompt and the generated output.Voir la définition complète →: the model's working memory
Paste a 40-page PDF into Claude and ask for a summary. It works instantly. Paste a 900-page novel and you hit a wall: "This message exceeds the maximum length." Same tool, same prompt, totally different outcome. The difference is the context windowcontext windowThe context window is the maximum amount of text (measured in tokens) a language model can process at once, including both the input prompt and the generated output.Voir la définition complète →, and once you understand it, half the weird behavior of AI chatbots suddenly makes sense.
An LLMLLMA Large Language Model is an AI system trained on vast text data to predict and generate language, enabling tasks like writing, summarizing, and answering questions.Voir la définition complète → (large language modellarge language modelA Large Language Model is an AI system trained on vast text data to predict and generate language, enabling tasks like writing, summarizing, and answering questions.Voir la définition complète →, the technology behind ChatGPT, Claude, and Gemini) has no memory between conversations. When you start a new chat, the model knows nothing about your last one. It doesn't "remember" you the way a coworker would.
Everything the model "knows" during a chat lives in one place: the context windowcontext windowThe context window is the maximum amount of text (measured in tokens) a language model can process at once, including both the input prompt and the generated output.Voir la définition complète →.
Think of the context windowcontext windowThe context window is the maximum amount of text (measured in tokens) a language model can process at once, including both the input prompt and the generated output.Voir la définition complète → as the model's working memory, like the desk space in front of you. Whatever fits on the desk, the model can see and use. Anything that falls off the edge is gone.
This includes:
All of it sits on the same desk. And the desk has a fixed size.
The size of the context windowcontext windowThe context window is the maximum amount of text (measured in tokens) a language model can process at once, including both the input prompt and the generated output.Voir la définition complète → is measured in tokenstokensA token is the basic unit of text that language models process, often a word fragment, whole word, or punctuation mark rather than a single character.Voir la définition complète →, not words.
A tokentokenA token is the basic unit of text that language models process, often a word fragment, whole word, or punctuation mark rather than a single character.Voir la définition complète → is a chunk of text. Roughly, 1 token is about 4 characters, or three-quarters of a word. So 100 tokenstokensA token is the basic unit of text that language models process, often a word fragment, whole word, or punctuation mark rather than a single character.Voir la définition complète → is around 75 words.
Quick examples:
You can see this yourself with OpenAI's free Tokenizer tool. Paste any text and watch it split into colored tokenstokensA token is the basic unit of text that language models process, often a word fragment, whole word, or punctuation mark rather than a single character.Voir la définition complète →. It's the fastest way to make this concept click.
Why does this matter? Because the context windowcontext windowThe context window is the maximum amount of text (measured in tokens) a language model can process at once, including both the input prompt and the generated output.Voir la définition complète → is a budget, and tokenstokensA token is the basic unit of text that language models process, often a word fragment, whole word, or punctuation mark rather than a single character.Voir la définition complète → are the currency.
In early 2026, typical limits look like this:
A million tokenstokensA token is the basic unit of text that language models process, often a word fragment, whole word, or punctuation mark rather than a single character.Voir la définition complète → sounds infinite. It isn't. Let's do the math.
A 40-page PDF is roughly 20,000 to 28,000 tokenstokensA token is the basic unit of text that language models process, often a word fragment, whole word, or punctuation mark rather than a single character.Voir la définition complète →. Drop that into a 200,000-token windowtoken windowThe context window is the maximum amount of text (measured in tokens) a language model can process at once, including both the input prompt and the generated output.Voir la définition complète → and you've used maybe 12 percent of the desk. Plenty of room left for your questions and the model's answers.
A 900-page novel is roughly 400,000 to 500,000 tokenstokensA token is the basic unit of text that language models process, often a word fragment, whole word, or punctuation mark rather than a single character.Voir la définition complète →. That overflows even a 200,000-token windowtoken windowThe context window is the maximum amount of text (measured in tokens) a language model can process at once, including both the input prompt and the generated output.Voir la définition complète →. The app rejects it because it physically cannot fit on the desk.
This is the practical rule:
> If your content fits in the window, the model can reason over all of it at once. If it doesn't, you have to break it up.
When something is too big, your options are:
1. Split it into chunks and process them one at a time.
2. Summarize as you go, feeding summaries forward instead of full text.
3. Use a model with a bigger window (this is exactly why Gemini's million-token windowtoken windowThe context window is the maximum amount of text (measured in tokens) a language model can process at once, including both the input prompt and the generated output.Voir la définition complète → is useful for huge documents).
Here's the behavior that confuses people most.
You're 50 messages deep into a long brainstorming chat. You ask the model to recall a detail you mentioned at the very start. It gets it wrong, or invents something.
The model isn't being lazy. The beginning of your conversation fell off the desk.
Remember: every message, yours and the model's, takes up tokentokenA token is the basic unit of text that language models process, often a word fragment, whole word, or punctuation mark rather than a single character.Voir la définition complète → budget. A long conversation keeps adding tokenstokensA token is the basic unit of text that language models process, often a word fragment, whole word, or punctuation mark rather than a single character.Voir la définition complète →. When the total exceeds the window, the oldest content gets pushed out to make room for the newest.
So in a very long chat, the model may literally no longer see what you said an hour ago. It's not in the working memory anymore.
A simple mental model:
[ CONTEXT WINDOW = 200,000 tokens ]
Earliest messages --> pushed out when full
...
Recent messages --> always visible
Your latest prompt --> always visibleThis is also why the model can contradict itself in long sessions. The instruction you gave at message 3 ("always reply in British English") may be gone by message 80.
Good catch. Modern apps add features on top of the raw context windowcontext windowThe context window is the maximum amount of text (measured in tokens) a language model can process at once, including both the input prompt and the generated output.Voir la définition complète →:
These aren't the model remembering. They're the app re-feeding information into the context window each time. The window is still the only thing the model actually sees.
Vérification des acquis
1. According to the lesson, what is the approximate relationship between tokens and words?
2. Why does an LLM appear to have 'no memory between conversations'?
3. The lesson mentions OpenAI's Tokenizer tool. What is its primary purpose?
4. Select ALL correct answers: which of the following occupy space in the context window during a chat?
Sélectionnez toutes les réponses correctes.
5. Select ALL correct answers: which statements about the context window are accurate based on the lesson?
Sélectionnez toutes les réponses correctes.
Once you treat tokenstokensA token is the basic unit of text that language models process, often a word fragment, whole word, or punctuation mark rather than a single character.Voir la définition complète → as a budget, you start making better choices. Here's the practical mindset.
Don't run your whole week through one endless chat. A bloated chat wastes budget on irrelevant history and increases the chance of confusion. New task, new chat.
Put your most important instructions and reference material near your actual question, not buried 40 messages up. If a rule matters, restate it.
You don't need to paste a full 200-page contract to ask about the termination clause. Paste the clause and a bit of surrounding context. Less noise, sharper answers, lower cost.
When a long conversation gets sluggish or forgetful, ask:
> "Summarize everything we've decided so far as a bullet list I can paste into a new chat."
Then start a clean chat with that summary on top. You've compressed hours of work into a few hundred tokenstokensA token is the basic unit of text that language models process, often a word fragment, whole word, or punctuation mark rather than a single character.Voir la définition complète →.
If you keep returning to the same material (a book draft, a product spec, a client account), put it in a Project so it's always loaded without re-pasting.
If you build with the APIAPIApplication Programming Interface: a standardised interface that lets applications communicate and exchange data without knowing each other's internal workings.Voir la définition complète → (the developer interface to these models), tokentokenA token is the basic unit of text that language models process, often a word fragment, whole word, or punctuation mark rather than a single character.Voir la définition complète → usage is reported to you directly. Even non-developers benefit from seeing it once.
# pip install anthropic
import anthropic
client = anthropic.Anthropic() # uses your API key
response = client.messages.create(
model="claude-sonnet-4-5",
max_tokens=300,
messages=[
{"role": "user", "content": "Summarize the causes of WWI in 5 bullets."}
],
)
print(response.content[0].text)
# The model tells you exactly how much budget you spent:
print("Input tokens:", response.usage.input_tokens)
print("Output tokens:", response.usage.output_tokens)input_tokens is what you sent (your prompt plus any pasted files). output_tokens is what the model wrote back. Both count against limits and, on paid plans, against cost. Watching these numbers makes the whole concept tangible.
"A bigger context window means a smarter model." No. It means a bigger desk, not a sharper mind. A model with a huge window can still misread what's on the desk.
"The model reads my whole document carefully every time." Not exactly. With very large inputs, models can overlook details buried in the middle, a known pattern sometimes called "lost in the middle." Important instructions belong near the start or end of your input.
"Once I tell it something, it knows it forever." Only within that chat, and only while it stays in the window. Across chats, only Memory or Projects carry it forward.