Skip to content

Independent architecture study

Finding fraud through connections

Near Real-Time Fraud Detection with Graph Neural Networks

Some fraud only shows in the connections: a phone, card or address shared by accounts that each look clean. This study designs a payment check that reads those connections while the customer waits.

An independent architecture study based on public AWS guidance. A design exercise, not a client engagement.

Workload
Card and wallet payments for a fintech
Constraint
A decision inside the payment, in under a second
Approach
A live graph of accounts, cards and devices, scored by a graph neural network
  • <1sEnd-to-end scoringDesign target. Edge, gateway, function, graph query and model call together.
  • BillionsNodes and edgesPublished reference figure. Graph scale AWS states GraphStorm v0.5 supports for real-time inference.

What makes this difficult

  • Clean on its own

    A new card on a new account passes most per-payment checks. The risk sits in what that card and device are connected to.

  • No time to wait

    Real-time payments need an answer while the customer waits. A check that takes seconds can only run after the money has moved.

  • Fraud keeps changing

    Attackers probe and adapt, so a model trained once quietly gets worse unless it learns again.

Follow a payment

Two paths share one graph. Every payment is scored in the moment; on a schedule, the system learns from what it has seen.

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  1. 01

    A payment arrives

    Payment arrivesMerchant appChecks thecallerAPI GatewayGathers contextLambda

    The merchant or wallet sends the payment for scoring. The front door checks the caller is a known, authenticated service and limits abuse before anything else runs.

    Illustrative example Payment accepted for scoring.

  2. 02

    Look at who it is connected to

    Gathers contextLambdaFinds connectedaccountsNeptune

    The function asks the graph for everything a few hops around this payment: other accounts on the same card, device or network.

    Illustrative example Neighbourhood returned: linked accounts, cards and devices.

  3. 03

    Estimate the risk

    Gathers contextLambdaEstimates fraudriskSageMaker endpoint

    The connections and the payment go to the model, which passes signals along the graph so risk near known fraud counts.

    Illustrative example Risk score returned.

  4. 04

    Answer now, follow up later

    Payment arrivesMerchant appGathers contextLambdaKeeps theevidenceDocumentDBOpens a caseSQS

    The decision goes straight back to the payment. The evidence is stored for review, and a high score opens a case through a queue so alerts never slow the answer.

    Illustrative example Decision returned. Evidence saved. Case opened if the score is high.

  5. 05

    Learn from new fraud

    Finds connectedaccountsNeptunePayment historyS3Builds featuresGlueRebuilds thegraphFargateRetrains themodelSageMaker training

    On a schedule, payment history becomes features, the graph is rebuilt and the model retrains on the newest patterns.

    Illustrative example Graph refreshed. New model trained.

  6. 06

    Swap the model in carefully

    Estimates fraudriskSageMaker endpointRetrains themodelSageMaker trainingApproves, thenswaps inModel Registry

    A new model is registered and approved, then takes a small share of traffic before full promotion, so a bad model can be rolled back.

    Illustrative example New model live after a canary period.

  • Request
  • Data
  • Later, queued
  • Control

The hard part

Two ordinary payments, one shared device

Each payment alone looks normal. In the graph, both came from the same device as an account already flagged for fraud. A graph neural network learns from patterns like this across many links, so risk travels along the connection instead of being judged in isolation.

Payment ALooks normalPayment BLooks normalNew accountOlder accountSame phoneShared deviceFlagged accountKnown fraud
Illustrative: risk becomes visible only when the shared device links both payments to known fraud.

Why this design

  1. Graph neural network, not a classic model alone

    Chosen
    A GNN on a live graph, with tabular features carried as node attributes.
    Because
    Rings, chains and shared devices are relationships. A per-row model cannot see them.
    Cost
    Slower to train, dearer to serve and harder to explain than gradient-boosted trees.
    Reconsider when
    If most losses are single-payment patterns, a classic model is cheaper and nearly as good.
  2. A graph database, not graph tables in PostgreSQL

    Chosen
    Amazon Neptune with native traversal.
    Because
    Multi-hop neighbourhood queries must return in milliseconds, inside the payment.
    Cost
    A new database to run and new skills for the team.
    Reconsider when
    At low volume with shallow queries, recursive SQL on an existing database may be enough.
  3. Score in the payment, not afterwards

    Chosen
    Real-time scoring in the authorisation path.
    Because
    For card-not-present and wallet payments, a later check arrives after the money has gone.
    Cost
    A hard latency budget and always-ready capacity, which costs more than batch scoring.
    Reconsider when
    Where chargebacks are cheap and recoverable, scoring after the payment is simpler.

Cost and operating assumptions

  • Model endpoint

    The always-on scoring endpoint is the largest single cost; two instances for resilience double it.

  • Graph queries

    Neptune Serverless scales with query volume and drops back when traffic is quiet.

  • Ready capacity

    Provisioned concurrency keeps the function warm so the first payment is as fast as the last.

  • Training runs

    Weekly feature, graph and training jobs; Spot capacity can cut the GPU share.

Assumptions behind the numbers

Indicative only, for about 1 million payments a day, using AWS list prices at the time of writing: roughly $1,560 a month for scoring and $215 for training, about $0.00006 per payment. Real costs depend on region, instance choices, graph size and traffic shape.

How it stays reliable

  • Never reachable from the internet

    The graph runs in private subnets; only the function reaches it, through a VPC endpoint.

  • No alert is lost

    Alerts go through a queue with a dead-letter queue, so slow case systems never drop a case.

  • Survives a zone failure

    Neptune replicates across Availability Zones, so scoring continues if one fails.

  • Every decision is explainable

    Each score is stored with its model version and graph snapshot, ready for disputes and regulators.

When this is a poor fit. A poor fit for a business with low payment volume or little shared-identity fraud: the always-on model and graph cost more than they save.

Full technical write-upService-by-service detail, the architecture diagram, Well-Architected review and the original cost table.