Skip to content

Claude skips table rows in long PDFs. How to find which page lost them

Claude does not misread long tables. It stops early. On six long financial reports (LongExtract), ReadAnyDoc with Claude Haiku returned 56.4% of the table rows and Reducto's extraction 9.1% (our run, the benchmark's own grader). Neither is 100%. On long tables the problem is not reading the rows, it is knowing which ones never came back.

This page is for teams already running their own Claude pipeline. You do not need a new model. You need a check that tells you which page lost rows, and a way to read long tables in parts.

Why rows go missing

  • One answer, too many rows. A 40-page table does not fit in one reply. The model ends the list where the answer runs out, and the JSON is still valid.
  • Page breaks. Rows on a page that continues a table without its header get skipped or merged into the row above.
  • Nothing complains. You get, say, 212 rows instead of 480, every one of them correct. Accuracy checks on the values you got will pass.

1. Ask for the page of every row

Add a page field to each row in your schema. It costs nothing and makes every check below possible.

from pydantic import BaseModel

class Row(BaseModel):
    page: int          # page the row is printed on, from 1
    label: str
    value: float

class Table(BaseModel):
    rows: list[Row]

2. Count the rows each page prints, and compare

For PDFs with a text layer, count the lines on each page that look like table rows (two or more numbers on one line) and compare with what the model returned for that page:

import re
from collections import Counter, defaultdict
import pymupdf  # pip install pymupdf

NUMBER = re.compile(r"^\(?-?\$?\d[\d,]*(\.\d+)?\)?%?$")

def rows_on_pages(pdf_path, min_numbers=2):
    """How many lines on each page (from 1) look like table rows: two or more numbers on one line."""
    counts = {}
    for page in pymupdf.open(pdf_path):
        lines = defaultdict(int)
        for x0, y0, x1, y1, word, *_ in page.get_text("words"):
            if NUMBER.match(word):
                lines[round((y0 + y1) / 2 / 3)] += 1    # words within ~3 points share a line
        counts[page.number + 1] = sum(1 for n in lines.values() if n >= min_numbers)
    return counts

def missing_rows(pdf_path, rows, slack=0.9):
    """Pages where the model returned fewer rows than the page prints. rows: dicts with a 'page' key."""
    printed = rows_on_pages(pdf_path)
    returned = Counter(r["page"] for r in rows)
    return {p: (returned.get(p, 0), n) for p, n in printed.items()
            if n and returned.get(p, 0) < n * slack}

On a three-page test report with 30 rows a page, where the model returned all rows for pages 1 and 2 but only 12 for page 3:

missing_rows("report.pdf", table["rows"])
# {3: (12, 30)}   -> page 3: 12 rows returned, 30 printed. Read page 3 again.

It is a count, not a match: it tells you where to look, not which rows. Lines of numbers outside the table (a footer with a date and a page number) inflate the printed count, which is why slack is there. Scans have no text layer; on those, count rows on the page image with a layout model, or use the next step.

3. Read long tables in parts

Send a few pages per call and join the lists, then run the check on the joined list and re-read only the pages it names. With the Anthropic SDK this is a loop over page ranges; keep the header row in every prompt so continuation pages are read as the same table.

ReadAnyDoc (open source, Apache-2.0) does this for you, with the same Claude key you already use:

pip install "readanydoc[engine]"
export ANTHROPIC_API_KEY=...
import readanydoc

out = readanydoc.extract("report.pdf", schema=Table, array_extract=True)
print(len(out.data.rows), "rows")
print(out.warnings)   # e.g. a part that returned fewer rows than its parsed tables hold
print(out.citations["rows[0].value"])   # the words and the box on the page

array_extract=True splits the document into parts, compares each part's rows with the row count of the parsed tables, and reads a short part again.

The same model, measured with and without the engine

Plain Claude Haiku ReadAnyDoc (Haiku + engine) Reducto
olmOCR-bench, 1,403 pages 82.2 85.4 80.9
Long reports, table rows found (LongExtract, 6) not run 56.4% 9.1%
Price per page $0.001-0.002 $0.003-0.005 $0.010

All measured by us; details in benchmarks.

Where this loses

  • Slow. ReadAnyDoc takes about 20 to 50 seconds a page; Reducto takes about 4 (our run). Long reports are a background job.
  • Still not every row. 56.4% on long reports means rows are still missed. Keep the check in step 2 whatever you use.
  • Tables: on olmOCR-bench's table tests Reducto scores 92.7 and ReadAnyDoc 89.8.

Questions

Will a bigger model fix it? Not by itself: a reply still has a maximum length, whichever model writes it. Reading in parts is the fix.

How do I know which values are wrong, not just missing? Different check: is the number printed on the page, does the arithmetic hold. See check extracted numbers before you save them and a confidence score for every field.

Does this work with Sonnet or another model? The check in step 2 works with any model. ReadAnyDoc was measured with Claude Haiku 5.5 (Sonnet 5.5 on handwriting).