• Home
  • Search
  • VISION: Robust and Interpretable Code Vulnerability Detection Leveraging Counterfactual Augmentation
  • Cite Icon3
  • https://doi.org/10.1609/aies.v8i1.36592Copy DOI Icon

VISION: Robust and Interpretable Code Vulnerability Detection Leveraging Counterfactual Augmentation

  • Abstract
  • Literature Map
  • Citations
  • Similar Papers
Abstract

Automated detection of vulnerabilities in source code is an essential cybersecurity challenge, underpinning trust in digital systems and services. Graph Neural Networks (GNNs) have emerged as a promising approach as they can learn the structural and logical code relationships in a data-driven manner. However, the performance of GNNs is severely limited by training data imbalances and label noise. GNNs can often learn “spurious” correlations due to superficial code similarities in the training data, leading to detectors that do not generalize well to unseen real-world data. In this work, we propose a new unified framework for robust and interpretable vulnerability detection—that we call VISION—to mitigate spurious correlations by systematically augmenting a counterfactual training dataset. Counterfactuals are samples with minimal semantic modifications that have opposite prediction labels. Our complete framework includes: (i) generating effective counterfactuals by prompting a Large Language Model (LLM); (ii) targeted GNN model training on synthetically paired code examples with opposite labels; and (iii) graph-based interpretability to identify the truly crucial code statements relevant for vulnerability predictions while ignoring the spurious ones. We find that our framework reduces spurious learning and enables more robust and generalizable vulnerability detection, as demonstrated by improvements in overall accuracy (from 51.8% to 97.8%), pairwise contrast accuracy (from 4.5% to 95.8%), and worst-group accuracy increasing (from 0.7% to 85.5%) on the widely popular Common Weakness Enumeration (CWE)-20 vulnerability. We also demonstrate improvements using our proposed metrics, namely, intra-class attribution variance, inter-class attribution distance, and node score dependency. We provide a new benchmark for vulnerability detection, CWE-20-CFA, comprising 27,556 samples from functions affected by the high-impact and frequently occurring CWE-20 vulnerability, including both real and counterfactual examples. Furthermore, our approach enhances societal objectives of transparent and trustworthy AI-based cybersecurity systems through interactive visualization for human-in-the-loop analysis.

Similar Papers
  • Research Article
  • Citations1

Go Source Code Vulnerability Detection Method Based on Graph Neural Network

  • Jun 10, 2025
  • Applied Sciences
  • Lisha Yuan +4
  • Conference Article
  • Citations8

Code Vulnerability Identification and Code Improvement using Advanced Machine Learning

  • Dec 01, 2019
  • Laneesha Ruggahakotuwa +2
  • Research Article
  • Citations219

BGNN4VD: Constructing Bidirectional Graph Neural-Network for Vulnerability Detection

  • Mar 20, 2021
  • Information and Software Technology
  • Sicong Cao +4
  • Research Article
  • Citations2

Towards Secure Code Generation With LLMs: A Study on Common Weakness Enumeration

  • Dec 01, 2025
  • IEEE Transactions on Software Engineering
  • Jianguo Zhao +6
  • Conference Article
  • Citations12

Automatic Identification of Vulnerable Code: Investigations with an AST-Based Neural Network

  • Jul 01, 2021
  • Garrett Partenza +4
  • Conference Article
  • Citations11

A smart contract vulnerability detection model based on graph neural networks

  • Dec 02, 2022
  • Daojun Han +3
  • Conference Article
  • Citations10

Can explainability and deep-learning be used for localizing vulnerabilities in source code?

  • Apr 15, 2024
  • Alessandro Marchetto
  • Research Article
  • Citations5

Source Code Vulnerability Detection Based on Joint Graph and Multimodal Feature Fusion

  • Feb 28, 2025
  • Electronics
  • Dun Jin +4
  • Research Article

DeepSeek-Rl Family Large Language Models in the Tasks of Identification, Classification, and Detection of Vulnerabilities from the CWE Top 25 List

  • Mar 18, 2026
  • PROGRAMMNAYA INGENERIA
  • V V Shvyrov +2
  • Book Chapter
  • Citations1

Are Textual Prompts in Large Language Models Sufficient for Vulnerability Detection?

  • Jun 27, 2025
  • Puya Pakshad +1
  • Research Article
  • Citations40

Vulnerability Detection via Multiple-Graph-Based Code Representation

  • Aug 01, 2024
  • IEEE Transactions on Software Engineering
  • Fangcheng Qiu +5
  • Research Article
  • Citations1

Modern Approaches to Software Vulnerability Detection: A Survey of Machine Learning, Deep Learning, and Large Language Models

  • Nov 14, 2025
  • Electronics
  • Md Shazzad Hossain Shaon +1
  • PDF
  • Research Article
  • Citations22

VulEye: A Novel Graph Neural Network Vulnerability Detection Approach for PHP Application

  • Jan 06, 2023
  • Applied Sciences
  • Chun Lin +3
  • Research Article
  • Citations70

Large Language Model for Vulnerability Detection and Repair: Literature Review and the Road Ahead

  • May 27, 2025
  • ACM Transactions on Software Engineering and Methodology
  • Xin Zhou +3
  • Research Article

Fortifying Robustness in Graph Neural Networks: A Loss Correction Approach to Mitigate Label Noise.

  • Mar 10, 2026
  • IEEE transactions on neural networks and learning systems
  • I-Chung Hsieh +1
Cactus Communications logo

Copyright 2026 Cactus Communications. All rights reserved.