Large Programs

Home / How LLMs Work

How LLMs Work

What Is a Context Window? The AI's Short-Term Memory

A context window is how much text a language model can look at at once. Understand it with a simple desk analogy.

26 November 2026 · 1 min read

A context window is the amount of text a language model can "see" at one time. It includes your question, the earlier conversation, and the answer it is writing.

A desk holds a question, earlier chat and pasted text; older text falls off.

Illustration made for this site.

The desk analogy

Picture a desk. You can only fit so many pages on it. If you want to add a new page and the desk is full, an old page falls off. The desk is the context window.

What happens when it is full?

Depending on the app, the oldest messages may be dropped or shortened. The model then no longer has them to look at, so it may forget a detail you gave earlier.

Does it mean the model remembers me?

Not by itself. Inside one chat, the earlier messages sit in the context window. In a new chat, that desk is empty unless the app saves notes for you.

Bigger is not always better

A larger window lets the model handle longer documents. But very long inputs can still be handled unevenly. A 2023 study by researchers at Stanford, Berkeley and Samaya AI found that models often did best when the useful information was at the start or end of a long input, and worse when it was in the middle. Long inputs also cost more to process. Good questions with the key details usually work better than dumping everything in.

Tip for students

If an answer seems to ignore something you said, repeat the key fact in your next message. You are putting the page back on the desk.

Sources