New Tool Radar

AI Concepts

How to Check That Every RAG Chunk Carries Source Metadata

Audit your RAG index for chunks that lost their source, title or page, so every answer can be traced back to a document.

Schematic illustration with three step boxes: list the required fields, sample the index, and fix the gaps.

A chunk without source metadata cannot be cited, traced or updated: when the source document changes, you cannot find the chunks that came from it. The audit is simple: decide which fields every chunk must carry, sample the index, and count the gaps before you trust the citations your system produces.

Before you start

Read access to your vector index or chunk store, and a list of the source documents it was built from.

List the fields every chunk must carry

Require at least four fields: source document name, document title, section or page, and the date the document was indexed. Add a document version or URL when the source lives online.

Write the list down and pin it in the indexing code. A field that is optional in code will be missing in the index.

Sample the index and count the gaps

Pull 50 chunks at random and check each one for the four fields. Record how many are missing each field, and whether the gaps cluster in one document type, such as scanned PDFs or pasted text.

Check the values, not just the presence: a source field that says unknown is as useless as a missing one.

Fix the gaps at the indexer, not by hand

Fix the indexer so new chunks carry the fields, then re-index the documents that produced the gaps. Editing metadata on live chunks by hand leaves the next re-index just as broken.

Re-run the 50-chunk sample after the fix and record the new gap counts.

Practice check: fictional Maple Corner index, 50 sampled chunks

The table below is fictional practice material, worked out by hand from the stated sample. It is the expected result for the practice audit, not a run of any index.

Field Present in sample Missing Worst source
Source document name 48 of 50 2 Pasted text
Document title 47 of 50 3 Scanned PDF
Section or page 41 of 50 9 Scanned PDF
Indexed date 50 of 50 0 None

Section or page is the weakest field at 41 of 50, and the gaps cluster in scanned PDFs. The fix belongs in the PDF indexer, not in the other document types.

Expected result. UNTESTED: the counts in the practice table are worked out by hand, not measured by running an index audit. Pull 50 chunks at random from your own index, check the four fields, and count the gaps per field.

Limits

  • Metadata does not prove the chunk text is correct: a chunk can carry perfect metadata and still contain a misread table.
  • Re-indexing fixes the index, not the answers already given from the broken chunks.

Sources

See all