← All lessons
Working with financial documents · Lesson 4 of 7

Provenance and sources

Provenance is where a piece of data came from. In finance work it isn't optional: a reviewer, an auditor or a credit committee will ask "where does this number come from?", and the answer has to be a page and a passage, not "the model said so".

Store it for every extracted value: the document and its version, the page, the section, and the exact text the value came from, as a quote and, where you have them, its character offsets and bounding box on the page. A value then looks less like 425 and more like {value: 425, unit: "bps", page: 41, section: "2.08(a)", quote: "4.25% per annum for SOFR Loans"}.

Do the same for generated text. Each sentence of a summary or memo should list the passages it rests on. A number computed in code (a ratio, a total) gets the sources of its inputs and the formula, so someone can follow it all the way back.

Show it in the interface. Clicking a value or a sentence should open the document at the right page with the passage highlighted. That one feature does more for reviewers' speed and trust than almost anything else, and it's why the bounding boxes from the text step are worth keeping.

Then check that each citation holds up, because a model can cite a real page that doesn't say what it claims. Two checks catch most problems. First, mechanically: is the quote really on the cited page? Second, does it support the value or sentence? For numbers, the value should appear in the quote; for prose, a second model call or a person judges whether the passage backs the claim.

page_41 = "The Applicable Margin shall be 4.25% per annum for SOFR Loans and 3.25% per annum for Base Rate Loans."
claim = {"value": "4.25%", "page": 41, "quote": "4.25% per annum for SOFR Loans"}
print(claim["quote"] in page_41, claim["value"] in claim["quote"])
Prints
True True

Watch for a citation that's on topic but answers a different question. A memo that says "leverage is 4.2x" and cites the covenant "Total Leverage Ratio shall not exceed 4.50 to 1.00" is citing the limit, not the borrower's actual leverage. The quote exists; it just doesn't support the claim.

Practice

The extracted value is "Default rate: 2.00% above the normal rate". Tap the sentence that supports it.

Credit agreement, page 43
More info

Quick reference

ProvenanceWhere a value or sentence came from: document, version, page, span.
QuoteThe exact source text, stored with the value.
Offsets / bounding boxThe span's position in the text and on the page.
Presence checkIs the quote really on the cited page?
Support checkDoes the quote back the claim, not just mention the topic?
Derived valueCarries its inputs' sources and the formula.

The other AI and data engineering courses