~/projects

Real-Time Fraud Detection Pipeline

FEATURED

A streaming transaction-scoring system that flags fraudulent activity with sub-100ms inference latency at production scale.

PythonPyTorchKafkaRedisAWS SageMaker

The problem

Card-not-present fraud has to be caught before a transaction settles, which means a scoring model has a latency budget measured in milliseconds, not minutes. Most of the existing rule-based system was catching known fraud patterns but missing novel ones, and false positives were blocking a meaningful share of legitimate transactions.

What I built

A streaming pipeline that ingests transaction events off Kafka, enriches them with features pulled from a Redis-backed low-latency feature store, and scores them with a PyTorch model served through SageMaker endpoints. The whole path from event to decision runs in under 100ms at the 99th percentile.

Key design decisions:

  • Point-in-time correct features. Every feature is computed only from data that would have actually been available at transaction time, which sounds obvious but is where most fraud models quietly break in production.
  • Shadow deployment first. New model versions run in shadow mode against live traffic for two weeks before they’re allowed to make real decisions, so we catch distribution shift before it costs anyone money.
  • Human-in-the-loop for the gray zone. Scores in the ambiguous middle band route to a review queue instead of an automatic block/allow decision.

Impact

The system cut the false-positive rate by a third relative to the previous rules engine while catching a meaningfully higher share of confirmed fraud, and it’s held up under multiple Black Friday-scale traffic spikes without a latency regression.