High-throughput, low-latency streaming fraud detection pipeline designed to score 1.2M+ daily transactions at <180ms p95 latency. Combines primary gradient-boosted trees with a secondary ensemble classifier, real-time feature store, automated PSI feature-drift monitoring, and canary deployment with automated rollback.
π Live Interactive Demo on Hugging Face Spaces
- Streaming Inference & Low Latency: Scores 1.2M+ transactions/day at <180ms p95 latency (slashing inference latency from 2.1s down to <180ms, ~92% reduction) while cutting per-transaction compute cost by 64%.
- False Positive Reduction: Slashed False Positive Rate from 14.0% down to 3.5% while raising fraud catch-rate (recall) by +22% by layering a secondary ensemble model behind the primary classifier.
- False Decline Reduction: Reduced false-decline rate on legitimate transactions by 9%, validated against a 50,000+-case labeled adjudication dataset.
- Automated Drift & Weekly Retraining: Reduced model-drift incidents by 80% using automated Population Stability Index (PSI) monitoring that triggers weekly retraining pipelines.
- Canary & Auto-Rollback Framework: Cut production incident Mean Time To Recovery (MTTR) from ~50m to ~8m (~84%) with instant (<5 min) automated rollback.
- Self-Serve Feature Store: Reduced data scientist onboarding time from 3 weeks to 5 days with an online/offline feature store & self-serve registry.
[ Streaming Transactions ]
β
βΌ
[ Self-Serve Online Feature Store ]
(Sub-5ms Entity Velocity & Risk Lookups)
β
βΌ
[ High-Speed Primary Classifier ]
(LightGBM / XGBoost Model Score)
β
βββββββββββββββββ΄ββββββββββββββββ
β Score in [0.45, 0.80] Band? β
βββββββββββββββββ¬ββββββββββββββββ
YES β β NO
βΌ βΌ
[ Layered Secondary Ensemble ] [ Fast Track ]
(RF + ExtraTrees Adjudication) (Direct Decision)
β β
ββββββ¬βββββ
βΌ
[ Decision: APPROVE / DECLINE ]
β
ββββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββ
βΌ βΌ
[ PSI Feature Drift Monitor ] [ Canary Deployment ]
(Triggers Auto-Retraining) (Automated Rollback)
Instead of relying on a single classifier, RTFSP employs a two-tier decision funnel:
- Primary Model: High-speed LightGBM model evaluating basic transaction features under 10ms.
- Secondary Ensemble Model: Triggered only for ambiguous transactions (scores between 0.45 and 0.80). Uses deeper feature interactions to eliminate false alarms.
- Online Tier: Sub-5ms key-value lookup for sliding-window features (
txn_count_1h,txn_count_24h,avg_amount_24h,amount_to_avg_ratio,device_risk_score). - Feature Registry: Schema definition CLI & metadata browser.
Tracks feature distribution shifts against training baselines in real-time. Automatically triggers retraining pipelines when PSI exceeds 0.25.
Routes 10% of live traffic to canary candidates while tracking error rates. If canary errors exceed 2.0%, the canary manager executes an instant automated rollback in under 5 minutes.
- Python 3.11+
- Node.js 18+ (for dashboard)
- Docker & Docker Compose (optional)
git clone https://github.com/DivineDemon/rtfsp.git
cd rtfsp
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtVerify p95 latency stays strictly under 180ms:
PYTHONPATH=. python3 scripts/benchmark_latency.pyValidate False Positive Rate reduction (14% -> 3.5%) and catch-rate lift:
PYTHONPATH=. python3 scripts/train_models.pySimulate streaming transactions, feature lookups, drift detection, and canary rollback:
PYTHONPATH=. python3 scripts/run_simulation.pyPYTHONPATH=. pytest -vPYTHONPATH=. uvicorn rtfsp.api.app:app --reload --port 8000API Documentation: http://localhost:8000/docs
cd dashboard
npm install
npm run devDashboard: http://localhost:3000
To make this interactive for recruiters, hiring managers, and GitHub visitors, you can deploy it publicly using any of the following methods:
- Push this repository to GitHub.
- Sign in to Render or Railway.
- Select New Web Service and connect your
rtfspGitHub repository. - Set the runtime to Docker (using the root
Dockerfileordocker-compose.yml). - Render will automatically build and assign a free public URL (e.g.,
https://rtfsp-fraud-pipeline.onrender.com).
We have prepared a dedicated zero-dependency Static Space Package (static_hf_space/):
- Go to Hugging Face Spaces and click Create new Space.
- Set Space Name to
rtfsp-fraud-pipeline. - Select SDK: Static (runs on the free CPU Basic hardware tier).
- Upload or push the files inside
static_hf_space/(index.html&README.md) to your Hugging Face Space repository. - Hugging Face instantly hosts your interactive fraud scoring control panel at a permanent public URL (e.g.
https://huggingface.co/spaces/DivineDemon/rtfsp-fraud-pipeline)!
To run the full stack locally (API + Dashboard + Redis) in one command:
docker-compose up --buildAccess the interactive dashboard at http://localhost:3000 and the API docs at http://localhost:8000/docs.
To generate an instant HTTPS link from your local machine to share with anyone:
# Terminal 1: Launch API
PYTHONPATH=. uvicorn rtfsp.api.app:app --port 8000
# Terminal 2: Launch Dashboard
cd dashboard && npm run dev
# Terminal 3: Share publicly
npx cloudflared tunnel --url http://localhost:3000Distributed under the MIT License. See LICENSE for more details.