Back to articles

How it works

Why does AI repeat a mistake you already corrected?

What the context window keeps, and what it leaves out.

You correct the AI, it apologizes, and a few messages later it repeats the same mistake. That looks like stubbornness. The simpler explanation is where the correction was stored.

Phenomenon

In a conversation you say "no, the date is March 12" and the model starts using the right date. Later, in the same conversation or in a new one, the wrong date comes back. It is easy to read that as "it did not learn." The useful question is different: where was the correction when the model answered?

Mechanism

Anthropic's documentation defines the context window as all the text a language model can consult while generating a response, including the response itself. It says this is different from the large dataset the model was trained on, and that it works like a working memory. In the API, each turn receives the whole previous history plus the new message as input, and the generated response becomes part of the input for the next turn. Your correction only influences the answer if its text is inside the window at that moment. Correcting the conversation is not training the model. It is adding a line of text to the input. That explains two ways the mistake can return: 1. A new conversation. The correction is not there, because the new window does not contain the previous one. 2. A long conversation. The same documentation notes that chat interfaces, such as claude.ai, may manage the window continuously, first in, first out. It also says that as the token count grows, accuracy and recall degrade, a phenomenon called "context rot." A study published in TACL (Liu et al., 2024) measured that performance can drop sharply as the position of the relevant information changes, and that it is worse when that information sits in the middle of the context.

What this does not prove

It does not prove that this is what happened in your conversation. None of these sources show the inside of a specific product, and each product decides what enters the window. The Liu et al. study tested specific tasks (questions about several documents, and key-value retrieval) with the models of that time, and it does not claim that any correction in the middle of a conversation will be ignored. It also does not prove that the model "never learns": product memory features exist, and they are a different subject (see the article on product memory).

A check you can run

Test the hypothesis instead of accepting it. 1. Write down the question that made the mistake come back. 2. Open a new conversation. Paste the correction as the first message, then ask the question. 3. In another new conversation, ask the same question without the correction. 4. Compare. If only the version with the correction gets it right, the correction depends on being in the window's text. 5. Repeat with the correction at the very start, and again after several long messages. If the answer changes with the distance, you saw the effect of position and size on your own task. One attempt is not evidence. Repeat it a few times before you conclude. Sources: Anthropic, Context windows: https://platform.claude.com/docs/en/build-with-claude/context-windows (opens in a new tab) Liu et al., Lost in the Middle: How Language Models Use Long Contexts, TACL 12, 2024: https://aclanthology.org/2024.tacl-1.9/ (opens in a new tab)

Comments

Loading comments…