Sam Austinon November 26, 202618 min read

Detecting Suspicious Networks: Graph Neural Networks for Fraud Rings

Detecting Suspicious Networks: Graph Neural Networks for Fraud Rings
Contents

Figure 1: Detecting Suspicious Networks: Graph Neural Networks for Fraud Rings — shared devices, cards, and IPs expose coordinated fraud that row-by-row models miss

One stolen identity is a crime. Fifty fake accounts sharing three devices, two payment cards, and a handful of IP addresses is a ring. Row-by-row models struggle to see the ring, because each account looks ordinary on its own. The giveaway lives in the connections, and that's where graph methods earn their keep.

I can't claim I've built a production fraud system, and I haven't run the code below in this conversation, so test it yourself. As you asked, I put the sources after the article, not inside it. One warning up front: a 2026 re-evaluation I found shows that a plain random forest beat every GNN on a famous fraud benchmark once the evaluation got stricter. IMO, that makes this topic less about "which GNN?" and more about whether your graph, your labels, and your evaluation are honest. Ready to dig in?

What a Fraud Ring Looks Like as a Graph

Build a graph where entities are nodes and shared attributes are edges:

  • Nodes: accounts, devices, payment cards, IP addresses, phone numbers, shipping addresses, merchants
  • Edges: "logged in from," "paid with," "shipped to," "transferred money to"

Rings often show up as:

  • Dense clusters: many accounts tied to a small set of devices or cards
  • Shared infrastructure: one device behind dozens of "different customers"
  • Hubs and mules: a few accounts that receive or forward money from many others
  • Bursts: many accounts created or activated in a short window
  • Cycles: money flowing around a loop of accounts

Why does a graph catch these when a table can't? Because the evidence sits between records. Ever noticed how a single shared phone number can connect two unrelated-looking accounts? That's the whole idea.

Two Different Jobs

People mix up two tasks:

  • Ring discovery (often unsupervised): find suspicious groups using structure, with connected components, community detection, or dense-subgraph search
  • Node classification (supervised): predict which accounts or transactions are fraudulent, using labels from past investigations

I'd start with the first, because it needs no labels and gives investigators something concrete. Then add the second where you have trustworthy labels.

Step 1: Find Candidate Rings With Plain Graph Analytics

Link accounts through the identifiers they share, then look at the connected pieces. I haven't run this, so test it on a small sample first:

import numpy as np
import pandas as pd
import networkx as nx

def build_entity_graph(df, id_cols=("device_id", "card_hash", "phone", "ip"), max_share=20):
    """Bipartite graph: account nodes <-> identifier nodes.
    Identifiers shared by more than max_share accounts (public WiFi, shared proxies)
    get dropped, because they would glue unrelated people into giant components."""
    G = nx.Graph()
    for col in id_cols:
        counts = df.groupby(col)["account_id"].nunique()
        keep = set(counts[counts <= max_share].index)
        sub = df[df[col].isin(keep)]
        for acc, val in zip(sub["account_id"], sub[col]):
            G.add_edge(("acct", acc), (col, val))
    return G

def candidate_rings(G, min_accounts=5):
    rows = []
    for comp in nx.connected_components(G):
        accts = [n for n in comp if n[0] == "acct"]
        ids = [n for n in comp if n[0] != "acct"]
        if len(accts) < min_accounts:
            continue
        sub = G.subgraph(comp)
        id_types = {n[0] for n in ids}
        rows.append({
            "n_accounts": len(accts),
            "n_identifiers": len(ids),
            "id_types": len(id_types),
            "accts_per_identifier": len(accts) / max(len(ids), 1),
            "density": nx.density(sub),
            "accounts": [a[1] for a in accts],
        })
    return pd.DataFrame(rows).sort_values(["accts_per_identifier", "n_accounts"], ascending=False)

Notice the max_share filter. Without it, one coffee-shop IP address can merge thousands of strangers into a single "ring." But set it too low, and you may drop a real ring's shared device. That tradeoff needs tuning with investigators, not guessing.

Rank the candidates and send the top ones to human review. Measure precision on what reviewers confirm. If a graph-analytics pass already finds rings your rules missed, you've delivered value before training anything.

Step 2: Why Plain GNNs Struggle on Fraud

When you do train a GNN, four problems appear. A 2026 survey names the same set: class imbalance, and camouflage links that defeat naive aggregation (it lists four difficulties total).

Class Imbalance

Fraud is rare, often well under 1 percent of activity according to that survey, and a model trained without correction learns to call everything legitimate. Public fraud datasets are less extreme but still skewed: the Amazon dataset in one paper has about 9.5 percent fraud.

Camouflage and Heterophily

Fraudsters connect to normal users on purpose, so averaging neighbors blurs the signal. The CARE-GNN paper quantifies this. On the Yelp dataset, the relation linking reviews by the same user shows a label similarity of 0.90, so neighbors usually share labels. On the Amazon dataset, relations like "users reviewing the same product" show label similarities around 0.03 to 0.05, so connected users rarely share labels. That's heterophily, and plain GCN averaging handles it poorly. The survey puts it neatly: dense internal structure is signal, while camouflage links defeat a naive method, so fraud-specific designs filter or reweight neighbors.

Several papers address camouflage by filtering neighbors, including CARE-GNN, FRAUDRE, PC-GNN, and RioGNN. Others focus on heterophily and label usage, for instance DOS-GNN, which tackles imbalance and heterophily together.

Time and Label Delay

Fraud patterns drift, and labels often arrive weeks after the transaction (chargebacks, investigations). A random split lets a model peek at future behavior, so evaluate with time-ordered splits.

Scale

Real transaction graphs have millions of nodes, so you need neighbor sampling and efficient serving, as the GraphSAGE discussion in earlier articles described.

Step 3: Train a Fraud-Aware GNN (and a Strong Baseline)

First check relation quality. For each edge type, compute the fraction of edges joining same-label nodes, using training labels only:

def edge_label_similarity(edge_index, y, mask):
    src, dst = edge_index
    keep = mask[src] & mask[dst]                    # only edges with both endpoints labeled
    return (y[src][keep] == y[dst][keep]).float().mean().item()

Drop or down-weight relations with near-chance similarity, since they inject noise. Now the model. GraphSAGE keeps a separate self channel, which helps when neighbors mislead. I haven't run this, and PyG APIs change, so check it first:

import torch, torch.nn as nn, torch.nn.functional as F
from torch_geometric.nn import SAGEConv
from sklearn.metrics import average_precision_score, precision_recall_curve
from sklearn.ensemble import RandomForestClassifier

class FraudSAGE(nn.Module):
    def __init__(self, in_ch, hidden=64, dropout=0.3):
        super().__init__()
        self.c1, self.c2 = SAGEConv(in_ch, hidden), SAGEConv(hidden, hidden)
        self.head = nn.Linear(hidden, 1)
        self.dropout = dropout
    def forward(self, x, edge_index):
        x = F.relu(self.c1(x, edge_index)); x = F.dropout(x, self.dropout, self.training)
        x = F.relu(self.c2(x, edge_index)); x = F.dropout(x, self.dropout, self.training)
        return self.head(x).squeeze(-1)

def train_gnn(data, epochs=200, lr=5e-3):
    device = data.x.device
    n_pos = int(data.y[data.train_mask].sum()); n_neg = int(data.train_mask.sum()) - n_pos
    pos_weight = torch.tensor(n_neg / max(n_pos, 1), device=device)       # fight imbalance
    model = FraudSAGE(data.x.size(1)).to(device)
    opt = torch.optim.Adam(model.parameters(), lr=lr, weight_decay=1e-4)
    best_ap, best_state = -1.0, None
    for _ in range(epochs):
        model.train(); opt.zero_grad()
        out = model(data.x, data.edge_index)
        loss = F.binary_cross_entropy_with_logits(out[data.train_mask], data.y[data.train_mask].float(),
                                                  pos_weight=pos_weight)
        loss.backward(); opt.step()
        model.eval()
        with torch.no_grad():
            p = torch.sigmoid(model(data.x, data.edge_index))
        ap = average_precision_score(data.y[data.val_mask].cpu(), p[data.val_mask].cpu())
        if ap > best_ap:
            best_ap, best_state = ap, {k: v.clone() for k, v in model.state_dict().items()}
    model.load_state_dict(best_state)
    return model

# Baseline you must beat: random forest on raw node features, no graph
def train_rf(data):
    X, y = data.x.cpu().numpy(), data.y.cpu().numpy()
    tr = data.train_mask.cpu().numpy()
    return RandomForestClassifier(n_estimators=500, class_weight="balanced_subsample",
                                  n_jobs=-1, random_state=0).fit(X[tr], y[tr])

Make the masks time-based: train on earlier periods, validate on the next, and test on the latest. Select the epoch by validation average precision, never by test performance.

The Cautionary Tale: Random Forest vs. GNNs on Elliptic

Here's why I keep stressing baselines. The Elliptic dataset, a Bitcoin transaction graph with illicit and licit labels, has been a standard testbed, and many papers report GCN, GraphSAGE, GAT, and EvolveGCN as state of the art. A 2026 paper re-evaluated them under a strictly inductive protocol: it trained the encoder on the subgraph up to time step 34 and evaluated on the full graph afterward, with 10 seeds and per-timestep reporting.

Its results, in my summary:

  • Random forest on raw features: F1 of 0.821 ± 0.003, beating every GNN it tested
  • Strongest graph encoder (GraphSAGE): F1 of 0.689 ± 0.017
  • A plain MLP: F1 of 0.549 ± 0.015
  • A hybrid feeding GraphSAGE embeddings plus raw features into a random forest: F1 of 0.699 ± 0.015 under the strict protocol (an earlier draft reported 0.807)
  • Published GNN numbers of roughly 0.70 to 0.77 F1, which the authors argue rest on evaluation choices that don't survive tightening
  • On Elliptic specifically, the authors conclude that the graph structure behaves worse than random wiring

The authors state a narrow claim, not "GNNs are useless for fraud": under strict inductive evaluation on this dataset, no GNN or graph-augmented pipeline beat the random forest. This is a single paper from one group, so replicate before you generalize. Still, take the lesson seriously. A separate paper on fraud GNNs reports that it couldn't evaluate several earlier methods (CARE-GNN, PC-GNN, FRAUDRE, RioGNN) because their implementations failed to run, which hints at how shaky reproducibility is in this corner.

Evaluate Like a Fraud Team

Accuracy and ROC-AUC both mislead on rare events. Use:

  • PR-AUC (average precision): focuses on the rare class
  • Precision at K or recall at K: investigators can review only so many alerts per day
  • Recall at a fixed precision: "catch as much fraud as possible at 90 percent precision"
  • Cost-weighted metrics: missed fraud costs money, and false alarms cost trust and review time
  • Per-period results: performance often collapses in later periods. The Elliptic re-evaluation traced a late-period collapse to a threshold-shift problem, not a probability-scaling one.
  • Calibration and threshold drift: retune thresholds as fraud rates change

Several fraud papers use macro-F1, AUC, and G-Mean with threshold-moving, one even setting the classification threshold to 0.2 for the Yelp and Amazon datasets. Whatever you choose, set the threshold on validation data and monitor it in production.

Also respect inductive evaluation: the model should score accounts and edges that appear after training, using a graph that contains only information available at that time. Don't let future edges flow into message passing.

Guilt by Association: Handle With Care

This is the part where the technology touches real people. Graph methods infer suspicion from connections, and connections are noisy:

  • Shared devices and IPs often mean families, roommates, libraries, and offices, not conspiracies
  • Innocent neighbors of a bad actor can inherit suspicion unfairly
  • Automated punishment (freezing accounts, denying payouts) based on graph scores can harm legitimate customers and may carry legal obligations around explanations and appeals. I'm not a lawyer, so check the rules where you operate.
  • Data minimization: device IDs, addresses, and transaction links are sensitive, so collect and retain only what you need
  • Bias: features like location or shared infrastructure can correlate with protected groups, so audit outcomes by segment

Treat graph scores as leads for human review, not verdicts. Give investigators the evidence: which shared device, which card, which timeline. Subgraph explanations help, and simple rule-based reasons often convince reviewers more than attention weights.

A Practical Pipeline

  1. Define the entity graph carefully, and filter high-share identifiers
  2. Run component and community analysis to surface candidate rings, and measure reviewer-confirmed precision
  3. Add structural features (degree, PageRank, component size, community stats) to a gradient-boosted or random forest baseline
  4. Check relation quality with per-edge-type label similarity
  5. Train a GNN (GraphSAGE or a fraud-specific variant) with imbalance handling and time-based splits
  6. Compare against the tabular and structural baselines across several seeds and per-period results
  7. Set thresholds from an alert budget, not from a default of 0.5
  8. Deploy in shadow mode, then as ranked leads for reviewers, with kill switches
  9. Monitor drift, retrain on schedule, and track reviewer feedback as new labels
  10. Audit for fairness and harm, and keep an appeals path

Best Book to Read

As an Amazon Associate I earn from qualifying purchases. Links on this page are affiliate links, and I may earn a commission at no extra cost to you.

Graph Neural Networks: Foundations, Frontiers, and Applications — a comprehensive reference covering GNN theory, architectures (GCN, GraphSAGE, GAT), and real-world deployments including fraud detection. Search on Amazon

Common Mistakes to Avoid

  • Random splits on time-ordered data. The model peeks at the future.
  • Skipping the tabular baseline. A random forest may win, as on Elliptic.
  • Letting hub identifiers merge strangers. Filter shared infrastructure.
  • Trusting accuracy or ROC-AUC. Use PR-AUC, precision at K, and per-period results.
  • Using every edge type blindly. Test relation label similarity first.
  • Evaluating transductively when production will be inductive.
  • Fixing the threshold once. Fraud rates and score distributions drift.
  • Treating graph proximity as guilt. Route to humans with explanations.
  • Ignoring adversaries. Fraudsters adapt, so expect camouflage and retrain.
  • Reproducing paper numbers blindly. Implementations sometimes fail to run, and protocols differ.

Did you notice that most mistakes involve trusting a signal too much? :/

Wrapping This Up

Graphs expose fraud rings because the evidence lives in shared devices, cards, and addresses, not in any single row. Start with graph analytics to surface candidate rings, add structural features to a strong tabular model, and bring in a GNN only when it beats that baseline under a strict, time-aware test. Then keep humans in the loop, because association is not proof.

So build the entity graph from your own data this week, drop the high-share identifiers, and look at the five largest components. If reviewers confirm even one ring your rules missed, you just demonstrated the value of the graph. If every component looks like a family or a coffee shop, congratulations: you found out how noisy your identifiers are before it cost anyone a frozen account. :)

Frequently Asked Questions

What is a fraud ring in graph terms?

A fraud ring appears as a dense cluster of accounts connected through shared identifiers — devices, payment cards, IP addresses, or phone numbers. Unlike isolated fraud, rings show coordinated structure: many accounts tied to a small set of infrastructure, hub accounts moving money between others, or bursts of account creation within short time windows.

Should I start with graph analytics or a GNN for fraud detection?

Start with plain graph analytics — connected components and community detection on an entity graph. It needs no labels, gives investigators concrete candidate rings to review, and often delivers value before you train anything. Add a GNN only when it beats a strong tabular baseline under strict, time-aware evaluation.

Why do plain GNNs struggle with fraud data?

Four main problems: extreme class imbalance (fraud is often under 1%), camouflage links where fraudsters deliberately connect to normal users (heterophily), label delay where ground truth arrives weeks later, and graph scale requiring neighbor sampling. Standard GCN averaging fails on heterophilic edges.

What evaluation metrics should I use for fraud GNNs?

Avoid accuracy and ROC-AUC — they mislead on rare events. Use PR-AUC (average precision), precision at K, recall at fixed precision (e.g., 90%), cost-weighted metrics, and per-period results. Set thresholds from an alert budget, not a default of 0.5, and monitor calibration drift as fraud rates change.

Can graph methods unfairly flag innocent users?

Yes. Shared devices and IPs often mean families, roommates, or offices — not conspiracies. Innocent neighbors of a bad actor can inherit suspicion. Treat graph scores as leads for human review with subgraph explanations, not automated verdicts. Audit outcomes by segment and maintain an appeals path.

Sources

[1] 2026 Survey on Graph Neural Networks for Fraud Detection — classifies four core difficulties: class imbalance, camouflage/heterophily, label delay, and scale. Quantifies label similarity across edge types on Yelp and Amazon datasets.

[2] CARE-GNN (Dou et al.) — introduces neighbor filtering for camouflage links; reports label similarity of 0.90 on Yelp "same user" edges vs. 0.03–0.05 on Amazon "same product" edges.

[3] DOS-GNN — addresses class imbalance and heterophily jointly in fraud graphs; evaluates on Yelp, Amazon, and custom financial datasets.

[4] Elliptic Re-evaluation (2026) — strict inductive protocol on Bitcoin transaction graph: random forest F1 0.821 vs. GraphSAGE 0.689; graph structure performs worse than random wiring under tightened evaluation.

[5] Reproducibility audit of fraud GNN methods — several prior implementations (CARE-GNN, PC-GNN, FRAUDRE, RioGNN) failed to run, highlighting protocol sensitivity and implementation fragility.

What are You Looking For?

esc