Techniques · Chapter 6 of 11
Long inputs and structure
A long prompt needs a shape. Mark what is material and what is instruction, put them in a sensible order and say what should come back.
By Kasum BajramiUpdated

Mark the parts
Once you paste documents into a prompt, the model has to see where your material ends and your instructions begin. Headings or tags do that:
- Anthropic recommends XML-style tags with consistent, descriptive names, nested where the content is nested Anthropic.
- OpenAI uses Markdown headings and lists for sections, and XML tags to mark where a document starts and ends OpenAI.
- For Gemini 3, Google asks you to pick one style and keep it throughout the prompt Google.
A long prompt with tags
<offer name="A"> [paste offer A] </offer> <offer name="B"> [paste offer B] </offer> <instructions> Compare the two offers for a small club. Use only what the offers say. </instructions> <question> Which offer costs less over one year, and what does it leave out? </question>
Documents first, question last
Put long material near the top and your question after it. Anthropic reports that in its tests, queries at the end can improve response quality by up to 30%, especially with several documents Anthropic. For Gemini 3, Google gives the same order and suggests a bridging phrase such as “Based on the information above” Google. OpenAI's guide, by contrast, usually puts context near the end of a prompt, since it often changes from request to request OpenAI, so test both on your model.
1 · Documents
- <document name="offer-a"> …
- <document name="offer-b"> …
- <document name="minutes"> …
2 · Instructions
How to work with them: limits, format, what to quote.
3 · Your question
Based on the documents above, which offer …?
For Gemini 3, Google puts the role, important constraints and the output format at the very start, above the documents, or in the system instruction Google.
Quote before you answer
With long documents, ask the model to copy out the relevant passages before it answers. Anthropic suggests this to focus on what matters Anthropic and to ground the answer in the actual text, which reduces invented claims Anthropic.
Quote, then answer
First, copy the passages from the documents that matter for my question into <quotes> tags, word for word. Then answer the question using only those quotes. If the quotes don't answer it, say so.
Ask for the shape you want
Name the format, and show it if it is unusual. Anthropic suggests saying what to do and matching the style of your prompt to the style you want back Anthropic. When a program reads complex JSON, use the provider's structured output feature instead of describing it in prose Google.
Weak
Give me the dates from this contract.
Better
List every date in the contract below as a table with the columns Date, What happens and Clause number. Sort by date. Write "none" if a column has no value.
Sources
Official guides by the model providers. They change as models change, so check them for your model.