◉GEMINI LABJP
●2.5 ROUTE — From today, 12/1, calls to gemini-2.5-pro and 2.5-flash are rerouted to newer models automatically●CLI 0.71.1 — Gemini CLI stable is still v0.71.1, with a 0.73 nightly published on 11/30●INTRO END — Introductory pricing for 3.8, 3.7 and 3.6 Flash ends on 12/31. 30 days left●VERTEX — Developers are asking how to run Gemini CLI with Vertex AI credentials●NEON — Gemini 4 Neon became generally available on 11/18 (paid tier only)●IMAGE TEXT — A new test shows text inside an image can sway Gemini's answer●2.5 ROUTE — From today, 12/1, calls to gemini-2.5-pro and 2.5-flash are rerouted to newer models automatically●CLI 0.71.1 — Gemini CLI stable is still v0.71.1, with a 0.73 nightly published on 11/30●INTRO END — Introductory pricing for 3.8, 3.7 and 3.6 Flash ends on 12/31. 30 days left●VERTEX — Developers are asking how to run Gemini CLI with Vertex AI credentials●NEON — Gemini 4 Neon became generally available on 11/18 (paid tier only)●IMAGE TEXT — A new test shows text inside an image can sway Gemini's answer
Articles/API / SDK
◈ API / SDK/2026-07-12Advanced

When a Whole Chapter Vanished From My Long-PDF Summary — Field Notes on Auditing Coverage

Chapter-wise summarize-then-merge works well on long PDFs, but a lost extraction or a merge step can drop an entire chapter while the pipeline finishes without a single error. This walks through catching those silent drops with one number—coverage—and re-running only the chapters that fell out.

gemini-api291pdf6summarization4long-context4coveragepython113

✦ Premium Article

The other day I nearly made a call from an AI summary of a 480-page spec: "this product is relaxed about its limits." In reality, sitting roughly in the middle of the document, there was an entire chapter dedicated to constraints and limits. Not a trace of it survived in the summary. The pipeline had run to completion without raising a single error.

The chapter-wise summarize-then-merge pattern works well on long PDFs. But the very shape of it—split into chapters, summarize in parallel—hides a blind spot: when one chapter quietly goes missing, nothing tells you. Here are my field notes on catching that loss with a single number called coverage, and on a self-auditing pipeline that automatically re-runs only the chapters that fell out.

The Summary Finishes Cleanly Even After a Chapter Disappears

Single-shot summarization degrades in an obvious way: the back half gets thin. Chapter splitting fails more insidiously. Because it treats chapters as a set, dropping one element still leaves the remaining elements to compose into perfectly clean prose. The reader sees no gap.

The paths by which a chapter disappears fall into three groups.

PathWhat is happeningTypical symptom
Missing outlineSome chapters are not registered in the PDF bookmarks, so they never enter the chapter listChapter count is lower than the table of contents. Body text gets absorbed into neighbors
Empty textThe pages are scanned images and extract_text() returns an empty stringA chapter with no body collapses into a one-liner like "the appendix contains various details"
Dissolving in mergeDuring the final merge, a thin chapter gets dropped by the modelThe chapter survives in the per-chapter summary but its claims vanish from the final one

None of these are failures of the model. They are structural failures of the pipeline. That is precisely why a smarter model does not fix them. What needs fixing is the mechanism that measures whether every chapter reached the final artifact—and names the ones that did not.

Put One Number in Place: Coverage

Before stacking up elaborate quality metrics, decide on just one number. Of the source chapters, the fraction whose claims are reflected in the final summary. Call it coverage.

SymbolDefinition
SThe set of chapters extracted from the source PDF (those with non-empty bodies)
RThe set of chapters whose claims can be found reflected in the final summary (R ⊆ S)
Coverage|R| / |S|. 1.0 means every chapter is represented

The moment coverage drops below 1.0, some chapter failed to reach the final artifact. The important discipline is not to overload this number as an overall quality score. Coverage is only a detector for dropped chapters; the quality of the summary itself is measured separately. Load a single number with too much meaning and its threshold becomes ambiguous, and the check quietly stops mattering in practice.

As a second safety net at the extraction stage, watch each chapter's body length too. A chapter with an extremely short body—say, under a tenth of the overall median—goes onto a warning list as a candidate for the empty-text path. It is a gate that rejects broken input before it ever reaches summarization.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦Separates the three quiet paths by which a chapter disappears—missing outline, empty text, and dissolving during merge—by symptom
✦Detects the loss with a single coverage number and re-runs only the chapters below threshold, in a working Python audit pipeline
✦Routes the verification pass to gemini-flash-latest and gemini-embedding-2, keeping audit cost under a tenth of the main summary
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Gemini Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

Related Articles

◈ API / SDK2026-10-22
Before You Swap in gemini-4-argon, Search Your Own Code for What to Remove
Four habits can break or silently change when you move to gemini-4-argon: explicit caches, sampling parameters, small max_output_tokens and short timeouts. A stdlib-only script finds them in your repository, with what to check after the swap and when to stay on Flash.
◈ API / SDK2026-10-19
When 404 and 429 Show Up in the Same Gemini API Log, Check the Model Name Before the Quota
A triage order for Gemini API logs that mix 404 NOT_FOUND and 429 RESOURCE_EXHAUSTED, plus a small Python script that separates a bad model name from a real quota limit without generating anything.
◈ API / SDK2026-10-16
The Day /models Returns 200 but generateContent Returns 403 — Decide Your Triage Order Before It Happens
A triage order for the case where listing models succeeds with 200 but generation fails with 403 permission_denied. Includes a small diagnostic script that checks key, project, and billing in turn, why you should not retry a 403, and how to assemble what support needs.