naidu9678/gnn-lstm-fraud-detection
06
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 probabilityDataset
Fraud Patterns Covered
- Card / transaction fraud
- Account takeover
- Money laundering (structuring)
- Insider trading / market abuse
Test Results
Usage
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
