Joint Geometrical and Statistical Domain Adaptation for Cross-domain Code Vulnerability Detection
Qianjin Du, Shiji Zhou, Xiaohui Kuang, Gang Zhao, Jidong Zhai
Abstract
In code vulnerability detection tasks, a detector trained on a label-rich source domain fails to provide accurate prediction on new or unseen target domains due to the lack of labeled training data on target domains. Previous studies mainly utilize domain adaptation to perform cross-domain vulnerability detection. But they ignore the negative effect of private semantic characteristics of the target domain for domain alignment, which easily causes the problem of negative transfer. In addition, these methods forcibly reduce the distribution discrepancy between domains and do not take into account the interference of irrelevant target instances for distributional domain alignment, which leads to the problem of excessive alignment. To address the above issues, we propose a novel cross-domain code vulnerability detection framework named MN-CRI. Specifically, we introduce mutual nearest neighbor contrastive learning to align the source domain and target domain geometrically, which could align the common semantic characteristics of two domains and separate out the private semantic characteristics of each domain. Furthermore, we introduce an instance re-weighting scheme to alleviate the problem of excessive alignment. This scheme dynamically assign different weights to instances, reducing the contribution of irrelevant instances so as to achieve better domain alignment. Finally, extensive experiments demonstrate that MNCRI significantly outperforms state-of-the-art cross-domain code vulnerability detection methods by a large margin.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext d7e9bd34-fc4f-4a6d-8fb8-e0dd075075ecCited by top-tier papers1
Ask how each one uses itBuilds on8
- A Simple Framework for Contrastive Learning of Visual RepresentationsTing Chen, Simon Kornblith, Mohammad Norouzi, Geoffrey E. HintonICML 2020 · 24,064 citations
- Supervised Contrastive LearningPrannay Khosla, Piotr Teterwak, Chen Wang, Aaron Sarna et al.NeurIPS 2020 · 7,049 citations
- GraphCodeBERT: Pre-training Code Representations with Data FlowDaya Guo, Shuo Ren, Shuai Lu, Zhangyin Feng et al.ICLR 2021 · 1,644 citations
- CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and GenerationYue Wang, Weishi Wang, Shafiq R. Joty, Steven C. H. HoiEMNLP 2021 · 1,224 citations
- Global Relational Models of Source CodeVincent J. Hellendoorn, Charles Sutton, Rishabh Singh, Petros Maniatis et al.ICLR 2020 · 252 citations
Related papers
- Cross-Domain Graph Anomaly Detection via Anomaly-Aware Contrastive AlignmentQizhou Wang, Guansong Pang, Mahsa Salehi, Wray L. Buntine et al.AAAI 2023 · 51 citations
- Cross-Domain Detection via Graph-Induced Prototype AlignmentMinghao Xu, Hang Wang, Bingbing Ni, Qi Tian et al.CVPR 2020
- CL3D: Unsupervised Domain Adaptation for Cross-LiDAR 3D DetectionXidong Peng, Xinge Zhu, Yuexin MaAAAI 2023 · 37 citations
- Mutual Nearest Neighbor Contrast and Hybrid Prototype Self-Training for Universal Domain AdaptationLiang Chen, Qianjin Du, Yihang Lou, Jianzhong He et al.AAAI 2022 · 33 citations
- Learning Transferable Features for Point Cloud Detection via 3D Contrastive Co-trainingYihan Zeng, Chunwei Wang, Yunbo Wang, Hang Xu et al.NeurIPS 2021 · 36 citations
