Skip to content
CASE STUDY INTRO

Fraudix

A high-throughput machine learning anomaly detection pipeline for identifying financial fraud in highly imbalanced datasets.

INITIALIZING CASE STUDY ENVIRONMENT...
0%
Production ARCHITECTURE
6 CORE MODULES
ProductionPythonMLProduction

Fraudix

A high-throughput machine learning anomaly detection pipeline for identifying financial fraud in highly imbalanced datasets.

Duration
2 Months
Team Size
Solo Developer
Role
ML & Backend Developer
fraudix.app / product_demo
60 FPS
ONNX INFERENCE STREAM
SUB-3MS LATENCY
TX #894021 - $14,250.00RISK: 0.012 (LOW)
ANOMALY DETECTED (SMOTE)2.4ms INFERENCE
STATUS: NOMINAL TRANSACTION STREAM
99.4% PR-AUC
1. UPLOAD
Section 01

Project Overview

The Problem Statement

Financial institutions lose billions annually to fraudulent payment transactions. Detecting fraud in real time is exceptionally difficult due to extreme class imbalance: legitimate transactions account for 99.8% of volume while fraudulent activities represent less than 0.2%. Standard accuracy metrics are dangerously misleading in this context.

Engineering Motivation

To build an end-to-end machine learning pipeline that establishes explainable baselines, optimizes Precision-Recall curves over raw accuracy, and packages models into ultra-low-latency ONNX microservices for live payment gate integration.

Core Engineering Goals

  • Achieve >0.92 Precision-Recall AUC on highly imbalanced financial transaction test benchmarks.
  • Deliver sub-5ms model inference latency per transaction to support real-time payment processing.
  • Ensure model explainability using SHAP feature importance analysis for audit compliance.

Target Audience

Fintech risk teams, payment processing engineering teams, and machine learning engineers looking for production-ready anomaly detection architectures.

Solution Approach: Fraudix is a complete ML engineering ecosystem. It ingests imbalanced transaction streams, applies PCA feature transformation and SMOTE synthetic oversampling, trains XGBoost/Random Forest ensembles, and converts trained model artifacts into high-throughput ONNX microservices evaluated via FastAPI and WebSocket alert pipelines.
Section 02

Key Capabilities & Features

Core technical features designed to fulfill project requirements with high reliability and performance.

SMOTE Oversampling

Imbalanced Data Engine

Combines SMOTE oversampling and adaptive class weighting to prevent models from defaulting to naive majority-class predictions.

Sub-3ms Prediction

ONNX Low-Latency Inference

Exports trained Scikit-Learn and XGBoost models to ONNX runtime format, cutting prediction latency down to sub-3ms.

Real-Time Alerts

Live Fraud Stream Dashboard

Pushes real-time transaction risk score alerts to an administrator dashboard via WebSocket streaming whenever risk exceeds 0.85.

Section 03

Interactive Architecture Explorer

Hover or click on any system layer to inspect data flow topologies, connection pipelines, and security specifications.

SYSTEM BOUNDARY MAP6 CONNECTED MICROSERVICES
Hover nodes to trace data flow pipelines
FrontendID: frontend
ONLINE

Frontend Client Layer

Single-page responsive web client serving UI components, handling optimistic state updates, and streaming live server notifications.

Stack & Frameworks
React 19Tailwind CSSTanStack Query
PROTOCOLHTTPS / WSS (WebSockets)
LATENCY BENCHMARK< 16ms render
THROUGHPUT60 FPS UI
SECURITY PROTOCOLCSP & Strict SameSite Cookies
Section 04

Technology Stack

Purposeful framework selection and technical rationale behind core architecture dependencies.

AI & ML

  • Scikit-Learn & XGBoost

    Classical ensemble models offering high accuracy with low computational overhead.

  • ONNX Runtime

    C++ optimized cross-platform execution engine delivering sub-3ms inference.

  • SMOTE (Imbalanced-Learn)

    Synthesizes minority class fraud samples to balance training distributions.

Backend

  • Python 3.12 & FastAPI

    Asynchronous Python web framework ideal for serving ML model endpoints.

  • Uvicorn ASGI

    High-performance async server handling thousands of concurrent requests.

Database

  • TimescaleDB

    Time-series optimized PostgreSQL extension for transaction audit logs.

  • Redis

    In-memory caching of velocity features (e.g. 10-minute transaction counts).

DevOps

  • Docker & Kubernetes

    Containerized deployment with horizontal pod autoscaling under peak loads.

Key Architectural Trade-Off Rationale

Precision-Recall Optimization over Raw Accuracy

Abandoned simple accuracy metrics (which falsely score 99.8% on zero-prediction models) in favor of PR-AUC and F1 optimization.

ONNX Runtime Conversion

Converted Python joblib models to ONNX format, reducing prediction latency from 18ms to 2.4ms per payload.

Classical Ensembles over Deep Learning

Selected XGBoost and Random Forests for their explainability (SHAP values) and lower inference cost.

Section 05

Development Journey

Systematic engineering progression from initial domain research to production deployment.

Phase 1: Research1.5 Weeks

Exploratory Data Analysis & Anomaly Benchmarking

Analyzed 284,000 credit card transaction records, mapped PCA features, and evaluated baseline models.

Deliverable: Exploratory analysis notebook & PR-AUC baseline
Phase 2: Planning1 Week

Pipeline & ONNX Architecture Design

Architected SMOTE oversampling pipeline, ONNX runtime conversion specs, and FastAPI service endpoints.

Deliverable: Pipeline design RFC & API schema
Phase 3: Development3 Weeks

Model Training & FastAPI Service Implementation

Tuned XGBoost hyper-parameters, exported ONNX models, and built the FastAPI inference server with Redis velocity caching.

Deliverable: Production ONNX microservice
Phase 4: Testing1 Week

Latency & Adversarial Robustness Testing

Benchmarked inference speeds under load and tested model resilience against adversarial fraud distribution shifts.

Deliverable: Model benchmark & latency audit report
Phase 5: Deployment4 Days

Docker Containerization & Kubernetes Deploy

Packaged FastAPI ONNX microservices into Docker containers deployed to GKE with Prometheus monitoring.

Deliverable: Live containerized ML microservice
Section 06

Challenges & Solutions

Deep-dive into non-trivial engineering obstacles, root causes, and verifiable technical outcomes.

Problem Context:

Naive SMOTE oversampling caused models to memorize synthetic noise and generate false alarms.

Why it was difficult:

Synthesizing samples without boundary filtering created overlapping decision boundaries between classes.

Engineering Solution:

Applied Borderline-SMOTE combined with Tomek Links cleaning to prune ambiguous synthetic boundary samples.

Quantifiable Outcome:Increased validation PR-AUC by 18% while lowering false positive rate by 32%.
Section 07

Performance & Results

Empirical measurements, benchmark results, and production optimization techniques.

-86%
2.4 ms
Inference Latency
ONNX runtime execution speed
+18%
0.941
PR-AUC Score
Precision-Recall Area Under Curve
94.8% Recall
94.8%
Fraud Detection
Recall rate on fraudulent transactions
Sub-0.1%
0.08%
False Alarm Rate
Legitimate transactions flagged
Google Lighthouse Audit Ratings
97/100
performance
100/100
accessibility
100/100
best Practices
100/100
seo

Applied Performance Optimization Techniques

  • ONNX runtime C++ graph optimization and memory arena allocation.
  • Redis in-memory caching of rolling 10-minute customer velocity aggregates.
  • Asynchronous Uvicorn ASGI request routing with worker thread pooling.
Section 08

Lessons Learned

Key engineering insights, architectural reflection, and takeaways for future systems design.

In fraud detection, optimizing for Precision-Recall AUC is vastly superior to raw accuracy or ROC curves.

Model compilation formats like ONNX can reduce inference latency by an order of magnitude without losing model fidelity.

Section 09

Future Roadmap

Planned technical enhancements, new feature modules, and architectural extensions.

01Planned

Real-Time Graph Neural Network (GNN)

Incorporate graph relationships between cards, IPs, and merchants to identify coordinated fraud rings.

02In Progress

Automated Drift Detection & Retraining

Build continuous evaluation pipelines with Evidently AI to trigger retrains when data distributions drift.

03Planned

Streaming Kafka Pipeline Integration

Upgrade event ingestion from REST to Apache Kafka for multi-million event throughput.