Taught by the Flawed: How Dataset Insecurity Breeds Vulnerable AI Code
Catherine Xia, Manar H. Alalfi

TL;DR
This paper demonstrates that training AI code generators on datasets curated to exclude vulnerabilities significantly reduces security flaws in generated code without sacrificing correctness.
Contribution
The study introduces a method for filtering training data to improve the security of AI-generated code and empirically shows its effectiveness.
Findings
Models trained on secure datasets produce less vulnerable code.
Curated datasets do not compromise code correctness.
Secure training data enhances AI code assistant reliability.
Abstract
AI programming assistants have demonstrated a tendency to generate code containing basic security vulnerabilities. While developers are ultimately responsible for validating and reviewing such outputs, improving the inherent quality of these generated code snippets remains essential. A key contributing factor to insecure outputs is the presence of vulnerabilities in the training datasets used to build large language models (LLMs). To address this issue, we propose curating training data to include only code that is free from detectable vulnerabilities. In this study, we constructed a secure dataset by filtering an existing Python corpus using a static analysis tool to retain only vulnerability-free functions. We then trained two transformer-based models: one on the curated dataset and one on the original, unfiltered dataset. The models were evaluated on both the correctness and security…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsAdversarial Robustness in Machine Learning · Advanced Malware Detection Techniques · Software Engineering Research
