Graph Neural Networks for Fraud Detection

This article first appeared in Data Science Briefings, the DataMiningApps newsletter. Subscribe now for free if you want to be the first to receive our feature articles, or follow us @DataMiningApps. Do you also wish to contribute to Data Science Briefings? Shoot us an e-mail over at and let’s get in touch!

Contributed by: Rafaël Van Belle.

Recent figures on transaction fraud remain worrisome. In 2020, the global card industry incurred fraud losses amounting to $28.58 billion. Alongside the increasing volume of card transactions, the total value of card-related fraud is estimated to reach $49.32 billion in 2030. Today, for every $100 spent, 6.81 cents are lost to fraud (“Card Fraud Losses Reach $28.65 Billion” n.d.). Most card fraud is attributed to card-not-present (CNP) fraud, where the card is not physically presented to the merchant. The rise of e-commerce is a major driver for this increased volume of CNP transactions. Despite technological advancements and considerable research attention, fraud detection remains a cat-and-mouse game in which criminals keep searching for loopholes in the current fraud detection systems (Bolton and Hand 2002).

How Network Data Benefits Fraud Detection

Here we consider the potential of network learning for fraud detection. Fraud detection benefits from network learning for two reasons.

First, fraud is a social phenomenon (Baesens, Van Vlasselaer, and Verbeke 2015). Fraudsters tend to organize in groups, use the same modi operandi and rely on similar resources (e.g. stolen cards, stolen identities). This manifests in the network structure and is known in. network theory as homophily. Homophily is best described as “birds of a feather flock together” (Newman 2018). People sharing certain traits will be more connected in the network. Because crime is a human activity, the effect of homophily is also visible for criminals and fraudsters. Homophily allows for ‘guilt-by-association’ (Koutra et al. 2011), meaning that nodes having a relationship with a criminal in the network raise the suspicion of that node being a criminal.

Contextualization is the second reason network learning is relevant for fraud detection. Context information helps determine whether a transaction is fraudulent or not. For instance, the fraudulent nature of a transaction is often not obvious, observing only the features of a single transaction. However, comparing a transaction against the historical transactions of a cardholder makes it easier to spot anomalies. A network is ideal for linking a transaction to its relevant context.

Graph Neural Networks

Before the advent of graph neural networks, the approach to leverage network data consisted mainly of manual feature engineering. To leverage network data for classification, a data scientist must extract features based on network metrics, heuristics, or domain knowledge before applying a standard machine learning classifier (Hamilton 2020). For an overview of network metrics useful for fraud detection, we refer the reader to (Baesens, Van Vlasselaer, and Verbeke 2015).

Instead of manually engineering network features, graph neural networks provide an automated and structured alternative. Graph neural networks are a type of deep neural network that operates on network data. The neural network generates a vector representation, also called node embedding, for each node by aggregating node features from neighboring nodes. The node embeddings are then used for a classification task, such as fraud detection. GNN algorithms learn the graph structure and the available node features in this manner.

Figure 1 Left: a simple input graph containing 6 nodes and 7 edges. The task is to obtain a representation for the target node A. Right: a two-layer graph neural network. The vector representation of node A is generated through the aggregation of node features from neighboring nodes B, C, and D. Their representation is based on their neighbors. The final representation of target node A depends on the first and second-order neighbors. Source: (Hamilton 2020)

Graph Neural Networks have proven very useful in a wide variety of applications. They are currently being used for, among others, recommender systems (Airbnb, eBay, Pinterest), drug discovery, and fraud detection (AliPay, Alibaba group).

To showcase the performance of graph neural networks for fraud detection, we ran several experiments on a proprietary real-world credit card fraud dataset (Fraud I) and a large synthetic fraud dataset (Fraud II).

  • FRAUD I: This dataset contains 3,724,348 credit card transactions between 1,325,070 cardholders and 144,439 merchants. The dataset spans six weeks and contains 0.65% fraudulent transactions.
  • FRAUD II: Like FRAUD I, this synthetic dataset contains 1959 cardholders and 56,545 merchants. The synthetic dataset was introduced in (Altman 2021). FRAUD II characterizes US-based cardholders spending domestically and globally from 2016 to 2020.

The network consists of cardholders, merchants, and transaction nodes (see Figure 2). As a baseline, we applied a boosted trees classifier XGBoost to the raw transaction features. The GNN model is inspired by GraphSAGE but introduces several adaptations tailored to fraud detection (Liu et al. 2020; Dou et al. 2020). Table 1 depicts the F1 Score and the area under the Precision-Recall curve (or AUC-PR).

Figure 2 Network structure for fraud detection

Table 1 Classification performance for Fraud I and Fraud II

  F1 Score AUC-PR
  Avg Std Avg Std
Fraud I        
GNN 0.70 0.14 0.60 0.20
XGBoost 0.22 0.11 0.12 0.09
Fraud II
GNN 0.73 0.13 0.78 0.15
XGBoost 0.66 0.29 0.63 0.33


  • Altman, Erik. 2021. “Synthesizing Credit Card Transactions.” In Proceedings of the Second ACM International Conference on AI in Finance, 1–9. ICAIF ’21 13. New York, NY, USA: Association for Computing Machinery.
  • Baesens, Bart, Veronique Van Vlasselaer, and Wouter Verbeke. 2015. Fraud Analytics Using Descriptive, Predictive, and Social Network Techniques: A Guide to Data Science for Fraud Detection. John Wiley & Sons.
  • Bolton, Richard J., and David J. Hand. 2002. “Statistical Fraud Detection: A Review.” Statistical Science: A Review Journal of the Institute of Mathematical Statistics 17 (3): 235–55.
  • “Card Fraud Losses Reach $28.65 Billion.” n.d. Accessed December 8, 2022.
  • Dou, Yingtong, Zhiwei Liu, Li Sun, Yutong Deng, Hao Peng, and Philip S. Yu. 2020. “Enhancing Graph Neural Network-Based Fraud Detectors against Camouflaged Fraudsters.” In Proceedings of the 29th ACM International Conference on Information & Knowledge Management, translated by ACM SIGIR; ACM SIGWEB, 315–24. CIKM ’20. New York, NY, USA: Association for Computing Machinery.
  • Hamilton, William L. 2020. “Graph Representation Learning.” Synthesis Lectures on Artificial Intelligence and Machine Learning 14 (3): 1–159.
  • Koutra, Danai, Tai-You Ke, U. Kang, Duen Horng Polo Chau, Hsing-Kuo Kenneth Pao, and Christos Faloutsos. 2011. “Unifying Guilt-by-Association Approaches: Theorems and Fast Algorithms,” September, 245–60.
  • Liu, Zhiwei, Yingtong Dou, Philip S. Yu, Yutong Deng, and Hao Peng. 2020. “Alleviating the Inconsistency Problem of Applying Graph Neural Network to Fraud Detection.” Translated by ACM Special Interest Group on Information Retrieval (SIGIR). ArXiv [Cs.SI]. arXiv.
  • Newman, Mark. 2018. Networks. Oxford University Press.