LLM engineering · Python

Slotfill

Turning a scanned receipt into a record means filling four slots (shop, address, date, total) with values that pass a strict schema: a real calendar date, a positive amount with two decimals. Here hand-written rules and a small trained extractor over OCR lines, with their positions on the page, are compared on 200 held-out receipts, against the ceiling of what the OCR text allows.

Field by field

Share of the 200 held-out receipts where the extracted value matches the label (case, spacing and punctuation aside; dates and totals compared as values). The dashed line is the OCR ceiling: how often any run of OCR lines matches the label exactly.

More training receipts

The trained extractor with 100, 200 and all 426 training receipts.

Speed and cost

p95 latency per receipt and compute cost per 1,000 on one CPU core, OCR aside.

Try the parsers

The schema's date and amount parsers, the same rules as slotfill/schema.py, running in your browser. Type a line the way a receipt prints it.