MLCrack

    ML SYSTEM DESIGN (DEEP DIVES) · INTERVIEW QUESTION

    Design a real-time payment fraud detection system (10k+ TPS, 100ms decision budget, delayed labels).

    🔴 advanced · Real-time Systems

    Hint: Streaming features, severe class imbalance, asymmetric costs, adversarial drift, calibration for downstream rules.

    Answer

    1. Problem Formulation

    The business asks: "stop fraudulent card-not-present payments before authorization". Translate carefully.

    Clarifying questions:

    • Scale? ~10k transactions/sec peak, ~50k tps on Black Friday. Latency budget for the decision: 100 ms (the issuer waits before authorizing).
    • Definition of fraud? Confirmed chargebacks 60–90 days after the transaction. Most "suspicious" transactions aren't labeled until weeks later.
    • Cost asymmetry? A false negative (missed fraud) costs the full transaction amount + ops. A false positive (declined legit txn) costs goodwill and ~$50 in support but is recoverable. Asymmetry is roughly 50:1 — that drives the loss function.
    • Constraints? Adversarial — fraudsters adapt within days. Regulatory: explainability for declines (GDPR right-to-explanation, US fair-lending). PCI-DSS isolation of card data.

    Why ML? Rules catch obvious patterns (mismatched country, velocity) but miss novel attacks. ML catches the long tail and adapts faster than humans can write rules. But we keep rules in addition — they're our circuit breaker.

    ML framing: binary classification with delayed labels and severe class imbalance (~0.1% positive). Online prediction. Multi-task aside: also predict reason codes for the decline-explanation requirement.

    This is the opening of a longer walkthrough. Read the full answer in the topic explorer, free.

    Likely follow-up: How do you keep up with adversarial drift when labels arrive 60 days late?