← All lessons
Working with financial documents · Lesson 1 of 8

Before you start

This course sits where lending meets AI engineering, so it uses words from both. You don't need either background: here's what the later lessons take for granted.

Loans. A lender lends a borrower an amount (the principal or commitment) until a maturity date, and charges interest. Business loans usually float: the rate is a benchmark that moves with the market, such as SOFR (the Secured Overnight Financing Rate, a US base rate), plus a fixed margin. Margins are quoted in basis points: one basis point (bp) is 0.01%, so 425 bps is 4.25%. A secured loan has a lien, a legal claim on assets the lender can take if it isn't repaid; first lien is paid back first.

Covenants are promises in the loan agreement, often tests the borrower must keep passing, like "debt no more than 4.5 times earnings". Breaking one, or missing a payment, is an event of default, which lets the lender demand its money back. An amendment is a later document that changes the agreement.

The numbers. EBITDA is a company's earnings before interest, taxes, depreciation and amortization: roughly the cash its business throws off before paying lenders and taxes. Leverage is debt ÷ EBITDA, written like 4.2x. For property, NOI (net operating income) is rent and other income minus running costs. DSCR (debt service coverage ratio) is NOI ÷ the year's loan payments, so 1.31x means income covers payments 1.31 times. LTV (loan to value) is the loan as a share of the property's value.

noi = 1_300_000
payments = 1_000_000
print(round(noi / payments, 2), "x DSCR")
print(425 / 100, "% margin")
Prints
1.3 x DSCR
4.25 % margin

AI. A model (an LLM) reads a prompt and writes text back; text is counted in tokens, and the context window is the most one request can hold. Asking for JSON, plain-text data like {"margin_bps": 425}, in an agreed shape (a schema) lets code check the answer. RAG (retrieval-augmented generation) finds the passages that answer a question, using embeddings (number lists that capture meaning) and keyword search, and puts them in the prompt. An eval is a set of test documents with known right answers, rerun after every change.

Python. The examples are short and only need reading (Programming basics covers the language). Two tools may be new: re, Python's regular expressions, finds text by pattern (\d means any digit, + means one or more), and datetime.date handles dates, so subtracting two gives the days between them.

Practice

A margin is quoted as 350 basis points. What is it as a percentage? (Just the number.)

More info

Quick reference

SOFR + marginA floating rate: a market benchmark plus a fixed add-on.
Basis point (bp)0.01%: 425 bps is 4.25%.
Lien, first lienA claim on assets if the loan isn't paid; paid back first.
Covenant, event of defaultA promise or test in the loan; breaking the deal's terms.
EBITDA, leverageEarnings before interest, tax and non-cash charges; debt ÷ EBITDA.
NOI, DSCR, LTVProperty income less costs; NOI ÷ payments; loan ÷ value.
LLM, JSON, schema, RAG, evalThe model; text data; its shape; fetch the right passages; a test set.
re, dateFind text by pattern; work with dates.

The other AI and data engineering courses