---
title: What Is a Context Window? The AI's Short-Term Memory | Large Programs
description: A context window is how much text a language model can look at at once. Understand it with a simple desk analogy.
canonical: https://www.largeprograms.com/what-is-a-context-window/
---

[Home](/) / [How LLMs Work](/category/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.](/img/context-window.svg)

*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

- [https://en.wikipedia.org/wiki/Large_language_model](https://en.wikipedia.org/wiki/Large_language_model)
- [https://arxiv.org/abs/2307.03172](https://arxiv.org/abs/2307.03172)

[Read this page as Markdown (.md)](/what-is-a-context-window.md)

## Keep reading

[![](/img/hero/art-ai-art-and-music-basics.svg)](/ai-art-and-music-basics/)

How LLMs Work

### [How AI Makes Music: A Beginner's Look](/ai-art-and-music-basics/)

Models can generate melodies and songs by learning patterns in sound. What that means for musicians.

[![](/img/hero/art-backpropagation-how-neural-networks-learn-from-mistakes.svg)](/backpropagation-how-neural-networks-learn-from-mistakes/)

How LLMs Work

### [Backpropagation: How a Network Learns From Its Mistakes](/backpropagation-how-neural-networks-learn-from-mistakes/)

Backpropagation is the method that works out how to adjust each weight in a neural network after it makes an error. A simple explanation with a team analogy.

[![](/img/hero/art-chain-of-thought-prompting-showing-your-working.svg)](/chain-of-thought-prompting-showing-your-working/)

How LLMs Work

### [Chain-of-Thought Prompting: Showing the Steps](/chain-of-thought-prompting-showing-your-working/)

Asking a language model to show intermediate steps can improve its answers to hard problems. What the research found and how it is like showing your working in maths.
