Sub topic 6
Why long inputs degrade quality
This chapter assumes you can send prompts to an LLM through an API, you know what a token is, and you have read the earlier chapters on context windows and single-pass summarisation. It explains why a document that fits in the context window can still produce a worse summary than a shorter one, and what to do about it.
Fitting is not the same as working well
The context window is a hard limit. If your input plus the output exceeds it, the call fails or the input is cut. Many people read this limit as a quality guarantee: if the document fits, the model will use all of it equally well. That is not true.
Quality depends on how the model attends to the text, not only on whether the text is accepted. In practice, summaries of very long inputs show these problems:
- Material in the middle of the input is under-represented.
- The summary leans on the opening and closing sections.
- Details such as numbers, names and dates are dropped or blended.
- The model drifts from your instructions as the input grows.
- The summary becomes generic, covering what the document is about instead of what it says.
The size of these effects varies by model and by task. Newer models with long windows are much better than older ones, but none is immune. Treat the effects as risks you test for, not as fixed laws.
Lost in the middle
Researchers have measured a position effect in long-context tasks. In studies on multi-document question answering and key-value retrieval (Liu et al., "Lost in the Middle", 2023), accuracy was highest when the relevant information sat at the start or end of the input. It was lowest when the information sat in the middle. Plotted against position, the result looks like a U-shape.
For summarisation, this means a 100-page report may get a summary that covers the executive overview and the conclusions well, while a key finding on page 50 is missing or reduced to half a sentence.
The numbers in this chart are illustrative. They show the shape, not measurements from a specific model. Your own model may show a flatter curve, and the dip may appear only above a certain length.
Why it happens
No one has a single complete explanation, but several mechanisms are commonly cited:
- Attention is spread thin. Each output token attends over every input token. With more tokens, the share of attention that any one passage can receive tends to fall.
- Position bias from training. Many training documents put the important material at the beginning (titles, abstracts, introductions) or at the end (conclusions). Models can learn to expect this.
- Few long training examples. Models see far fewer examples of very long inputs than short ones, so behaviour at long lengths is less well tuned.
- Positional encoding limits. Methods that extend the context window may keep the model functional at long lengths without keeping it equally precise.
Other long-input failure modes
Omission
The most common failure is silent omission. The summary reads smoothly, so nothing signals that a section was ignored. A reader who has not seen the source cannot tell.
Blending and confusion
When a document discusses several similar entities, such as three vendors, four trial arms or two quarters, the model may attach a figure to the wrong one. This gets more likely as the entities sit further apart in the text.
Instruction drift
If your instructions come first and the document is long, the model may follow them less closely by the time it writes the answer. Format rules ("exactly five bullets") and constraints ("use only the text") are the first to slip.
Generic output
With a lot of material, the model may fall back on high-level statements that sound right for this kind of document. A summary of a long contract may say "the agreement sets out obligations for both parties" without naming any of them.
Cost of distractors
Irrelevant text is not free. Boilerplate, repeated headers, navigation text and long tables of low-value data compete for attention with the content you care about.
| Failure | What you see | Typical trigger |
|---|---|---|
| Omission | Whole sections missing | Content in the middle of a very long input |
| Blending | Right number, wrong entity | Many similar entities far apart |
| Instruction drift | Wrong format or extra commentary | Instructions far from the output |
| Generic output | Vague statements, few specifics | Large, varied input and an open prompt |
| Noise sensitivity | Summary covers boilerplate | Headers, footers, repeated text |
Detecting the problem
You cannot see position bias by reading one summary. You need a test that checks coverage by position.
A practical method is a probe test:
- Take a representative long document.
- List a set of facts you expect a good summary to contain, spread across the document.
- Summarise the document in one pass.
- Record which facts appear, and where in the source each came from.
- Repeat on several documents and check whether coverage drops in the middle.
The sketch below splits a document into position bands and reports coverage per band. It uses simple substring matching on key phrases, so it is a rough check. It will miss paraphrases, so use phrases that a summary would likely keep, such as names and numbers.
def coverage_by_position(document, summary, key_facts, bands=5):
"""key_facts: list of short strings (names, numbers) that appear in document.
Returns a list of (band_index, found, total) tuples.
"""
summary_lower = summary.lower()
doc_lower = document.lower()
band_size = max(1, len(document) // bands)
results = [[0, 0] for _ in range(bands)]
for fact in key_facts:
position = doc_lower.find(fact.lower())
if position == -1:
continue # fact not in the document, skip it
band = min(position // band_size, bands - 1)
results[band][1] += 1
if fact.lower() in summary_lower:
results[band][0] += 1
return [(i, found, total) for i, (found, total) in enumerate(results)]
if __name__ == "__main__":
document = (
"Acme revenue was 4.2 million. " * 3
+ "Beta Corp lost 1.1 million in March. " * 3
+ "Gamma Ltd hired 40 staff. " * 3
)
summary = "Acme earned 4.2 million. Gamma Ltd hired 40 staff."
facts = ["4.2 million", "1.1 million", "40 staff"]
for band, found, total in coverage_by_position(document, summary, facts, bands=3):
print(f"band {band}: {found}/{total} facts found")In this example the middle band reports 0 of 1 facts, which is the pattern you are looking for. With real data you need enough documents for the pattern to be more than noise. Ten facts in one document tell you little.
Mitigations
No single fix removes the problem. The options below trade effort, cost and quality differently.
Reduce the input
The cheapest fix is to send less text. Strip boilerplate, page headers and footers, navigation menus, repeated legal notices and tables that do not matter for the purpose. If you only need the findings of a report, you may not need the appendix.
Reposition instructions and key material
- Put the task instructions at the start, and repeat the critical constraints after the document.
- If you know which section matters most, place it at the start or end of the input.
- Label sections clearly, for example with headings or numbered markers, so the model can refer to them.
A prompt that repeats its constraints after the document looks like this:
def build_prompt(document, purpose, length):
return (
f"Task: summarise the document below for {purpose}. "
f"Length: {length}. Use only information in the document.\n\n"
"<document>\n"
f"{document}\n"
"</document>\n\n"
f"Reminder: write {length}, for {purpose}, "
"and cover every numbered section. Use only information in the document."
)
print(build_prompt("1. Intro ...\n2. Results ...", "a finance team", "under 150 words"))Ask for structure
An open request like "summarise this" allows the model to skip sections. A structured request pushes it to visit each one. Ask for one bullet per section, or a fixed set of headings such as Purpose, Findings, Risks and Decisions. A fixed structure also makes omissions visible, because an empty heading is easy to spot.
Split the work
When the document is long enough that quality drops, stop sending it whole. Chunking and combining summaries keeps each call short, so each part gets full attention. The next chapters cover this in detail. The price is more calls, more cost and a chance of losing context across chunk boundaries.
Choose by measurement
Do not assume that splitting is always better. For a document that is long but still moderate, a strong long-context model in one pass may beat a chunked pipeline, because it sees cross-references between sections. Test both on your own documents, using the probe method above.
Common mistakes
- Trusting the window size. A 200,000-token window does not mean 200,000 tokens of reliable attention.
- Judging by fluency. A smooth summary can still miss a third of the document.
- Testing on one document. Position effects show up in aggregate. One example proves little.
- Putting everything in the middle. Pasting extra context, examples and the document in one block, with the key instruction in the centre, invites the problem.
- Assuming the problem is gone in new models. Re-run your probe test when you change models. Behaviour changes between versions.
Summary
Long inputs can degrade summaries even when they fit in the window. Information in the middle is often under-used, details get blended, and instructions drift. You can detect this with a probe test that measures fact coverage by position. You can reduce it by trimming input, repeating constraints, asking for structure, and splitting the document when measurement shows a gap.
Exercise
You summarise a 60-page report in one pass. A probe test with 20 key facts shows that 9 of the 10 facts from the first and last 15 pages appear in the summary, but only 3 of the 10 facts from the middle 30 pages do. Name this pattern, and give two changes you would try, in order, before building a full chunked pipeline.
Show answer
The pattern is a lost-in-the-middle effect: coverage is high at the start and end of the input and low in the middle. Try first: (1) trim boilerplate and irrelevant sections to shorten the input, and (2) use a structured prompt that asks for one bullet per numbered section, with the constraints repeated after the document. Re-run the probe test after each change. If middle coverage stays low, split the document into chunks and use map-reduce or refine.
Exercise
Your probe function reports that a fact is "missing" from a summary, but when you read the summary it says "revenue grew by roughly four million" while the key fact was "4.2 million". What is the limitation of the check, and how could you improve it?
Show answer
The check uses substring matching, so it misses paraphrases and rounded numbers. Improve it by listing several accepted variants per fact, normalising numbers before comparing, or using an LLM or human reviewer to judge whether each fact is present in meaning.