Towards Causal Deep Learning for Vulnerability Detection
Not on the map. Why?
Abstract (arXiv)
Deep learning vulnerability detection has shown promising results in recent years. However, an important challenge that still blocks it from being very useful in practice is that the model is not robust under perturbation and it cannot generalize well over the out-of-distribution (OOD) data, e.g., applying a trained model to unseen projects in real world. We hypothesize that this is because the model learned non-robust features, e.g., variable names, that have spurious correlations with labels. When the perturbed and OOD datasets no longer have the same spurious features, the model prediction fails. To address the challenge, in this paper, we introduced causality into deep learning vulnerability detection. Our approach CausalVul consists of two phases. First, we designed novel perturbations to discover spurious features that the model may use to make predictions. Second, we applied the causal learning algorithms, specifically, do-calculus, on top of existing deep learning models to systematically remove the use of spurious features and thus promote causal based prediction. Our results show that CausalVul consistently improved the model accuracy, robustness and OOD performance for all the state-of-the-art models and datasets we experimented. To the best of our knowledge, this is the first work that introduces do calculus based causal learning to software engineering models and shows it's indeed useful for improving the model accuracy, robustness and generalization. Our replication package is located at https://figshare.com/s/0ffda320dcb96c249ef2.
Key facts. Cited by 9 papers in the map (data through 14 Oct 2026). Builds on 20 of its 29 references that are in the map. First posted on arXiv 12 Oct 2023.
Builds on
20 of 29 references.
References · 20
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 744
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 609
- 2021Unified Pre-training for Program Understanding and Generationcited by 366
- 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 361
- 2019Devign: Effective Vulnerability Identification by Learning Comprehensive Program Semantics via Graph Neural Networkscited by 272
- 2020Deep Learning based Vulnerability Detection: Are We There Yet?cited by 144
- 2022ReCode: Robustness Evaluation of Code Generation Modelscited by 103
- 2022NatGen: Generative pre-training by "Naturalizing" source codecited by 54
- 2020Self-Supervised Contrastive Learning for Code Retrieval and Summarization via Semantic-Preserving Transformationscited by 49
- 2022An Empirical Study of Deep Learning Models for Vulnerability Detectioncited by 46
8 more
- 2022LineVD: Statement-level Vulnerability Detection using Graph Neural Networkscited by 35
- 2023TRACED: Execution-aware Pre-training for Source Codecited by 27
- 2021Counterfactual Explanations for Models of Codecited by 25
- 2022Causal Transportability for Visual Recognitioncited by 23
- 2021Towards Learning (Dis)-Similarity of Source Code from Program Contrastscited by 17
- 2022Unicorn: Reasoning about Configurable System Performance through the lens of Causalitycited by 12
- 2022MVD: Memory-Related Vulnerability Detection Based on Flow-Sensitive Graph Neural Networkscited by 12
- 2021Detecting Multi-Sensor Fusion Errors in Advanced Driver-Assistance Systemscited by 8
Built on by
Citing papers per year: 2023: 2; 2024: 3; 2025: 4.
9 papers.
- 2023Unifying the Perspectives of NLP and Software Engineering: A Survey on Language Models for Codecited by 62
- 2024Top Score on the Wrong Exam: On Benchmarking in Machine Learning for Vulnerability Detectioncited by 28
- 2023Pitfalls in Language Models for Code Intelligence: A Taxonomy and Surveycited by 9
- 2025A Systematic Literature Review on Detecting Software Vulnerabilities with Large Language Modelscited by 8
- 2025A Language Anchor-Guided Method for Robust Noisy Domain Generalizationcited by 5
- 2024Causal Reasoning in Software Quality Assurance: A Systematic Reviewcited by 3
- 2025CodeSCM: Causal Analysis for Multi-Modal Code Generationcited by 2
- 2024Direction for Detection: A Survey of Automated Vulnerability Detection and all of its Pain Pointscited by 0
- 2025AVIATOR: Towards AI-Agentic Vulnerability Injection Workflow for High-Fidelity, Large-Scale Code Security Datasetcited by 0
- 2025AVIATOR: Towards AI-Agentic Vulnerability Injection Workflow for High-Fidelity, Large-Scale Code Security Dataset28 Aug 2025
- 2025A Systematic Literature Review on Detecting Software Vulnerabilities with Large Language Models30 Jul 2025
- 2025A Language Anchor-Guided Method for Robust Noisy Domain Generalization21 Mar 2025
- 2025CodeSCM: Causal Analysis for Multi-Modal Code Generation7 Feb 2025
- 2024Direction for Detection: A Survey of Automated Vulnerability Detection and all of its Pain Points15 Dec 2024
- 2024Causal Reasoning in Software Quality Assurance: A Systematic Review30 Aug 2024
- 2024Top Score on the Wrong Exam: On Benchmarking in Machine Learning for Vulnerability Detection23 Aug 2024
- 2023Unifying the Perspectives of NLP and Software Engineering: A Survey on Language Models for Code14 Nov 2023
- 2023Pitfalls in Language Models for Code Intelligence: A Taxonomy and Survey27 Oct 2023