Contact Now
MLOpsApr 29, 2026

Detecting Fraud with Graph Neural Networks

Modeling transaction networks to catch bad actors.

The Relational Blindspot

Traditional tabular models evaluate transactions in complete isolation. However, fraud rings don't operate in isolation; they create complex webs of transactions, shared IP addresses, and overlapping device IDs.

Deploying GraphSAGE

We deployed a GraphSAGE architecture using PyTorch Geometric. We model the dataset as a massive graph where users are nodes and transactions are edges.

By passing messages (embeddings) across the graph, the model learns the structural patterns of fraud rings. For example, it easily detects a "star" pattern where many newly created nodes funnel money to a single, older node.

import torch from torch_geometric.nn import SAGEConv class FraudGraphNet(torch.nn.Module): def __init__(self, in_channels, hidden_channels, out_channels): super().__init__() # GraphSAGE layers aggregate information from neighbors self.conv1 = SAGEConv(in_channels, hidden_channels) self.conv2 = SAGEConv(hidden_channels, out_channels) def forward(self, x, edge_index): x = self.conv1(x, edge_index).relu() x = self.conv2(x, edge_index) return x

The hardest engineering challenge was subgraph sampling. The full transaction graph has over 500 million edges and could not fit into VRAM. We had to implement neighbor-sampling algorithms to construct mini-batches that capture local graph structure without running out of memory.