DEV Community

KolmoPDF
KolmoPDF

Posted on

PDF table footnotes can silently attach to the wrong row in RAG

A PDF table can survive extraction with every number intact and still answer a question incorrectly. Consider two rows with the same measurement. Only the first has a superscript a, and the note says that its value was measured under a reduced load. If a pipeline attaches that note to every row, the second result acquires a condition the source never gave it.

The reverse error is just as easy: keep the number, drop the marker, and present a conditional result as unconditional. Both errors can survive a text-only check that confirms the table's values are present.

A small fixture for a large failure

Use a synthetic table with repeated values so a test cannot pass by matching the number alone:

System Throughput (MB/s)
A 95ᵃ
B 95

a: measured with reduced load.

A correct representation associates the note with A's measurement. B has no such qualifier in this fixture. A retrieval test should ask the same question for each system: "Under what conditions was its throughput measured?" For A, the retrieved context should contain the reduced-load note. For B, it should not imply that the note applies; the right answer can say that the fixture does not specify a condition for B.

The equal values are deliberate. If the pipeline finds 95 for both rows, a test that checks only the numeric answer will miss the scope error. Inspect the retrieved context and the answer separately: a generator can omit an available qualifier, while an extractor can lose it before retrieval ever starts.

Keep links before making chunks

Treat a marker as a relationship with an explicit target. A practical intermediate record might look like this:

{
  "table_id": "p4-t1",
  "cells": [
    {"id": "a-throughput", "row": "A", "column": "Throughput (MB/s)", "value": "95", "markers": ["a"]},
    {"id": "b-throughput", "row": "B", "column": "Throughput (MB/s)", "value": "95", "markers": []}
  ],
  "notes": [{"id": "note-a", "marker": "a", "text": "measured with reduced load"}],
  "note_links": [{"note_id": "note-a", "target_cell_id": "a-throughput"}]
}
Enter fullscreen mode Exit fullscreen mode

This is a proposed intermediate format, not a claim about the output of a particular parser. A real document may use a marker on a row label, column heading, or table title. Store the intended scope at the appropriate level, with the source page and location when available. A note applying to a whole table should be represented as a table-level relationship rather than copied into each cell as though it were a cell-specific annotation.

For row-based retrieval, include the applicable note in the chunk containing A's measurement. Keep the note's identifier or source reference too, so an audit can trace the added context back to the PDF. B's chunk should have its header, row label, value, and citation, but should not acquire note a from A's cell.

The marker a alone is not a global identifier. Another table can reuse it for a different note. Resolve markers within their table and document context, and keep the document version in the source reference. A page number is useful for locating the evidence, but it is not enough to identify which cell a note qualifies.

Handle uncertain associations explicitly

Extractors can confuse a superscript with a regular character, and a note may continue onto the next page. If you cannot resolve the target with confidence, keep the marker and its candidate note in a review queue. Avoid silently attaching the note to every row. Also avoid deleting the unresolved marker, because that removes evidence that the value might carry a qualification.

Review needs the rendered page as well as extracted text. Check where the marker appears, where the note starts, and whether a heading or border indicates a broader scope. When a table spans pages, inspect the continuation before assuming the note belongs to the nearest visible row.

Test extraction and retrieval separately

For the fixture above, assert that the intermediate graph has one note-a link to a-throughput and none to b-throughput. Then index the row chunks and run both questions. Record the retrieved chunk IDs, the note links included in each chunk, and the final answer. Add a second fixture with a table-wide note to check that legitimate broad scope survives.

A useful production sample includes unmarked rows, repeated marker letters in separate tables, and at least one note that crosses a page boundary. Label the intended scope from the rendered source before comparing parser versions. That gives a reviewer a way to distinguish a missing note from an over-broad one, without relying on a plausible-looking answer.

For a related audit of headers and units, see A PDF table can keep every number and still break retrieval.

Top comments (0)