Skip to content
mentoor

Topic 2 of 5 · 4 min read

Quality loss in long context

Goal: Predict where in a long prompt key facts are most likely to be missed and reorder the input to reduce the risk.

A model does not read a long input evenly: it uses the start and the end best, tends to miss facts buried in the middle, and gets less accurate as the input grows. Fitting in the window does not mean being used well.

Check yourself · 1 of 3

A model gets a 30-page document. Where is a single key fact most likely to be missed?

Choose one answer

Why it matters

You paste a 40-page report and ask a question. The answer sounds sure and cites the wrong section. The fact was in the file, but the model leaned on other text. Researchers call one version of this "lost in the middle". In the 2023 paper of that name, models answered best when the relevant passage was at the beginning or end of the input, and worse when it sat in the middle (see the Lost in the Middle reference). Later tests, such as Chroma's "context rot" study, found accuracy also falls as the input gets longer, even on simple tasks, and that unrelated text makes it worse.

Newer models handle this better than older ones, but the pattern has not gone away. Treat it as a risk to design around.

How to reduce the risk

  1. Put the important material at the edges. The question or instructions go at the end, close to where the model starts writing. Key facts go at the start or end.
  2. Cut what is not needed. Every extra paragraph is a chance to distract. Paste the three relevant sections, not the whole file.
  3. Name the thing to find. "Find the termination clause in section 9" beats "check this contract".
  4. Ask for quotes. "Quote the sentence you used" makes a missed or invented fact easier to catch.
  5. Check the answer against the source for anything that matters.

Before and after

Before: Ten pages of meeting notes, with the budget decision on page 6, then: "Summarise the decisions."

After: The same notes, with the line "The decision I care most about: the budget approval for Q3" placed first, the notes in the middle, and at the end: "Using only the notes above, list every decision. Quote the sentence for each."

The second version tells the model what to look for, repeats the target at the edge and asks for evidence.

What goes wrong

  • Burying the key fact. A single critical line in the middle of many pages is the easiest to miss.
  • Adding "just in case" material. Extra documents feel safe but dilute the useful ones.
  • Trusting a confident tone. The model does not know what it missed, so the answer looks equally sure either way.

Examples

Reordering a long prompt

Weak order: background (3 pages), the one rule that matters, more background (5 pages), question.

Better order: the one rule that matters, background trimmed to what applies, then the question with a reminder of the rule.

A quote check

After a long summary, ask: "For each decision, quote the exact sentence from the notes." If a quote cannot be found in the notes, the decision was missed or made up.

Key points

  • Models tend to use the start and end of a long input better than the middle.
  • Accuracy can fall as input grows, and unrelated text makes it worse.
  • Place instructions and the most important facts at the edges, with the question last.
  • Trim to the relevant parts instead of pasting everything just in case.
  • Ask for quotes so a missed or invented fact is easy to spot.

Common mistakes

  • Burying the one critical fact in the middle of a large paste.
  • Adding extra documents for safety, which adds noise.
  • Putting the question first and then 30 pages of text, so the task is far from the answer.
  • Believing a confident answer proves the whole input was read.

Check yourself · 2 of 3

You paste a long contract and one clause matters most. Which change helps most?

Choose one answer

Check yourself · 3 of 3

Why is pasting every possibly useful document into a prompt a risky habit?

Choose one answer

Practice items, not counted towards your mastery.

Start here