Learning Defect Prediction from Unrealistic Data
Not on the map. Why?
Abstract (arXiv)
Pretrained models of code, such as CodeBERT and CodeT5, have become popular choices for code understanding and generation tasks. Such models tend to be large and require commensurate volumes of training data, which are rarely available for downstream tasks. Instead, it has become popular to train models with far larger but less realistic datasets, such as functions with artificially injected bugs. Models trained on such data, however, tend to only perform well on similar data, while underperforming on real world programs. In this paper, we conjecture that this discrepancy stems from the presence of distracting samples that steer the model away from the real-world task distribution. To investigate this conjecture, we propose an approach for identifying the subsets of these large yet unrealistic datasets that are most similar to examples in real-world datasets based on their learned representations. Our approach extracts high-dimensional embeddings of both real-world and artificial programs using a neural model and scores artificial samples based on their distance to the nearest real-world sample. We show that training on only the nearest, representationally most similar samples while discarding samples that are not at all similar in representations yields consistent improvements across two popular pretrained models of code on two code understanding tasks. Our results are promising, in that they show that training models on a representative subset of an unrealistic dataset can help us harness the power of large-scale synthetic data generation while preserving downstream task performance. Finally, we highlight the limitations of applying AI models for predicting vulnerabilities and bugs in real-world applications
Key facts. Cited by 5 papers in the map (data through 14 Oct 2026). Builds on 26 of its 47 references that are in the map. First posted on arXiv 2 Nov 2023.
Builds on
26 of 47 references.
References · 26
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,599
- 2020Scaling Laws for Neural Language Modelscited by 6,586
- 2017Billion-scale similarity search with GPUscited by 2,497
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 906
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 744
- 2014Distributed Representations of Sentences and Documentscited by 678
- 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 654
- 2022Beyond neural scaling laws: beating power law scaling via data pruningcited by 528
- 2021Unified Pre-training for Program Understanding and Generationcited by 366
14 more
- 2019Devign: Effective Vulnerability Identification by Learning Comprehensive Program Semantics via Graph Neural Networkscited by 272
- 2017Learning to Represent Programs with Graphscited by 220
- 2020Deep Learning based Vulnerability Detection: Are We There Yet?cited by 144
- 2018The Adverse Effects of Code Duplication in Machine Learning Models of Codecited by 126
- 2018Automated Vulnerability Detection in Source Code Using Deep Representation Learningcited by 114
- 2018DeepBugs: A Learning Approach to Name-based Bug Detectioncited by 65
- 2018Generative Code Modeling with Graphscited by 60
- 2021Self-Supervised Bug Detection and Repaircited by 59
- 2020A Survey on Contextual Embeddingscited by 48
- 2019Neural Program Repair by Jointly Learning to Localize and Repaircited by 40
- 2019How Often Do Single-Statement Bugs Occur? The ManySStuBs4J Datasetcited by 36
- 2018The Impact of Class Rebalancing Techniques on the Performance and Interpretation of Defect Prediction Modelscited by 29
- 2022On Distribution Shift in Learning-based Bug Detectorscited by 15
- 2022On the Use of Fine-grained Vulnerable Code Statements for Software Vulnerability Assessment Modelscited by 5
Built on by
Citing papers per year: 2023: 2; 2024: 3.
5 papers.
- 2024Generating CAD Code with Vision-Language Models for 3D Designscited by 62
- 2024LLMs in Web Development: Evaluating LLM-Generated PHP Code Unveiling Vulnerabilities and Limitationscited by 22
- 2023Language Models are Better Bug Detector Through Code-Pair Classificationcited by 3
- 2023Can LLMs Patch Security Issues?cited by 3
- 2024The Power of Types: Exploring the Impact of Type Checking on Neural Bug Detection in Dynamically Typed Languagescited by 1
- 2024The Power of Types: Exploring the Impact of Type Checking on Neural Bug Detection in Dynamically Typed Languages22 Nov 2024
- 2024Generating CAD Code with Vision-Language Models for 3D Designs7 Oct 2024
- 2024LLMs in Web Development: Evaluating LLM-Generated PHP Code Unveiling Vulnerabilities and Limitations21 Apr 2024
- 2023Language Models are Better Bug Detector Through Code-Pair Classification14 Nov 2023
- 2023Can LLMs Patch Security Issues?13 Nov 2023