KatInterview

Designing a Live Card-Payment Fraud Scoring Pipeline

Machine LearningModel answer
HardModel answerMachine Learningfraud-detectionimbalanced-datafeature-store

Last updated

Design an ML system that scores card payments inside the authorization path, handling extreme class imbalance, delayed labels, concept drift, and uneven costs of errors.

Context

A payments platform processes card transactions online. Each payment must be assessed for fraud while the customer waits, so the score has to be produced inside the authorization flow. Fraud is rare, fraudsters change tactics, and confirmed labels (such as chargebacks) can take weeks or months to arrive.

Task

Propose an end-to-end design for a system that flags fraudulent card transactions in real time. Your answer should cover:

  1. Requirements and success metrics: latency budget, throughput, class balance, and how you would define "good" when mistakes have unequal costs.
  2. Data sources and labels: what signals you would collect, where labels come from, and how you deal with label delay.
  3. Feature engineering: which kinds of features matter, and how you keep training data consistent with what was known at decision time.
  4. Modeling: which model families you would use, how you handle imbalance, and where unsupervised methods fit.
  5. Decisioning: how a score becomes an action (approve, extra authentication, review, decline) and how thresholds are chosen.
  6. Serving architecture: the online path, the offline path, and failure handling.
  7. Retraining and monitoring: cadence, feedback-loop bias, and how you detect drift.

State any assumptions (volumes, fraud rate, latency) explicitly and discuss the main trade-offs.

Hints

Hint 1

Begin with numbers: transactions per second, a rough fraud rate, and a latency budget for the whole scoring call. These drive nearly every later choice, including model size and feature lookups.

Hint 2

Frame the objective as total expected cost (fraud losses, wrongly blocked good customers, friction, reviewer time), not accuracy. Think about which metric stays meaningful at a very low positive rate, and how a score maps to several actions rather than one cutoff.

Hint 3

Consider what you can and cannot learn from the data: blocked payments never produce chargebacks, and labels arrive late. Think about logging the exact features served, holding out a small exploration slice, and watching both input distributions and delayed performance for drift.