thinkhard.SI

Prompt patterns Put long documents first

Put long documents first

When a prompt holds something long, such as a contract, a transcript or a stack of interviews, paste the material at the top and ask the question at the end. Open the question with a phrase that points back, such as “Based on the contract above”. Anthropic and Google both recommend this order for long inputs, and OpenAI’s advice for ChatGPT adds a twist worth knowing.

WritingPublished October 29, 2026, a 5-minute readAll patterns

What it is

An order for long prompts. Most people type the question first and paste the document under it, because that is how an email reads. This pattern turns it around: the material goes at the top, each document in its own fence, and the question comes last, with a short phrase that ties it to what came before.

The order for a long prompt
A one-line heads-up, if you like The long material the contract, the transcripts, the report, each in its own tag Most of the prompt The question, last “Based on the contract above:” The answer starts here

The vendors report test results for this order rather than a reason. Anthropic says that for long inputs, putting the query at the end can improve response quality by up to 30 percent in its tests, especially with complex inputs made of several documents. Google says that in most cases, especially when the total context is long, performance is better with the question at the end.

When it helps

It helps when the material is long. Anthropic’s advice is for inputs of 20,000 tokens or more, which by the site’s rule of thumb of 500 to 700 tokens a page is roughly 30 to 40 pages. Contracts, transcripts of long meetings, research reports, a quarter’s worth of support tickets, a dozen interviews: these are the prompts where the order matters most.

It helps most with several documents at once. Tag each one, give it a number or a name, and the question at the end can refer to them precisely: “in which interviews does onboarding come up?”

And the anchoring phrase is worth adding even when you are unsure about order. “Based on the contract above” tells the model which material the question is about, which matters when a prompt holds more than one thing.

When it does not

For short prompts it hardly arises. The vendor advice is aimed at long inputs; for a paragraph of notes, put things where they read naturally.

OpenAI’s advice is different. Its prompt engineering guide puts context near the end of its standing instructions, after the rules, because the context changes from request to request. And its prompting guide for GPT-4.1 reported that with long context, instructions at both the beginning and the end worked better than either alone, and that if you give them once, above the material worked better than below. For ChatGPT, a one-line heads-up at the top plus the full question at the end covers both.

When you attach a file in a chat app instead of pasting it, the app decides where the file’s text goes. You still control your message: end it with the question.

Order is not accuracy. A long document still invites answers that drift from it, so ask for the passages the answer relies on, the approach in the guide to summarizing long documents, and say what to do when something is not there.

Before and after

Two long prompts, before and after. Each score comes from the Prompt Grader’s free ten-check estimate, written for any chat model.

Before 2 out of 10
Does this contract let us end it early, and what would it cost us? Quote the clauses you rely on.

<contract>
[the full agreement]
</contract>
After 2 out of 10
<contract>
[the full agreement]
</contract>

Based on the contract above: does it let us end it early, and what would it cost us? Quote the clauses you rely on.

The words are the same, so the score is the same: the free estimate counts what a prompt says, not where it says it. The difference is the one the vendors measured. With a long contract between the question and the answer, the question is the last thing the model reads in the second version, and the first in the other.

Before 2 out of 10
What do customers say about onboarding? Here are twelve interview transcripts.

[transcript 1]
[transcript 2]
...
[transcript 12]
After 3 out of 10
<interviews>
<interview id="1">[transcript 1]</interview>
<interview id="2">[transcript 2]</interview>
...
<interview id="12">[transcript 12]</interview>
</interviews>

Using only the interviews above, what do customers say about onboarding? Give the three most common points, each with the interview numbers it came from.

The first version gives the model one long run of text with nothing to say where one interview ends. The second numbers each one and asks for the numbers back, so every point can be traced to the interviews it came from. Only the size, three points, shows up in the score.

The line to add

<document>
{{the_long_material}}
</document>

Based on the document above, {{your_question}}. Quote the parts you rely on.

For ChatGPT, add one line at the very top as well: “Below is {{what_it_is}}. After it, I will ask a question about it.” For several documents, give each its own tag with a number or a name.

In ChatGPT, Claude, Gemini and Copilot

Anthropic’s guide for Claude says to place long documents near the top, above the query, instructions and examples, for inputs of 20,000 tokens or more, and reports the gain of up to 30 percent in its tests. It also suggests wrapping each document in tags with its source, and asking Claude to quote the relevant parts before answering.

Google’s guide for Gemini 3 says to supply all the context first, put the specific question at the very end, and bridge the two with a phrase such as “Based on the information above”. Its page on long context gives the same advice.

For ChatGPT, follow OpenAI’s version above: a heads-up first, the material, then the question. Microsoft’s guide to Copilot prompts does not address order; its source part lets you point Copilot at a file instead of pasting it, and when you do paste, material first and question last matches the other three.

Key takeaways

  • Long material at the top, the question at the end.
  • Open the question with a phrase that points back: “Based on the contract above”.
  • Tag and number each document when there are several.
  • For ChatGPT, add a one-line heads-up at the top as well.
  • Order helps, but it does not check facts. Ask for quotes.

Questions

Where should I put the question in a long prompt?

At the end, after the material, opened with a phrase that points back to it, such as “Based on the report above”. Anthropic and Google both recommend this for long inputs. For ChatGPT, OpenAI’s guidance for long context suggested instructions at both the start and the end, so add a one-line heads-up at the top too.

How do I get AI to summarize a long document accurately?

Paste the document first and the request last, ask for the summary to quote the passages it relies on, and say what to do when something is not in the document. Then spot-check the quotes. The guide to summarizing long documents walks through it step by step.

Is my document too long for ChatGPT or Claude?

Every model has a limit on how much text it can take in at once, called the context window, and the limits differ by model and plan. Paste the text into the Token Counter to see whether it fits each model, and split it into parts if it does not.

Prompts to use with this

Browse all 519 prompts