Case Study · Financial Services
Near Real-Time Fraud Detection with Graph Neural Networks on AWS
Graph Neural Network · Amazon Neptune · SageMaker · Sub-Second Inference · Fintech Scale
Based on AWS Guidance: Guidance for Near Real-Time Fraud Detection with Graph Neural Network on AWS
Architecture study — a design exercise based on public AWS guidance, not a claimed client engagement
Executive Summary
This case study documents an AWS-native fraud detection platform for fintech companies processing payments at scale. The architecture uses Graph Neural Networks (GNNs) — a class of machine learning model that reasons over relationship graphs rather than isolated data points — to detect fraud rings, synthetic identity clusters, and account takeover chains that are invisible to per-transaction models.
The system operates on two parallel paths: a real-time inference path that scores each transaction in under a second using a live Amazon Neptune graph and a SageMaker-hosted GNN endpoint, and an offline training pipeline that continuously retrains the GNN model against evolving fraud patterns using Step Functions, Glue, Fargate, and SageMaker Training Jobs. The result is a fraud detection capability that both responds to known patterns in real time and adapts to new fraud tactics through automated model retraining.
<1s
End-to-End Inference
CloudFront + Lambda + Neptune + SageMaker
<10ms
API Gateway + Lambda
Provisioned concurrency serving layer
bn+
Graph Scale
Nodes and edges via GraphStorm v0.5
$485B
Annual Fraud Losses
Global — 2023 estimate driving investment
Business Problem
Payment fintechs — BNPL providers, neobanks, digital wallets, and crypto exchanges — face fraud rates 3–5x higher than traditional banks. They onboard customers with lower friction, serve younger demographics with limited credit history, and operate novel financial products that attract novel attack vectors. The three structural problems with legacy fraud detection at fintech scale are:
Relationship-Blind Models
Traditional ML models score each transaction in isolation. A single transaction from a new card on a new account looks clean. The fraud only becomes visible when you observe that the same card has touched 12 merchants connected to a known fraud ring via a shared device fingerprint and IP subnet — a pattern that only graph traversal can reveal.
Latency Constraints
ISO 20022, Faster Payments, the RTP (Real-Time Payments) network, and open banking APIs all require authorization decisions in milliseconds. A fraud model that takes 3 seconds to respond cannot be placed in the authorization path — it can only operate post-transaction, when the money has already moved.
Concept Drift
Fraud patterns change continuously. A model trained on historical data begins degrading as soon as it is deployed — fraudsters actively probe detection systems and adapt their tactics. Without an automated retraining pipeline, a fraud model that achieved 95% accuracy at launch may fall to 80% within 60 days as new attack patterns emerge.
Architecture
The architecture has two cooperating paths: a real-time inference path that scores live transactions, and an offline training pipeline that continuously produces updated GNN models. Both paths share Amazon Neptune as the graph store — the inference path queries it for neighbourhood context; the training pipeline reads it to construct the training graph.
Near Real-Time Fraud Detection · Graph Neural Network · Official AWS Icons
Path 1 — Real-Time Inference
- CloudFront provides TLS termination and DDoS protection at the network edge, reducing the attack surface of the fraud scoring API before requests reach the origin
- API Gateway enforces rate limiting, OAuth 2.0 authentication, and request throttling — preventing volumetric abuse of the scoring endpoint by compromised clients
- Lambda (with provisioned concurrency to eliminate cold-start latency) receives the transaction payload, enriches it with cached account features, and orchestrates the Neptune graph query and SageMaker inference calls
- Amazon Neptune Serverless stores the heterogeneous transaction graph — nodes for users, cards, merchants, devices, and IP addresses; edges for transaction relationships, shared attributes, and login events. Lambda queries the graph to retrieve the k-hop neighbourhood of the transaction participants
- Amazon SageMaker Endpoint hosts the trained GNN model. Neptune neighbourhood data is passed as input features; the GNN performs message-passing aggregation across the graph and returns a fraud probability score with confidence interval
- Amazon DocumentDB stores the prediction result, the evidence graph snapshot, and the model version used — creating a complete audit trail for regulatory review and model governance
- Amazon SQS receives downstream alerts for high-confidence fraud scores, triggering case management workflows, customer notifications, and card blocking actions asynchronously without adding latency to the scoring response
Path 2 — GNN Training Pipeline
- S3 stores the raw transaction event stream (sourced from the payment processing platform via Kinesis Firehose or direct API ingestion), partitioned by date and account for efficient Glue access
- AWS Step Functions orchestrates the training pipeline as a DAG — triggering ETL, graph construction, model training, evaluation, and conditional deployment steps in the correct order with retry logic and failure handling
- AWS Glue performs feature engineering on the raw transaction records — computing aggregate features (transaction velocity, amount percentiles, merchant category ratios), joining with account master data, and outputting a cleansed feature dataset
- AWS Fargate (containerised workloads) executes the graph construction step — converting tabular transaction rows into the node-edge format required by Amazon Neptune and the Deep Graph Library (DGL), then loading the updated graph into Neptune
- Amazon SageMaker Training Job trains the GNN using the Deep Graph Library against the updated Neptune graph. The model learns to propagate fraud signals across the graph topology — a node adjacent to known-fraudulent nodes receives a higher fraud prior during inference
- Trained model artifacts are stored in S3 with version metadata, then registered in SageMaker Model Registry. A blue/green deployment updates the SageMaker Endpoint — the new model version receives a canary traffic split before full promotion
Graph Model Design — The Technical Core
The key innovation in this architecture is the heterogeneous transaction graph constructed in Amazon Neptune. Unlike homogeneous graphs (where all nodes are the same type), a heterogeneous graph models different entity types and relationship types — capturing the multi-dimensional structure of payment fraud.
Graph Schema
Node Types
- • User account — the registered account holder
- • Payment card — card number / BIN with issuance metadata
- • Merchant entity — merchant ID, MCC code, geolocation
- • Device fingerprint — browser/app fingerprint hash
- • IP address — /24 subnet grouping for VPN/proxy detection
Edge Types
- • made_transaction — user → merchant (with amount, timestamp)
- • used_card — transaction → card
- • accessed_from_device — session → device fingerprint
- • connected_via_ip — session → IP subnet
- • shared_device — two users sharing a device (fraud signal)
How GNN Message Passing Detects Fraud Rings
During inference, the GNN performs multiple rounds of message passing across the neighbourhood of the transaction being scored. In each round, each node aggregates feature information from its neighbours, then updates its own representation. After several rounds, a node's representation encodes information from its extended neighbourhood — not just its immediate connections.
- Round 1: the transaction node aggregates features from the merchant and card nodes it is directly connected to
- Round 2: the card node aggregates features from all other users who have recently used the same card — detecting card sharing patterns common in synthetic identity fraud
- Round 3: the merchant node aggregates from all recent transactions — detecting merchants with an abnormally high proportion of first-time cards or unusual geographic dispersion
- Output: the final transaction node representation is passed to a classification head that outputs a fraud probability score. This score reflects not just the transaction itself but the fraud signals accumulated across its graph neighbourhood
GraphStorm v0.5 (2025)
Fraud Patterns Detected
Synthetic Identity Fraud
Fraudsters construct fictitious identities using real SSNs (often belonging to children or deceased individuals) combined with fabricated names and addresses. These identities are built up slowly over months before being used for large-value fraud. The GNN detects synthetic identities by identifying shared SSN fragments, device fingerprints, and IP addresses across multiple accounts — connections invisible to per-account models.
Fraud Ring Detection
Organised fraud rings operate dozens or hundreds of accounts simultaneously, often sharing devices, IP addresses, and referral patterns. The GNN identifies these rings by traversing the shared-attribute edges between accounts — a cluster of 50 accounts that all share 3 device fingerprints and were all referred by the same account is a high-confidence fraud ring signal.
Account Takeover Chains
After an account is taken over (via credential stuffing, phishing, or SIM swap), the attacker typically moves value out quickly across multiple hops. The GNN detects ATO chains by identifying unusual graph topology changes — a legitimate account suddenly transacting with merchants it has never used, via a device it has never used, to recipients who are connected to known mule accounts.
Merchant Collusion
Fraudulent merchants process large volumes of transactions with cards that are subsequently disputed. The GNN identifies merchant nodes with abnormally high connectivity to dispute-flagged cards, concentrated transaction bursts, and unusual geographic dispersion of card origins — signals of a compromised or collusive merchant terminal.
Regulatory Alignment
The architecture is designed to meet the audit and explainability requirements that financial regulators impose on automated decision systems. In the UK and EU, automated decisions that significantly affect customers (including fraud blocks) must be explainable and subject to human review.
- Audit trail completeness: every fraud score stored in DocumentDB includes the transaction ID, the model version used, the graph neighbourhood snapshot at inference time, the top contributing graph features, and the timestamp — providing a complete forensic record for dispute resolution
- Human review queue: transactions scored above a configurable confidence threshold (e.g. 0.85 fraud probability) are sent via SQS to a case management system for human review before card blocking, meeting the right-to-human-review requirements under GDPR Article 22 and UK GDPR
- CloudTrail: all API calls to Neptune, SageMaker, and DocumentDB are logged via CloudTrail — providing a complete record of data access for information security audits and regulatory examinations
- Model governance: SageMaker Model Registry maintains a versioned registry of all trained models with training metadata, evaluation metrics, and approval status — enabling regulators to inspect which model version was in production on any given date
- PSD2 SCA alignment: the real-time scoring capability supports PSD2 Strong Customer Authentication exemption logic — high-confidence low-risk transactions can be exempted from SCA friction based on real-time fraud risk assessment, improving conversion rates for compliant fintechs
Cost Model
The architecture uses serverless and managed services throughout, meaning costs scale with transaction volume rather than reserved capacity. The following is indicative for a mid-scale fintech processing 1 million transactions per day.
Real-Time Inference Path
Lambda: 1M invocations/day × $0.0000002/invocation = ~$6/month. Provisioned concurrency for 10 instances: ~$100/month.
Neptune Serverless: scales with query volume. Estimated ~$200/month for 1M graph queries/day at average query size.
SageMaker Endpoint (ml.g4dn.xlarge): ~$526/month for a single-instance endpoint. Multi-AZ redundant: ~$1,052/month.
DocumentDB (db.r6g.large): ~$180/month.
Training Pipeline
Glue ETL: $0.44/DPU-hour. Weekly full retraining job at 10 DPU × 4 hours = ~$70/month.
Fargate (graph construction): ~$30/month for weekly runs.
SageMaker Training Job (ml.p3.2xlarge): $3.83/hour. Weekly 6-hour training run: ~$92/month.
S3 storage (1TB model artifacts + training data): ~$23/month.
Total Estimate · 1M Transactions/Day
AWS Well-Architected Framework
Operational Excellence
Automated retraining: Step Functions pipeline runs on a schedule — model degradation is addressed automatically rather than requiring manual intervention when fraud rates rise.
Model registry: SageMaker Model Registry provides version control, approval gates, and rollback capability — deploying a new model version is a controlled, reversible operation.
Security
No public Neptune access: Neptune runs in a private VPC subnet; Lambda accesses it via VPC endpoint — the graph database is never reachable from the internet.
API Gateway authentication: OAuth 2.0 JWT validation on every request — only authenticated payment platform services can submit transactions for scoring.
Reliability
Neptune Serverless multi-AZ: Neptune automatically replicates across Availability Zones — a single AZ failure does not interrupt fraud scoring.
SQS dead-letter queues: failed downstream alert processing is retained in DLQ for reprocessing — no fraud alerts are silently dropped under downstream system pressure.
Performance Efficiency
Provisioned concurrency: Lambda provisioned concurrency eliminates cold-start latency on the critical inference path — the first transaction of the day scores as fast as the millionth.
CloudFront caching: static API responses (model metadata, health checks) are cached at the edge — reducing origin load and improving global API response times.
Cost Optimisation
Neptune Serverless: scales to zero during overnight low-traffic periods — no idle graph database costs during batch maintenance windows.
Spot instances for training: SageMaker Training Jobs support EC2 Spot Instances — GPU training costs can be reduced by up to 70% by using Spot capacity for the non-time-critical weekly retraining runs.
Sustainability
Event-driven compute: Lambda and SageMaker Serverless Inference run only when transactions arrive — zero energy consumption between transaction events.
Neptune Serverless scale-to-zero: graph compute capacity scales down to near zero during low-traffic periods rather than running idle dedicated instances.
Engineering Decisions & Tradeoffs
Decision 1: Graph Neural Network vs Classical ML (XGBoost / Random Forest)
Chosen: Graph Neural Network on Amazon Neptune.
Traded away: Classical gradient-boosted models (XGBoost, LightGBM) are faster to train, cheaper to serve, and easier to interpret. They remain superior for detecting point-in-time fraud signals from tabular features (amount, merchant category, time-of-day).
Why acceptable: GNNs detect relational fraud patterns (rings, chains, clusters) that tabular models structurally cannot represent. A hybrid architecture — classical model for tabular features, GNN for graph features, ensemble scoring — captures both signal types and achieves higher AUC than either model alone. This architecture uses the GNN as the primary model with tabular features incorporated as node attributes.
Decision 2: Amazon Neptune vs Graph Stored in Relational DB (RDS PostgreSQL)
Chosen: Amazon Neptune purpose-built graph database.
Traded away: PostgreSQL can model graph-like relationships using recursive CTEs and adjacency tables. Many engineering teams already have PostgreSQL expertise and existing RDS infrastructure.
Why acceptable: Neptune supports Gremlin and openCypher graph traversal natively — k-hop neighbourhood queries that take seconds in PostgreSQL execute in milliseconds in Neptune. At 1M transactions/day adding ~5M new edges/day, Neptune's graph-optimised storage and indexing is essential for sub-second inference query latency.
Decision 3: Real-Time Scoring vs Batch Scoring (Post-Transaction)
Chosen: Real-time scoring in the transaction authorization path.
Traded away: Post-transaction batch scoring is significantly cheaper, simpler, and can use larger models without latency constraints. Many fraud systems still operate post-transaction and rely on chargeback processes for recovery.
Why acceptable: For card-not-present payments and digital wallet transactions, post-transaction scoring arrives after the money has moved. Real-time authorization-path scoring prevents the transaction from completing — eliminating chargeback costs, regulatory fines, and customer harm. The sub-second latency requirement is met by the Neptune + SageMaker serving architecture with provisioned Lambda concurrency.