📝 Problem Description
Design a real-time fraud detection system for financial transactions. Detect fraudulent payments, account takeovers, and suspicious patterns. Balance fraud prevention with customer friction.
👤 Use Cases
1.
User wants to makes payment so that transaction scored in real-time
2.
System wants to detects high-risk so that blocks or challenges transaction
3.
Analyst wants to reviews flagged cases so that confirms or clears fraud
4.
ML wants to learns from feedback so that model improves
✅ Functional Requirements
- •Score transactions in real-time
- •Block high-risk transactions
- •Challenge suspicious activity (2FA)
- •Pattern detection across accounts
- •Case management for review
- •Feedback loop for model training
⚡ Non-Functional Requirements
- •Scoring latency < 100ms
- •False positive rate < 1%
- •Fraud detection rate > 95%
- •Handle 10K transactions/sec
⚠️ Constraints & Assumptions
- •Cannot block legitimate users
- •Must comply with regulations
- •Adversarial actors adapt quickly
📊 Capacity Estimation
👥 Users
100M users, 1B transactions/month
💾 Storage
100TB (transaction history, features)
⚡ QPS
Scoring: 10K/sec, Feature lookup: 100K/sec
📐 Assumptions
- • 1B transactions per month (~400/sec average, 10K/sec peak)
- • 0.1% fraud rate = 1M fraudulent transactions/month
- • 100+ features per transaction for ML model
- • Model inference latency < 50ms p99
- • 1% flagged for review = 10M reviews/month
- • False positive rate < 0.5% target
💡 Key Concepts
CRITICAL
Real-time Features
Compute features from user history (velocity, device, location) at scoring time.
CRITICAL
ML + Rules
ML model scores risk; rules handle known patterns and compliance.
HIGH
Velocity Checks
Track transaction counts/amounts over time windows.
HIGH
Device Fingerprinting
Identify devices to detect account takeover.
💡 Interview Tips
- 💡Start with the precision/recall tradeoff
- 💡Discuss the tiered approach: rules, ML, manual review
- 💡Emphasize real-time requirements and latency constraints
- 💡Be prepared to discuss feature engineering
- 💡Know the difference between fraud types (payment, identity, account)
- 💡Understand the business impact of false positives