Back to Prompting

How Do You Handle Very Long Inputs in a Prompt?

How Do You Handle Very Long Inputs in a Prompt?
AI Tutorials Team 26 June 2026

Context windows now run to hundreds of thousands of tokens, which makes it possible to paste an entire book. Possible is not the same as advisable, because attention across a long input is not uniform and the difference shows up exactly where you would not notice it.

What is the problem with long inputs?

Material near the beginning and end of an input is attended to reliably; material in the middle is not. This has been demonstrated repeatedly and persists in models with very large advertised windows.

The practical consequence is that a crucial clause on page forty of sixty is the single most likely thing to be missed, and nothing in the output indicates that it was.

What works better than pasting everything?

  • Send the relevant part. Twenty pages produces better answers than four hundred.
  • Split and combine. Process sections separately, then reason over the outputs.
  • Retrieve rather than include. Index the material and pull the passages that match.
  • Bracket the instruction. Instruction, content, then the instruction again.

Why does bracketing help?

Because the end of the input is where attention is strongest and where generation begins. An instruction given before four hundred pages has a great deal of material between it and the answer; repeating it afterwards costs a few tokens and measurably improves compliance.

When is splitting the right approach?

Whenever the task is per-section rather than global. Extracting obligations, finding mentions of a topic or checking each part against a rule all decompose naturally, and each call gets full attention on a manageable input.

It is the wrong approach when the answer depends on relationships across the whole document, since no individual chunk contains the answer.

Does the format of the input matter?

More than people expect. A clean text version of a document is read more reliably than a PDF with columns and tables, since the PDF stores position rather than structure and the reading order can be wrong before any reasoning begins.

Where accuracy matters and the source is awkward, converting to plain text and checking the result is worth the extra step. Figures that look wrong are frequently a layout problem rather than a reasoning one.

How do you handle the global case?

In two stages. Summarise or extract from each section, then run a second call over the collected outputs, which are short enough to be attended to properly. This works well and loses whatever the first stage failed to carry forward, so the extraction instruction has to be generous about what it keeps.

What about cost and latency?

Both scale with input length, and the first token takes noticeably longer to arrive because the entire input must be processed first. Caching helps considerably where the same long context is reused across several questions, and most providers discount it heavily.

If you are asking ten questions about one document, sending it once with caching enabled is far cheaper than ten full sends.

How do you check whether the middle was read?

Plant a question. Ask about something you know is in the middle of the document before asking what you actually want to know. If that comes back wrong, no answer from that run is trustworthy.

This takes thirty seconds and is the only reliable way to find out.

Does the order of documents matter?

Yes, and it is easy to overlook. With several documents attached, the first and last receive more reliable attention than the ones between, which means a comparison across five files is not treating them equally.

Where the comparison matters, processing each document separately and then reasoning over the extracted outputs removes the positional effect entirely. It costs more calls and produces results that do not depend on which file happened to be uploaded third.

What is the rule worth applying?

Send the least material that could contain the answer. A large window removes the hard limit on what fits; it does not remove the advantage of a focused input, and the instinct to paste everything because you can is where most long-context disappointment comes from.