CoolFace
Modelpublic

naidu9678/gnn-lstm-fraud-detection

sourceHugging Facemitupdated 6mo agoView on Hugging Face
0likes6downloads
Model Card

GNN+LSTM Hybrid Fraud Detection System

Trained for dissertation: Cloud-Native AI System for Real-Time Fraud Detection and Risk Management in the Financial Industry

Student: Setti Appala Naidu | 2024MT03062 | M.Tech Cloud Computing Institution: BITS Pilani WILP / Societe Generale GSC, Bangalore


Model Architecture

Input: Transaction sequences (window=20, features=19)
         ↓
    BiLSTM × 2 layers (hidden=128, embed=64)
         ↓
    [Concat with GNN node embedding (dim=64)]
         ↓
    GraphSAGE × 2 layers (hidden=128, out=64)
         ↓
    Fusion MLP (128 → 64 → 2)
         ↓
    Fraud probability

Dataset

DomainRowsFraud Rate
Core Banking (transactions)3,500,0002.50%
Investment Banking (trades)1,500,0000.30%
LSTM sequences4,882,5002.50%
Graph nodes79,866—

Fraud Patterns Covered

  • —Card / transaction fraud
  • —Account takeover
  • —Money laundering (structuring)
  • —Insider trading / market abuse

Test Results

MetricScore
ROC-AUC0.7150
F1 Score0.3343
Precision0.5270
Recall0.2448
Avg Precision0.2351
Specificity0.9944

Usage

python
import torch
from huggingface_hub import hf_hub_download

# Download model
path = hf_hub_download(repo_id="naidu9678/gnn-lstm-fraud-detection", filename="gnn_lstm_complete.pt")
checkpoint = torch.load(path, map_location="cpu", weights_only=False)

# Load config
cfg = checkpoint["config"]

# Rebuild model (copy class definitions from repo)
model = FraudDetectionSystem(cfg)
model.load_state_dict(checkpoint["model_state"])
model.eval()

# Inference on a single sequence
# x_seq shape: (1, 20, 19) — 1 sample, 20 timesteps, 19 features
x_seq   = torch.zeros(1, 20, 19)   # replace with real data
gnn_emb = torch.zeros(1, 64)       # node embedding or zeros
logits  = model(x_seq, gnn_emb)
prob    = torch.softmax(logits, dim=1)[0, 1].item()
print(f"Fraud probability: {prob:.4f}")

Training Infrastructure

  • —Platform: Kaggle (T4 GPU × 2, 30GB RAM)
  • —Training time: ~3.5 hours
  • —Framework: PyTorch + PyTorch Geometric
  • —Checkpointing: Every 500 batches + every epoch