Enhancing Heterogeneous Temporal Graph Neural Network with Bidirectional Multi-Scale Attention and Adaptive Loss for Real-Time Fraud Detection in Electronic Commerce

M Yahaya, A. O. Isah, S. O. Subairu, M. D. Noel, S. Ahmad

Abstract


The rapid expansion of electronic commerce has been accompanied by a corresponding rise in sophisticated transaction fraud, with global losses estimated in the hundreds of billions of dollars annually and Nigerian financial institutions alone recording 52.26 billion in fraud losses in 2024. Conventional fraud detection approaches, including rule-based systems and standard machine learning classifiers, treat transactions independently and therefore fail to capture the relational and temporal dependencies that characterise coordinated fraud schemes. Recent Heterogeneous Temporal Graph Neural Networks (HTGNNs) address this gap by jointly modelling spatial, temporal, and semantic relationships among transactions, cardholders, merchants, and devices, but existing formulations remain limited by unidirectional temporal encoders and loss functions that are poorly suited to severe class imbalance. This paper proposes an Enhanced Heterogeneous Temporal Graph Neural Network (E-HTGNN) that extends the baseline HTGNN architecture of Nguyen and Le (2025) through four architectural enhancements: richer behavioural feature engineering, bidirectional heterogeneous graph modelling with edge-aware message passing, a multi-scale temporal encoder combining Bidirectional LSTM and Transformer components, and an adaptive focal-loss objective for class-imbalance handling. The model was implemented on a GPU-accelerated Kaggle environment and evaluated on the PaySim synthetic mobile-money dataset and the real-world IEEE-CIS Fraud Detection dataset using AUC-ROC, PR-AUC, precision, recall, F1-score, and inference latency. On the imbalanced PaySim test set, E-HTGNN achieved an AUC-ROC of 0.9951 and PR-AUC of 0.8876, substantially outperforming the strongest reported baseline (HTGNN 2-hop: AUC-ROC 0.956, PR-AUC 0.682), while sustaining an inference latency of 1.87 ms per transaction. On the more challenging real-world IEEE-CIS dataset, the model attained an AUC-ROC of 0.841 and PR-AUC of 0.594, establishing a strong reference point for future work. These results confirm that combining bidirectional temporal encoding, entity-type-aware graph construction, and adaptive loss functions yields measurable gains in fraud detection accuracy without sacrificing real-time applicability. 


Full Text:

PDF

References


Ahmad, F., Joy, K., & Simpao, S. (2025). E-Commerce Fraud Perceptions in Pakistan and Impacts of Risks and Preventive Measures. ITQAN: Journal of Islamic Economics, 4(1).

Alarfaj, A., et al. (2022). Deep Learning-Based Fraud Detection in E-commerce.

Ananthu, S., Sethumadhavan, N., & Narayanan Ag, H. (2021). Credit Card Fraud Detection using Apache Spark Analysis. Proceedings of the 5th International Conference on Trends in Electronics and Informatics, ICOEI 2021, 998–1002.

Baltrušaitis, T., Ahuja, C., & Morency, L. P. (2019). Multimodal machine learning: A survey and taxonomy. IEEE Transactions on Pattern Analysis and Machine Intelligence, 41(2), 423–443.

Byrapu Reddy, S. R., Kanagala, P., Ravichandran, P., Pulimamidi, D. R., Sivarambabu, P. V., & Polireddi, N. S. A. (2024). Effective fraud detection in e-commerce: Leveraging machine learning and big data analytics. Measurement: Sensors, 33, 101138.

Charles, E., Nanduri, J., Jia, Y., Oka, A., & Beaver, J. (n.d.). A Review of Financial Fraud Detection in E-Commerce Using Machine Learning.

Dou, W., et al. (2020). Dynamic Graph Neural Networks for Fraud Detection.

Elly, A., Robert, A., Mabaso, F., & Oladele, S. (n.d.). Developing a Framework for Real-Time Fraud Detection in E-Commerce.

Goyal, G., Tyagi, R., & Tyagi, S. (2024). Graph Neural Networks for Fraud Detection in E-commerce Transactions. 2024 International Conference on Computing, Sciences and Communications (ICCSC), 1–6.

He, T. (n.d.). Dynamic E-commerce Solution for Real-Time Detection of Credit Card Fraud.

Hilal, W., Gadsden, S. A., & Yawney, J. (2022). Financial Fraud: A Review of Anomaly Detection Techniques and Recent Advances. Expert Systems with Applications, 193.

Hu, Z., Dong, Y., Wang, K., & Sun, Y. (2020). Heterogeneous graph transformer. Proceedings of The Web Conference (WWW), 2704–2710.

Juniper Research. (2023). Online payment fraud: Market forecasts, emerging threats & segment analysis 2023–2028. Juniper Research.

Kipf, T. N., & Welling, M. (2017). Semi-supervised classification with graph convolutional networks. International Conference on Learning Representations (ICLR).

Kumah, R., Han, S., Okunola, A., & Mondal, S. (n.d.). Designing an Intuitive Real-Time Financial Fraud Detection System for Non-Technical Users.

Liu, J., Gu, X., & Shang, C. (2020). Quantitative Detection of Financial Fraud Based on Deep Learning with Combination of E-Commerce Big Data. Complexity, 2020.

Liu, T., et al. (2020). GNN-Based Approach for Transaction Fraud.

Liu, J., Zhang, X., & Zhao, Y. (2022). Dynamic graph learning for fraud detection in financial transactions. Expert Systems with Applications, 192, 116312.

Lu, Y., et al. (2021). Graph Neural Networks in Real-Time Fraud Detection with Lambda Architecture. arXiv:2110.04559.

Mat Taupit, A. S., & Azizan, N. (2023). The Planning Process of the Online Transaction Fraud Detection Using Backlogging on an E-Commerce Website. Malaysian Journal of Science Health & Technology, 9(1), 56–62.

Momoh, M. O., Shobowale, K. O., Abubakar, Z. M., Yahaya, B., & Yusuf, I. (2022). Blockchain adoption in aviation: Opportunities and challenges. International Journal of Electrical Engineering and Computing, 6(2), 92-97.

Mutemi, A., & Bação, F. (2024). E-Commerce Fraud Detection Based on Machine Learning Techniques: Systematic Literature Review. Big Data Mining and Analytics, 7(2), 419–444.

Nasdaq. (2024). Nasdaq Verafin 2024 global financial crime report. Nasdaq, Inc.

Nguyen, H., & Le, B. (2025). Real-time transaction fraud detection via heterogeneous temporal graph neural network. Proceedings of the 17th International Conference on Agents and Artificial Intelligence (ICAART 2025), Vol. 2, 364–375. SCITEPRESS.

Nwankwo, W., Chinedu, P. U., Daniel, A., Shaba, S. M., Muyideen, M. O., Nwankwo, C. P., ... & Uwadia, F. (2022, November). Educational fintech: Promoting stakeholder confidence through automatic incidence resolution. In The International Symposium on Computer Science, Digital Economy and Intelligent Systems (pp. 947-963). Cham: Springer Nature Switzerland.

Okofu, S. N., Maureen, A., Ako, R. E., & Ojugo, A. A. (n.d.). Improving Customer Trust through Fraud Prevention E-Commerce Model.

Rossi, E., Chamberlain, B., Frasca, F., Eynard, D., Monti, F., & Bronstein, M. (2020). Temporal graph networks for deep learning on dynamic graphs. arXiv:2006.10637.

Ryu, J., Kim, S., & Lee, H. (2023). Graph-based anomaly detection for e-commerce fraud prevention. IEEE Access, 11, 44212–44225.

Sarma, W., & Dey, S. (2021). AI and Machine Learning in Fraud Detection for Finance and E-Commerce. International Journal of Innovative Research in Computer and Communication Engineering, 9(10).

Suardiman, N., Sudimanto, Dhanny, S., Tjahjadi, D., Permana, B., & Ukar, K. (2024). E-Commerce Fraud Detection Using Generated Data From BANKSIM Using Machine Learning Approach: A Pilot Study. Proceedings of the 2024 18th International Conference on Ubiquitous Information Management and Communication (IMCOM 2024).

Tang, J., Li, X., Wang, Y., & Liu, H. (2022). Multimodal fraud detection using heterogeneous networks. ACM Transactions on Knowledge Discovery from Data, 16(8), 1–22.

Trinh, T. K., & Wang, Z. (2024). Dynamic graph neural networks for multi-level financial fraud detection: A temporal-structural approach. Annals of Applied Sciences, 5(1).

Venkatesan, K. B., Ramachandran, G. S., & Ramakrishnan, G. (2025). Scalable Machine Learning Models Achieving Efficiency in Fraud Detection. 4th International Conference on Sentiment Analysis and Deep Learning (ICSADL 2025), 1230–1235.

Wang, Y., Zhao, L., & Chen, D. (2023). Temporal graph-based fraud detection in digital payment networks. Neurocomputing, 532, 150–164.

Wei, C., Zhang, F., & Hu, J. (2022). Synthetic data generation for fraud detection using adversarial networks. Information Sciences, 600, 375–391.

Yu, J., Wang, H., Wang, X., Li, Z., Qin, L., Zhang, W., Liao, J., Zhang, Y., & Yang, B. (2024). Temporal Insights for Group-Based Fraud Detection on e-Commerce Platforms. IEEE Transactions on Knowledge and Data Engineering.

Zakaria, R. M., Rahman, M. M., Hossain Choudhury, M. T., Rahman, H., & Rafi, M. A. (2025). Detecting financial fraud in real-time transactions using graph neural networks and anomaly detection techniques. Journal of Economics, Finance and Accounting Studies, 7(6), 01–13.

Zhang, Y., Liu, T., & Wang, X. (2023). Deep learning-based fraud detection in e-commerce: A comprehensive review. ACM Computing Surveys, 55(12), 1–35.


Refbacks

  • There are currently no refbacks.