Generative AI & LLMs

context window

/ KON-tekst WIN-doh /

The context window is the amount of text a language model can hold in view at one time — its working memory for a single conversation or request. Everything the model can take into account right now must fit inside this window: your question, any documents you pasted, the system prompt, and the whole conversation so far. Measured in tokens (roughly, word-fragments), it might span a few thousand tokens or, in newer models, hundreds of thousands. Whatever sits inside it, the model can attend to; whatever falls outside, it simply cannot see.

Picture a desk of a fixed size. You can spread out only so many pages at once; to make room for new ones, older pages slide off the edge and are gone. That is exactly how a long chat behaves: once the conversation grows past the window, the earliest turns drop out of view, and the model genuinely no longer knows what was said at the start — even though you remember it perfectly. It is not forgetting in a human sense; those words are simply no longer in front of it.

Two honest points. A bigger window is not the same as memory: nothing carries over to the next, separate conversation, where the model starts blank again. And a window being large does not mean the model uses all of it equally well — research finds models often attend best to the beginning and end of a long context and can overlook details buried in the middle (the "lost in the middle" effect). More room helps, but it is not a guarantee of attention.

Early in a long chat you say "My dog's name is Pixel." Forty thousand words later, past the window's edge, you ask "What's my dog's name?" — and the model has no idea, because that line slid off the desk. It isn't being forgetful; the words are simply no longer in its view.

Past the window's edge, earlier text is simply gone from view.

A large context window is not long-term memory. Within one chat it holds everything in view, but it resets to empty for the next conversation. And longer is not automatically better used — models can "lose" facts placed in the middle of a very long context.

Also called
context length上下文窗口上下文視窗上下文长度