Skip to main content

PDF Corpus Scaling Incident

Historical document

This page records an operational (quality, not medical-safety) incident from March 2026. It is kept for its lessons. Evaluation figures are self-reported: they come from the project's own golden question set, which measures entity recall and must-refuse behaviour only, and they are not independent evidence of answer correctness.

Date: 2026-03-29 Severity: Quality regression — golden-set pass rate dropped from 99.7% to 98.7% (self-reported, 299-question set) Resolution: Retroactive boilerplate cleanup and a fix to the PDF extraction pipeline Lesson: RAG systems that handle mixed content types (HTML + PDF) need per-format boilerplate detection

Status (May 2026)

The pipeline fix stayed in place across the following weeks of automatic ingest cycles (the pilot corpus reached 5,841 completed documents). No recurrence of brochure-cover boilerplate was observed in that period. The retroactive deletion and the preventive extraction change shipped together.


Timeline​

TimeEvent
March 27Evaluation baseline: 99.7% (298/299), about 3,500 chunks, all from HTML pages
March 28573 PDF brochures ingested from the hospital's brochure source, producing 6,485 new chunks
March 29Evaluation regression: 98.7% (295/299), 4 new failures
March 29Root cause identified: brochure boilerplate flooding retrieval
March 29Retroactive fix: 449 boilerplate chunks deleted, PDF pipeline patched

The Problem​

After ingesting 573 PDF brochures, the number of document chunks went from about 4,400 to about 10,900, with 59.6% of all chunks now coming from brochures. The boilerplate detection system (7 layers, documented in Content Deduplication) was designed for HTML content and worked well for web pages. But it had a critical blind spot: text extracted from PDFs bypassed all text-level boilerplate filtering.

Every hospital brochure has a standardised cover page: the brochure title, the hospital name, and a block listing the campus addresses. This identical address block appeared in 449 chunks across 441 brochures, each with a slightly different title prepended (which made the content hashes unique and defeated the cross-document dedup).

Impact on Retrieval Quality​

Before: balanced index​

About 4,400 chunks, all from web pages (department pages, doctor profiles, conditions, treatments) — well-targeted content, each page about one topic.

After: brochure-dominated index​

  • Brochures: 6,485 chunks (59.6% of the index), of which 449 were pure boilerplate (campus address blocks), and one chemotherapy brochure alone contributed 51 chunks.
  • Web pages: 4,394 chunks (40.4% of the index), the same quality content but now outnumbered roughly 1.5 to 1.

Concrete failure examples​

Example 1 — a question about where to go for chemotherapy for breast cancer. Expected: the breast-centre department page (one short chunk). Retrieved: the chemotherapy brochure, whose 51 chunks dominated semantic retrieval and pushed the authoritative department page, which directly answers "where can I go?", below the relevance threshold. The model answered from brochure content (treatment locations, room numbers) instead of the department overview.

Example 2 — a question about doctors working on two specific campuses. Expected: doctor-campus relationship data. Retrieved: hundreds of brochure cover pages mentioning both campus names as address boilerplate. The signal was drowned in noise.

Why Existing Deduplication Didn't Catch This​

LayerWhy It Didn't Help
1. URL dedupEach brochure has a unique URL
2. Title dedupEach brochure has a unique title
3. Canonical URLPDFs don't declare a canonical link
4. Boilerplate CSSCSS selectors don't apply to PDFs (no page structure)
5. Cross-doc hashEach cover page had a different title prepended, making hashes unique
6. Language filterContent is in Dutch (correct language)
7. Re-ingestionEach brochure was new content

The architectural gap: text-level boilerplate patterns were applied only to text extracted from HTML. PDF extraction returned raw text directly, bypassing all text filtering.

Resolution​

Retroactive fix (immediate)​

The 449 boilerplate chunks were removed directly from the pilot database, targeting short chunks containing the campus address block. This removed the boilerplate without requiring re-ingestion of 573 PDFs.

Pipeline fix (preventive)​

  1. PDF extraction now applies the same text-level boilerplate stripping as HTML extraction.
  2. New patterns specifically target the brochure cover blocks (campus address patterns with postal codes).
  3. Hospital-specific PDF boilerplate patterns can be added through the pipeline configuration, the same as HTML patterns.

Measured result (self-reported)​

MetricBefore FixAfter Fix
Total chunks10,87910,430
Brochure chunks6,485 (59.6%)6,036 (57.9%)
Boilerplate chunks4490

Lessons Learned​

1. Content type parity​

Every content extraction path must have the same quality gates. The HTML pipeline had 7 dedup layers; the PDF pipeline had no text-level filtering. When the corpus grew from HTML-only to mixed HTML+PDF, the untested path became the dominant content source.

Principle: if you add a new content type (PDF, DOCX, email), test the full quality pipeline against it before bulk ingestion.

2. Corpus composition matters more than corpus size​

Going from 4,400 to 10,900 chunks did not by itself cause the regression. The 59.6% brochure composition did. One content type overwhelmed the index with dense, procedural content that competed with navigational content for the same queries.

Principle: monitor content type ratios in the index. If any single category exceeds 50%, investigate whether it is diluting retrieval for other categories.

3. Boilerplate is format-specific​

HTML boilerplate (menus, cookie banners, footers) looks nothing like PDF boilerplate (cover pages, address blocks, legal disclaimers). A detection system designed for one format won't catch the other.

Principle: boilerplate detection must be format-aware, not one-size-fits-all.

4. Test at production scale before declaring victory​

The system passed 99.7% (298/299 scored questions, self-reported) with HTML-only content. The regression only appeared after ingesting real-world PDFs. Evaluation on clean data does not prove readiness; you need to test with the messy, heterogeneous content that the system will actually handle.

Principle: run the full evaluation suite after every major content ingestion, not just after code changes.