Lune

ICML2022顶会

On Distribution Shift in Learning-based Bug Detectors

Jingxuan He, Luca Beurer-Kellner, Martin T. Vechev

摘要

Deep learning has recently achieved initial success in program analysis tasks such as bug detection. Lacking real bugs, most existing works construct training and test data by injecting synthetic bugs into correct programs. Despite achieving high test accuracy (e.g., >90%), the resulting bug detectors are found to be surprisingly unusable in practice, i.e., <10% precision when used to scan real software repositories. In this work, we argue that this massive performance difference is caused by a distribution shift, i.e., a fundamental mismatch between the real bug distribution and the synthetic bug distribution used to train and evaluate the detectors. To address this key challenge, we propose to train a bug detector in two phases, first on a synthetic bug distribution to adapt the model to the bug detection domain, and then on a real bug distribution to drive the model towards the real distribution. During these two phases, we leverage a multi-task hierarchy, focal loss, and contrastive learning to further boost performance. We evaluate our approach extensively on three widely studied bug types, for which we construct new datasets carefully designed to capture the real bug distribution. The results demonstrate that our approach is practically effective and successfully mitigates the distribution shift: our learned detectors are highly performant on both our test set and the latest version of open source repositories. Our code, datasets, and models are publicly available at https://github.com/eth-sri/ learning-real-bug-detector .

问 Lune

几分钟读透这篇 Paper,不用再花一下午。

Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。

已有 10 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。

可以从这些问题问起

Lune 可以查阅

全文 · 引用它的顶会 Paper · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

  • Large Language Models of Code Fail at Completing Code with Potential Bugs 引用了 Global Relational Models of Source Code
  • OctoPack: Instruction Tuning Code Large Language Models 引用了 Global Relational Models of Source Code
  • CodeBERT: A Pre-Trained Model for Programming and Natural Languages 引用了 Learning and Evaluating Contextual Embedding of Source Code
  • Learning and Evaluating Contextual Embedding of Source Code 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • Learning and Evaluating Contextual Embedding of Source Code 引用了 Global Relational Models of Source Code
  • Data Quality for Software Vulnerability Datasets 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • Large Language Models for Code: Security Hardening and Adversarial Testing 引用了 Data Quality for Software Vulnerability Datasets
  • Large Language Models for Code: Security Hardening and Adversarial Testing 引用了 WILDS: A Benchmark of in-the-Wild Distribution Shifts
  • Uncovering the Limits of Machine Learning for Automatic Vulnerability Detection 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

引用它的顶会 Paper10

  1. OctoPack: Instruction Tuning Code Large Language ModelsNiklas Muennighoff, Qian Liu, Armel Randy Zebaze, Qinkai Zheng 等ICLR 2024 · 203 次引用
  2. Data Quality for Software Vulnerability DatasetsRoland Croft, Muhammad Ali Babar, M. Mehdi KholoosiICSE 2023 · 138 次引用
  3. Large Language Models for Code: Security Hardening and Adversarial TestingJingxuan He, Martin T. VechevCCS 2023 · 98 次引用
  4. Uncovering the Limits of Machine Learning for Automatic Vulnerability DetectionNiklas Risse, Marcel BöhmeUSENIX Security 2024 · 63 次引用
  5. Large Language Models of Code Fail at Completing Code with Potential BugsTuan Dinh, Jinman Zhao, Samson Tan, Renato Negrinho 等NeurIPS 2023 · 59 次引用

它引用的 Paper20

  1. CodeBERT: A Pre-Trained Model for Programming and Natural LanguagesZhangyin Feng, Daya Guo, Duyu Tang, Nan Duan 等EMNLP Findings 2020 · 2,828 次引用
  2. WILDS: A Benchmark of in-the-Wild Distribution ShiftsPang Wei Koh, Shiori Sagawa, Henrik Marklund, Sang Michael Xie 等ICML 2021 · 1,773 次引用
  3. Dice Loss for Data-imbalanced NLP TasksXiaoya Li, Xiaofei Sun, Yuxian Meng, Junjun Liang 等ACL 2020 · 575 次引用
  4. Learning and Evaluating Contextual Embedding of Source CodeAditya Kanade, Petros Maniatis, Gogul Balakrishnan, Kensen ShiICML 2020 · 438 次引用
  5. Global Relational Models of Source CodeVincent J. Hellendoorn, Charles Sutton, Rishabh Singh, Petros Maniatis 等ICLR 2020 · 252 次引用

相关 Paper

  1. How to Train Your Neural Bug Detector: Artificial vs Real BugsCedric Richter, Heike WehrheimASE 2023 · 5 次引用
  2. CLeVeR: Multi-modal Contrastive Learning for Vulnerability Code RepresentationJiayuan Li, Lei Cui, Sen Zhao, Yun Yang 等ACL Findings 2025 · 4 次引用
  3. Robust Learning of Deep Predictive Models from Noisy and Imbalanced Software Engineering DatasetsZhong Li, Minxue Pan, Yu Pei, Tian Zhang 等ASE 2022 · 10 次引用
  4. Finding Bugs Using Your Own Code: Detecting Functionally-similar yet Inconsistent CodeMansour Ahmadi, Reza Mirzazade Farkhani, Ryan Williams, Long LuUSENIX Security 2021 · 41 次引用
  5. Self-Supervised Bug Detection and RepairMiltiadis Allamanis, Henry Jackson-Flux, Marc BrockschmidtNeurIPS 2021 · 145 次引用
黄昏的海面,两侧是细线勾勒的悬崖