Skip to content
CodeStoa
AI Engineering · AI ModelsBeginner

Context Window Explained: Why an AI Model Forgets

An AI model can only see a fixed amount of text at once: its context window. When your text doesn't fit, part of it is cut, and the model seems to forget.

3 min readPublished
0:00 / 3:25

The night before the exam

It's the night before Arjun's economics exam. They paste a whole semester of notes, six chapters, into an AI study helper. Then they ask a question from Chapter 1: "What is opportunity cost?"

The helper replies: "Your notes don't cover opportunity cost." But they do. It's the first page of Chapter 1. Arjun can see it in the file. So why can't the helper?

Because the model never read Chapter 1. It only reads what fits in its context window, and Chapter 1 didn't make it in.

What a context window is

Think of a whiteboard of a fixed size. The model can only read what is written on it right now. That whiteboard is the context window: the amount of text a model can see at once.

Its size is counted in tokens, the small pieces a model splits text into. A short word like "cost" is usually one token; a long word may be two or three. As a rough rule of thumb, one token is about three quarters of an English word, so 100 tokens is about 75 words.

Everything shares that one board. In Arjun's case, four things fill it:

  • The instructions: the app's own setup text, which tells the model how to behave.
  • The pasted text: all six chapters of Arjun's notes.
  • The question: "What is opportunity cost?" In a longer chat, every earlier message goes here too.
  • The answer: the reply being written takes room on the same board.

Why the model forgets

The model has no memory of its own. Each time Arjun asks something, the app sends everything again: the instructions, the notes and the question. The model reads it fresh, writes an answer and keeps nothing. So if something isn't on the board, the model simply doesn't know it.

  • Arjun's question (input) to Adds all six chapters (pasted text)
  • Adds all six chapters (pasted text) to Fits in the window? (context window)
  • Fits in the window? (context window) to Model writes answer (output)
  • Fits in the window? (context window) to Chapter 1 cut (truncation)
Every question starts from nothing. What doesn't fit in the window is cut before the model reads it.

Let's count. In this example, assume the helper's window is 10,000 tokens (real ones are much bigger, but the maths is the same).

  • Instructions

    Tokens
    400
  • Chapter 1 notes

    Tokens
    1,500
  • Chapters 2 to 6 notes

    Tokens
    8,000
  • Arjun's question

    Tokens
    100
  • Room for the answer

    Tokens
    1,500
  • Total

    Tokens
    11,500: 1,500 over the 10,000 limit
An illustrative window. It's 1,500 tokens over, exactly the size of Chapter 1.

This app cut the notes from the start until they fit, so Chapter 1 went. Apps differ here: many refuse with a "too long" error, some summarise, and some search the file and send only the parts that look relevant. Whatever the app does, the model only answers from what reaches the board.

Bigger windows, and Meera's fix

Windows vary a lot between models; many current ones offer from about 128,000 up to a million tokens or more. Using the rule of thumb above, a million tokens is roughly 750,000 words, about 1,500 pages at 500 words a page. That's approximate, but it shows the scale.

Bigger is not free, though. A fuller window means a slower answer and a higher bill, because you pay per token. And models can miss details buried in the middle of a very long input, even when it all fits.

Arjun's classmate Meera does it differently. They paste only Chapter 1 and ask the same question. That's 400 + 1,500 + 100 + 1,500 = 3,500 tokens, well inside the window, and the answer is right.

  • Paste only the part you need, one chapter at a time.
  • Summarise a long chat and carry the summary into a new one.
  • Start fresh for a new task, and repeat the key facts.

One sentence to remember: the model only sees what fits in its window right now, so keep what matters in it.

Summary

Key takeaways

  • The context window is how much text a model can see at once, counted in tokens.
  • A token is a piece of a word; as a rough rule, about three quarters of an English word.
  • The window holds everything: instructions, pasted text, the chat so far and the answer.
  • The model has no memory; the app re-sends everything each time, and what doesn't fit is cut or refused.
  • Bigger windows are slower and cost more, and details in the middle can be missed.
  • The model only sees what fits in its window right now, so keep what matters in it.

Practice

Check your understanding

Question 1

01Arjun's notes clearly include Chapter 1, yet the helper says the topic isn't covered. What is the most likely reason?

Question 2

02A model has a 10,000-token window. The instructions, notes and question come to exactly 10,000 tokens. What goes wrong?

Question 3

03Meera wants help with Chapter 3 next. What's the best move?

0 of 3 answered

Finished this lesson?

Mark it done to track your progress. Saved in this browser only.

FAQ

Frequently asked questions

What is a context window in an AI model?

It is the amount of text the model can read at once, counted in tokens. It holds the instructions, the conversation so far, anything you paste in and the answer being written.

Why does an AI forget the start of a long document or chat?

The model keeps nothing between requests. The app sends everything again each time, and when it doesn't fit in the window, some apps cut the oldest part, others summarise it or refuse with an error. Whatever isn't sent, the model never sees.

How big is a 1 million token context window?

Roughly 750,000 English words, about 1,500 pages at 500 words a page. It's an estimate, because the number of tokens per word depends on the text and the model.

  • 6:28

    AI Engineering Beginner 4 min read

    LLM Evals: Why "It Looks Good" Isn't Enough

    LLM evals are systematic, repeatable tests that judge an LLM app against clear criteria. Learn why spot checks fail, how evals differ from classic tests, and the workflow to run them.

    Oct 19, 2026

  • 5:38

    AI Engineering Beginner 6 min read

    Failure Points in LLM Applications: Where RAG Apps Break

    A RAG chatbot can fail in its retriever, its generator, the flow between them or the app as a whole. Follow one customer's question to see why checking only the final answer can't tell you which part broke.

    Oct 22, 2026