Models and labs

How do you use Gemini 2.5 Pro for long documents?

Written as of · Published · By Robert Scales, with AI tools · 3 min read

Short answer

Upload the whole PDF, count its tokens to confirm it fits in the one-million-token window, and ask questions that require page numbers and short quotes for every claim. Then check a sample of those citations against the document yourself before you rely on the answers.

Gemini 2.5 Pro, which Google released as an experimental model on March 25, has a context window of one million tokens. The context window is how much text a model can consider at once; a token is a piece of a word, and one million tokens is roughly 750,000 words. That is enough for a long annual report, a set of contracts or a thick technical manual in a single request, with room left for your questions. Google says a two-million-token window is coming.

It is also a thinking model: before answering, it works through the problem internally. For documents, that helps with questions that combine facts from different chapters, such as "Does the budget in section 7 match the targets in section 2?" Right now you can use it through the Gemini API, in Google AI Studio (Google's developer workspace), and in the Gemini app if you subscribe to Gemini Advanced.

A worked example: a 300-page annual report

Imagine a town councillor who receives a 300-page annual report from a regional agency and has a weekend to prepare questions. The report and the outputs described here are illustrative.

Step 1: Upload and count. With the Gemini API and Google's google-genai Python library, you upload the PDF once and reuse it for every question. Counting tokens first tells you whether the whole file fits.

import os
from google import genai

client = genai.Client(api_key=os.environ["GOOGLE_API_KEY"])
MODEL = "gemini-2.5-pro-exp-03-25"

report = client.files.upload(file="annual-report-2024.pdf")

tokens = client.models.count_tokens(model=MODEL, contents=[report, "Summarize."])
print(tokens.total_tokens)   # must be well under 1,000,000

The Gemini API reads each PDF page as an image of the page plus the text extracted from it, so tables, charts and captions are available to the model, not just the body text. Uploaded files are kept for two days.

Step 2: Ask for a map before asking for answers.

Prompt
List every chapter and appendix in this report with its starting page number,
and give one sentence on what each covers. Use the page numbers printed on the
pages. If a section has no printed page number, say so.

This first answer is your checklist. You can compare it with the report's own table of contents in a minute.

Step 3: Ask cited questions.

Prompt
Answer from this report only.
1. What were total operating expenses this year and last year?
2. Which three programs grew the most in spending?
3. Are any targets from the strategic plan section reported as missed?
For every fact, give the page number and a quote of no more than 15 words.
If the report does not say, write "Not in the report." Do not estimate.
response = client.models.generate_content(
    model=MODEL,
    contents=[report, open("questions.txt").read()],
)
print(response.text)

Asking for a page and a short quote does two jobs: it pushes the model to anchor each answer in the text, and it gives you something quick to verify.

Try it: Take a long PDF you know well, such as a manual or a policy you have read, and ask Gemini 2.5 Pro five questions with page citations. Check every citation, and note how many were exact, close or wrong.

Tips that save time

  • One document, many questions. Keep the uploaded file and send several short requests rather than one enormous prompt; each answer is easier to check.
  • Name the section when you can. "In the financial statements, …" narrows the search and reduces mix-ups between similar tables.
  • Ask for disagreements. "Where does the report contradict itself?" is a question long-context models are good at and humans find tedious.
  • Watch the label. This is an experimental release, so behaviour and availability may change; save prompts and answers you rely on.

How do you check that it read everything?

You can't watch a model read, but you can test whether its answers draw on every part of the document. First, the token count from Step 1 confirms the whole file was sent. If the number seems far too low for 300 pages, the PDF may be a scan with little extractable text, or the upload may have failed.

Second, use the chapter map from Step 2 as a coverage test. Then ask one specific question about each part, making sure to include the last third of the document and the appendices, the parts a quick reader is most likely to skip. A good question has a single, checkable answer: "What is the figure in the last row of the table on staffing in Appendix C?" If answers about late pages are vague or wrong while early pages are precise, treat the analysis as incomplete.

Third, check the citations. You don't need to verify all of them; pick five at random and open those pages. Quotes should match the page they cite, word for word. A quote that exists but sits on another page is a small error; a quote that doesn't exist at all is a serious one, and a sign to re-ask that question more narrowly. Combine the three checks and you know not only what the model said, but how much of it you can trust.

Sources

  1. Gemini 2.5: Our most intelligent AI model — Google (The Keyword), March 25, 2025
  2. Gemini API: Read a PDF — Google Gemini Cookbook (GitHub), April 4, 2025
  3. Google unveils a next-gen family of AI reasoning models — TechCrunch, March 25, 2025

Sources for the articles linked in the text

Each linked article has its own page, with its sources and its date.

From the Guide to Artificial Intelligence, by Robert Scales, published by Holistic Hybrid Inc. Share and adapt it under CC BY-NC-SA 4.0: credit the guide, link to https://guidetoartificialintelligence.com/en/learn/use-gemini-2-5-pro-long-documents/, no commercial use without permission, and keep the same licence.

Get the free Guide to Artificial Intelligence

Sign up for the newsletter and receive the free guide: what changed in AI, one lesson, one prompt to try. Unsubscribe in one click.

How we handle your address

Back to top

Display

Your choices are saved in this browser only. No data is sent.

Text size
100%
Colours
Reading
More settings
Accessibility statement

Get the app

Add the guide to your home screen. It opens like an app, and the pages you have read stay available offline.

Read without a connection: download the articles

iPhone and iPad (Safari, Chrome, Edge)

  1. Tap the Share button (the square with an arrow). In Chrome and Edge, it is in the address bar or the menu.
  2. Choose “Add to Home Screen”.
  3. Tap “Add”.

Android (Chrome, Edge, Samsung Internet, Firefox)

  1. Open the browser menu (⋮ or ☰).
  2. Choose “Install app” or “Add to Home screen”.
  3. Confirm with “Install”.

Computer (Chrome, Edge)

  1. Click the install icon at the right end of the address bar, or open the browser menu (⋮ or …).
  2. In Chrome, choose “Cast, save and share”, then “Install page as app”. In Edge, choose “Apps”, then “Install this site as an app”.
  3. Click “Install”.

Mac (Safari)

  1. Open the File menu.
  2. Choose “Add to Dock”.
  3. Click “Add”.

Firefox on a computer can’t install a site as an app. Use Chrome, Edge or Safari instead.