Working with long documents
Handle texts that are too long for one prompt: narrow the input, summarise in layers, chunk with overlap, build an index and check accuracy.
In this lesson you will
- Know why long text is hard
- Narrow the input
- Summarise in layers
- Chunk text with overlap
About 17 minutes
The document is longer than the AI can hold
Rafi has a 60-page policy document and a question about holiday pay. He pastes the whole thing in. The AI answers confidently, but the answer contradicts page 41. Long inputs are difficult for two reasons. Every tool has a limit on how much text it can take at once, and even within the limit models can overlook details in the middle of very long text. The skills in this lesson help you get reliable answers from long material.
Know the limits
- Each tool has a maximum amount of text it accepts, which differs by tool and plan. Check your tool’s help page for the current limits.
- Longer is not always better. A focused section often produces a better answer than a whole book.
- Scanned PDFs and images may not be read as text. Check that the tool can really read your file.
Strategy 1: ask about the right part
If you know the relevant section, paste only that. State the question first, then the section, then the rule about unsupported answers:
Question: How many days of paid holiday does an employee get in their second year?
Answer only from the section below. Quote the sentence you used. If it is not stated, reply NOT STATED.
<<<SECTION 4.2
[paste section 4.2 here]
SECTION>>>
Strategy 2: summarise in layers
For a very long document, split it into parts, summarise each part, then summarise the summaries. This is sometimes called map and reduce.
- Split the document by its natural sections (chapters, headings), or into chunks of equal size.
- Summarise each part with the same prompt, keeping a fixed format: key points, numbers, decisions, open questions.
- Combine the part summaries and ask for an overall summary, noting the source section for each point.
- Spot-check three important claims against the original text.
Splitting text into chunks (code)
To split a long text into pieces with a small overlap so that no sentence is lost at the edge, a short program is enough. This one splits a sample into 100-word chunks with a 10-word overlap. The output is real:
text = ("Section one is about cost. " * 40 + "Section two is about timing. " * 40 + "Section three is about risk. " * 40).strip()
words = text.split()
def chunks(words, size, overlap):
start = 0
while start < len(words):
yield words[start:start + size]
if start + size >= len(words):
break
start += size - overlap
parts = list(chunks(words, size=100, overlap=10))
print("Total words:", len(words))
print("Chunks:", len(parts))
for i, part in enumerate(parts, 1):
print(f" chunk {i}: {len(part)} words, starts with: {' '.join(part[:4])}")
Total words: 600
Chunks: 7
chunk 1: 100 words, starts with: Section one is about
chunk 2: 100 words, starts with: Section one is about
chunk 3: 100 words, starts with: Section one is about
chunk 4: 100 words, starts with: Section two is about
chunk 5: 100 words, starts with: Section two is about
chunk 6: 100 words, starts with: Section three is about
chunk 7: 60 words, starts with: Section three is about
The overlap means a fact that sits on a boundary appears in both chunks. Natural boundaries such as headings are even better than fixed sizes when you can use them.
Strategy 3: ask questions in order
Instead of one broad question like “summarise everything”, ask a sequence: What is the purpose? What are the deadlines? What are the exceptions? Who is responsible? Each narrow question is easier to check against the text.
Strategy 4: build an index first
Read the document below and list its sections with a one-line description of what each covers and the page or heading name. Do not summarise yet.
Then use the index to decide which section to paste for each question.
A prompt for a long document
TASK: Summarise this section for a busy manager.
FORMAT: 1) Purpose (1 sentence) 2) Key numbers (bullets) 3) Decisions needed (bullets) 4) Risks (bullets).
RULES: Use only the text below. Mark any missing item as NOT STATED. Keep each bullet under 15 words.
SECTION NAME: [name]
<<<TEXT
[paste section]
TEXT>>>
Accuracy checks for long text
- Ask for quotes with each key claim.
- Check numbers, names and dates against the original.
- Ask ‘what important details might be missing from this summary?’
- Compare two independent summaries. Differences point to risky spots.
Privacy
Long documents often contain personal or confidential information. Do not paste contracts, medical records or customer data into tools that are not approved for them. Remove names and numbers you do not need.
Practice
Take a long article or a set of your own notes. Split it into three parts by headings. Use one prompt on each part, then combine. Then ask three specific questions of the original and check the answers with the quotes the AI gives. Notice where the summary lost detail, and add that detail type to your summary format (for example, ‘always keep numbers and dates’).
Typical losses are dates, exceptions and numbers. Adding ‘keep every number, date and exception’ to the summary prompt fixes most of this. If a fact is still lost, ask the question against the original section instead of the summary.
Trusting a summary of a summary without looking back. Each layer can lose or distort detail. For important points, return to the original text.
Check what you learned
Five quick questions. Pick an answer and you will see straight away whether it is right and why.
Why can long documents cause problems?
- AI cannot read
- Text is always wrong
- Tools have limits and may overlook details
- Prompts cannot have text
Limits and overlooked details.
What is map and reduce summarising?
- Summarise parts, then summarise the summaries
- Delete half the text
- Translate twice
- Ask one huge question
It handles very long text in layers.
Why overlap chunks slightly?
- To make it longer
- So facts at the edges are not lost
- To change language
- To avoid reading
Boundary facts appear in both pieces.
What is a good first step with an unfamiliar long document?
- Ask for a poem
- Paste it into five chats
- Skip reading
- Ask for an index of sections
An index guides what to paste.
What should you check in a summary of summaries?
- Only the length
- Important points against the original
- Only the title
- Nothing
Layers can lose or distort detail.
Summary
- Paste only what the question needs.
- Summarise parts, then combine, and spot-check.
- Overlap chunks and use natural boundaries.
- Protect private information.
Questions
How much text can I paste?
It depends on the tool and plan. Check its help page, and remember that focused sections often work better than huge ones.
Why did the AI miss a detail in the middle?
Models can overlook details in long inputs. Narrow the input or ask targeted questions.
Can I upload files instead of pasting?
Many tools accept files, depending on plan. Check that your file's text is really read, and avoid uploading private documents to unapproved tools.
