Keep a retrieved table header with its rows

Look one word ahead when copying titles and labels. · 215 words

Retrieval can split a table so a row arrives without the header naming its columns. For example, a museum volunteer schedule may return Saturday | 10:00 | 12, while Shift | Start | End appears in an earlier chunk. Prompt: 'Reproduce the full header for every row, label the table and row, and give the document title, table number, page or chunk ID, and retrieval ID. Do not guess a missing header.' This keeps the source trail visible. Check the result against the source: every row must have a header in the same column order, each value must sit under the correct label, and the output must contain exactly as many data rows as the source table.

Try a second case with an online bookstore's stock table. One chunk says Paperbacks | 14 | $12 and Novels | 9 | $18, while another holds Format | Copies | Price. Both are marked table B7. Ask the model to join a row and header only when they share a table ID, then report the source page for each part. If the IDs differ, mark the header as missing instead of combining nearby tables. For the matching B7 chunks, the resulting table has three correctly ordered columns, six values under the right labels, and no invented heading.

Check your recall

In the bookstore example, what should the model do if the row and header have different table IDs?

Check your answer

It should mark the header as missing rather than combine unrelated tables. The check is that a mismatched header is flagged, and every successfully joined row preserves the original column order and source location.

Sources and credits

Original KeyTouch lesson. Background reading · DAIR.AI · Retrieval Augmented Generation.