The AI's Short-Term Memory
If you've ever had an AI chatbot suddenly seem to develop amnesia about the beginning of a long conversation, you have encountered its context limit, or 'context window'. Think of it as the AI's working memory. It's a finite space that holds all the information
for your current interaction: your prompts, the AI's previous responses, and any documents you've provided. Every time you send a message, the application invisibly bundles the entire chat history and sends it to the model. The AI reads this transcript from scratch to generate its next response and then, crucially, forgets it all again. This is because the underlying models are 'stateless', meaning they have no built-in memory of past events.
Measured in Tokens, Not Words
The size of this memory is not measured in words but in 'tokens'. A token is the smallest unit of text a model processes, which could be a whole word, a part of a word, or even just punctuation. As a rough guide, 100 tokens equate to about 75 English words. When a conversation gets too long, the earliest messages get pushed out of this window to make room for new ones. Once a piece of information is outside the window, it's as if it never existed for the AI. This is why a model might contradict itself or forget instructions you gave it at the start of a lengthy session.
Why Do These Limits Exist?
Context limits are a trade-off between capability, cost, and speed. The core technology behind most modern AI, known as the transformer architecture, works by calculating the relationship between every token in the context window. The computational power required for this grows quadratically; doubling the context size quadruples the processing power needed. Processing more tokens costs more money and takes more time. These constraints are also a reason why AIs don't have a persistent memory of all your past conversations—the computational and financial costs would be enormous, and it would create significant privacy risks.
The Race for Bigger Windows
AI developers are in a constant race to expand these context windows. Just a few years ago, a window of a few thousand tokens was standard. Today, frontier models from Google, OpenAI, and Anthropic boast windows of one million tokens or more, capable of processing the equivalent of thousands of pages of text at once. These massive windows unlock new capabilities, from analyzing entire novels to processing complex codebases. However, a bigger window isn't a perfect solution. Research shows that models can struggle to find a key piece of information when it's buried in the middle of a very long text, a phenomenon known as the 'lost in the middle' problem.
Smarter Memory, Not Just Bigger
Beyond simply making the memory bigger, developers use clever techniques to make it smarter. One popular method is Retrieval-Augmented Generation, or RAG. Instead of stuffing a whole library of documents into the context window, RAG systems first search an external database for the most relevant snippets of information related to your query. It then 'augments' your prompt by adding just those relevant facts into the context window for the AI to use. This approach is often more cost-effective and can be more accurate for tasks that require pulling specific, up-to-date facts from a large body of knowledge. Many advanced systems now use a hybrid approach, deciding whether to use RAG or a long-context window depending on the task.
















