Design Automatic Matching of Receipts to Card Transactions

Last updated: November 29, 2026

Quick Overview

Design an ML system that takes receipts employees upload, forward by email or text, or that arrive from integrations, extracts merchant, amount, date and currency, and matches each receipt to the right card transaction (or leaves it unmatched) with high precision across millions of transactions a day.

Brex
ML System Design
Machine Learning Engineer
Brex
November 29, 2026
Machine Learning Engineer
System Design Round
ML System Design
Hard

0

0

0 solved


Design an ML system that takes receipts employees upload, forward by email or text, or that arrive from integrations, extracts merchant, amount, date and currency, and matches each receipt to the right card transaction (or leaves it unmatched) with high precision across millions of transactions a day.

Receipt capture and auto-matching is central to Brex expense management: every missing receipt is a nag to an employee and a gap for the controller at month end. The interviewer checks whether you frame it as candidate generation plus ranking, respect that a wrong match is worse than no match, and handle the messy facts of card data such as tips, FX and merchant descriptors.

What the Interviewer Expects
  • Splits the problem into document extraction, candidate retrieval, and pairwise match scoring
  • Uses card data quirks: settled amount vs receipt total, tips, FX, descriptor strings that differ from merchant names
  • Optimizes for precision on auto-attach with a confidence threshold and human review below it
  • Describes labels from user confirmations and corrections, and how to avoid feedback bias
  • Covers latency (match within seconds of upload) and a re-match path when the transaction posts later
Key Topics to Cover
document AI and OCR
candidate generation and ranking
precision vs recall thresholds
entity resolution
feedback loops
How to Approach This
  1. Start by mapping the business objective to a concrete ML objective and metric.
  2. Cover the full pipeline: data collection, feature engineering, model selection, training, serving.
  3. Discuss online vs offline evaluation. Plan an A/B test to validate real-world impact.
  4. Address the serving latency budget and whether batch or real-time inference is needed.
  5. Think about the data flywheel: how user feedback improves the model over time.
Possible Follow-up Questions
  • One hotel receipt covers three card charges. How does the design handle one to many matches?
  • How would you measure the system offline and online, and which metric gates a model launch?
  • A customer in Brazil uploads receipts in Portuguese with comma decimals. What breaks?
  • How would you use an LLM here, and where would you not trust it?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice ML System Design Problems
Sample Answer
Requirements
  • Inputs: receipt images and PDFs from mobile upload, email forwarding, SMS, and integrations (travel, ride share).
  • Output: link to one transaction (or several), or "unmatched" with suggestions.
  • A...
High-Level Design
  1. Ingest: store the file, dedupe by perceptual hash, emit an event.
  2. Extract: OCR plus a layout-aware extraction model (or an LLM with a strict schema) produces merchant, total, subtotal, t...

Submit Your Answer
Markdown supported

Related Questions