Ingesting Millions of PDFs and why Gemini 2.0 Changes Everything
Gemini 2.0 Flash makes large-scale PDF-to-Markdown extraction and LLM-driven chunking economically viable, delivering roughly 6,000 pages per dollar with near-perfect OCR in internal testing. Its major remaining limitation is unreliable bounding-box localization for source citations.
Ingesting Millions of PDFs and why Gemini 2.0 Changes Everything
Author: Sergey Filimonov | Published: 2025-01-15 | Generated: 2025-02-06 | Domain: sergey.fyi
Tags: ‘#gemini’ ‘#pdf-parsing’ ‘#rag’ ‘#document-ai’ ‘#ocr’ ‘#chunking’
TLDR
Gemini 2.0 Flash substantially changes the economics of document ingestion: the author estimates about 6,000–6,379 PDF pages per dollar for PDF-to-Markdown, compared with roughly 1,000 for AWS Textract and 200 for GPT-4o. Internal tests show strong OCR and table-extraction performance, while enabling LLM-based semantic chunking for a 100M+-page corpus at an estimated $5,000. The key unsolved component is accurate text bounding boxes, which are necessary for precise, trustworthy citations back to a source PDF.
Key Takeaways
- Cost-effective PDF extraction: Gemini 2.0 Flash is estimated at approximately 6,000 pages per dollar for PDF-to-Markdown; Flash Lite is theoretically around 12,000 pages per dollar but was not tested. The author’s detailed estimate reaches 6,379 pages per dollar using $0.00009675 per input image and $0.0000525 per 400 output tokens.
- Competitive table parsing: On a subset of Reducto’s
rd-tablebench, Gemini 2.0 Flash scored 0.84 ± 0.16, matching Anthropic Sonnet and exceeding Gemini 1.5 Flash (0.77), GPT-4o (0.76), and GPT-4o-mini (0.67). Reducto led at 0.90 ± 0.10. - Errors are often structural, not factual: Review of Gemini’s lower-scoring table outputs found that most discrepancies were formatting or structural variations rather than misread numerical values, making many failures immaterial for downstream LLM understanding.
- LLM chunking becomes affordable at corpus scale: The author estimates parsing a 100M+-page corpus for $5,000 with Gemini 2.0 Flash, making semantic chunking alongside Markdown extraction practical for RAG pipelines.
- Citation grounding remains unresolved: Gemini’s bounding-box predictions for text locations in page images were “wildly inaccurate” despite varied prompts. Better document-layout training or fine-tuning could close this gap, but as of January 2025 it prevents reliable source-localized citations.
Images & Media
- Citation displayed in source-document context — Screenshot of the author’s application showing a citation within the original PDF context.
- Ground-truth table bounding boxes — Example showing three distinct bounding boxes around portions of a table.
- Reducto benchmark example — Failure-case comparison of HTML outputs from Gemini, Reducto, and the source PDF.
- Sergey Filimonov signature — Author-site signature graphic.
Referenced Links
- Gemini Flash 2.0 — Google DeepMind’s Gemini Flash model information.
- Vertex AI generative AI pricing — Pricing source used for Gemini pages-per-dollar estimates.
- Nougat — Meta’s neural optical understanding model for academic documents.
- NVIDIA nv-ingest — Open-source document ingestion toolkit cited as operationally complex.
- rd-tablebench — Benchmark used to assess table extraction against difficult real-world documents.
- Needleman–Wunsch algorithm — Sequence-alignment method used to measure benchmark accuracy.
- Evaluating chunking — Chroma research cited in support of LLM-based chunking for retrieval quality.
- Qdrant Cloud calculator — Vector database cost comparison for 100 million vectors.
- Gemini 2 spatial reasoning example — Simon Willison’s example of Gemini producing bounding boxes for a dense bird image.
- Vertex batch token pricing — Detailed pricing reference for the author’s Gemini 2.0 Flash calculation.