cd /news/large-language-models/the-context-window-an-llm-s-short-te… Β· home β€Ί topics β€Ί large-language-models β€Ί article
[ARTICLE Β· art-34672] src=dev.to β†— pub= topic=large-language-models verified=true sentiment=Β· neutral

The Context Window: an LLM's Short-Term Memory, Explained

A developer explains that large language models (LLMs) are stateless and their 'memory' is limited to a fixed context window. When the window fills, the oldest messages are dropped and cannot be recalled. The post demonstrates this with a visual demo and discusses implications for cost, performance, and prompt engineering.

read1 min views1 publishedJun 20, 2026

A chatbot feels like it remembers you. It doesn't β€” it's stateless. Everything it "knows" is just text resent each call, up to a fixed limit: the context window. When the box fills, the oldest messages fall off the edge and are genuinely gone.

πŸͺŸ Watch tokens fall off: https://dev48v.infy.uk/ai/days/day8-context-window.html

reply = model(allMessagesSoFar);  // the app resends the whole history every turn

"Memory" is just text you keep pasting back in.

Prompt + conversation + pasted docs + the reply must all fit inside a fixed number of tokens. When the chat grows past it, the oldest messages get dropped β€” in the demo, faded messages have scrolled OUT and the model literally can't see them. Ask about something dropped and it truly has no idea.

You're billed per token in the window, every call. Pasting a whole book each turn is slow and expensive β€” so you don't just CAN'T fit unlimited text, you don't WANT to.

Even within the limit, models attend best to the START and END; facts buried in the middle of a huge context can be overlooked. Bigger isn't automatically better.

Summarise old turns + keep recent ones verbatim + use RAG to fetch only the relevant chunks instead of pasting everything. Understanding the window explains chatbot "amnesia" and most prompt-engineering tactics.

── more in #large-language-models 4 stories Β· sorted by recency
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain β€” perfect for shipping the agent you just read about.

$git push zahid main
β†’ Live at https://your-agent.zahid.host βœ“
Get free account β†’ Pricing
from €0/mo Β· no card required
LIVE [news/the-context-window-a…] indexed:0 read:1min 2026-06-20 Β· β€”