Back to course overview
Module 2Document intelligence 18 min

Lab: The AP document pipeline

Run three Alder carrier invoices through the full pattern — extract with the contract prompt, compute independently, match against PO and rate card, and catch the two planted problems.

Lab time. Below are three carrier invoices (as text — extraction from PDFs works the same, the reasoning is what's being trained), a PO excerpt, and a rate-card line from the carrier's contract. Run the full pipeline by hand with your AI assistant: extract → compute → match → route. Two of the three invoices have problems. Work like Priya's team will: the AI reads, the spreadsheet verifies, the log records.

invoice A — clean-ishtext
RIVERBEND CARRIERS LLC          INVOICE
Invoice #: RB-8841        Date: 2026-06-12      Terms: Net 30
PO Ref: ALD-PO-3302
Lane: Portland OR -> Boise ID (430 mi)
  Line haul  430 mi @ $2.10/mi ............ $903.00
  Fuel surcharge (DOE index wk 24, 18%) ... $162.54
  Detention 3 hrs (1 billable after 2 free) @ $65/hr  $65.00
Subtotal ................................. $1,130.54
Total Due ................................ $1,130.54
invoice B — the scan from helltext
R1VERBEND CARR1ERS          1NVOICE
inv RB-8853   date 06/19/26   net30
po: ALD 3302? (handwritten: '3312')
ptld -> boise 430mi
linehaul 430 @ 2.45 .... 1053.50
FSC 18pct ... 189.63
detent 2hr@65 .. 130
lumper fee .. 75
TOT .... 1448.13
invoice C — looks familiartext
RIVERBEND CARRIERS LLC          INVOICE
Invoice #: RB-8841-R      Date: 2026-06-20      Terms: Net 30
PO Ref: ALD-PO-3302
RE: resubmission - please disregard if previously received
Lane: Portland OR -> Boise ID (430 mi)
  Line haul  430 mi @ $2.10/mi ............ $903.00
  Fuel surcharge (DOE index wk 24, 18%) ... $162.54
  Detention 3 hrs (1 billable after 2 free) @ $65/hr  $65.00
Subtotal ................................. $1,130.54
Total Due ................................ $1,130.54
reference data — PO + rate cardtext
PO ALD-PO-3302: Riverbend, PDX->BOI, June 2026, budget 2 loads,
  contracted lane rate applies, detention as incurred, no other
  accessorials authorized without pre-approval.
PO ALD-PO-3312: does not exist.
RATE CARD (contract ALD-RC-2025-11, clause 3.1, p.4):
  PDX->BOI: $2.10/mi. FSC: DOE index weekly, per formula annex B.
  Detention $65/hr after 2 free hrs. Lumper: pre-approval required.
  1. 1Extract all three with the contract prompt. Invoice B should come back wearing its problems honestly: CONFLICT on the PO reference, and note whether your assistant flagged the vendor-name OCR garbage or silently normalized it (silent normalization is worth catching — you want to know it corrected '1NVOICE').
  2. 2Compute independently in your spreadsheet: line sums vs. stated totals for all three (A and C: clean; B's lines sum to $1,448.13 — the total is honest, the charges aren't). Then the rate audit — four disputed components: B bills $2.45/mi against a contracted $2.10 (+$150.50 on 430 mi); the 18% fuel surcharge rides that inflated line haul ($189.63 billed vs. $162.54 on the correct rate, +$27.09 — it over-bills too and only resolves when the rate is corrected); detention charged from hour zero against '2 free hrs' ($130 dispute); and an unauthorized lumper fee ($75). One messy scan, $382.59 of overbilling — ~26% of the invoice (382.59 / 1,448.13 = 26.4%). This is why the rate audit was Priya's fastest-payback row.
  3. 3Run duplicate detection on C: same vendor, same amount, same PO, invoice number RB-8841-R vs RB-8841, eight days later, with a 'resubmission' note. Exact-match on invoice number misses it; vendor+amount+date-window with fuzzy invoice-number catches it. Route: hold, confirm against payment history, close as duplicate — politely, because the vendor's re-send was probably innocent. Log the disposition.
  4. 4Route everything and write the log: A → clean match, payment queue (note: human release still required — say at what threshold you'd set auto-release, and defend it). B → exception lane with the four deltas quantified for the AP specialist's vendor call. C → duplicate-hold. Your log per invoice: input doc, extraction output, checks run, result, route, reviewer, date. That's the audit trail — notice it cost you two columns.
  5. 5The design question to close: invoice B's PO conflict ('3302' printed, '3312' handwritten, 3312 nonexistent) — should the pipeline try to resolve it (nearest-valid-PO guessing) or refuse? Write your answer and why. (Hint: what would a guessing pipeline have done with the rate overbilling on the same document?)
Problem set 2

Six more documents: a contract amendment that changes the rate card mid-quarter (does your reference sheet version it?), an invoice against the amended rate, two near-duplicate expense receipts, a statement-vs-ledger reconciliation with a planted double-posted batch, and a vendor invoice whose 'please remit to new account' line should trip every alarm you have (that one's a fraud pattern, and Module 4 gives it a name).