AI Code in the Wild: Measuring Security Risks and Ecosystem Shifts of AI-Generated Code in Modern Software
Not on the map. Why?
Abstract (arXiv)
Large language models (LLMs) for code generation are becoming integral to modern software development, but their real-world prevalence and security impact remain poorly understood. We present the first large-scale empirical study of AI-generated code (AIGCode) in the wild. We build a high-precision detection pipeline and a representative benchmark to distinguish AIGCode from human-written code, and apply them to (i) development commits from the top 1,000 GitHub repositories (2022-2025) and (ii) 7,000+ recent CVE-linked code changes. This lets us label commits, files, and functions along a human/AI axis and trace how AIGCode moves through projects and vulnerability life cycles. Our measurements show three ecological patterns. First, AIGCode is already a substantial fraction of new code, but adoption is structured: AI concentrates in glue code, tests, refactoring, documentation, and other boilerplate, while core logic and security-critical configurations remain mostly human-written. Second, adoption has security consequences: some CWE families are overrepresented in AI-tagged code, and near-identical insecure templates recur across unrelated projects, suggesting "AI-induced vulnerabilities" propagated by shared models rather than shared maintainers. Third, in human-AI edit chains, AI introduces high-throughput changes while humans act as security gatekeepers; when review is shallow, AI-introduced defects persist longer, remain exposed on network-accessible surfaces, and spread to more files and repositories. We will open-source the complete dataset and release analysis artifacts and fine-grained documentation of our methodology and findings.
Key facts. Cited by 4 papers in the map (data through 7 Oct 2026). Builds on 34 of its 59 references that are in the map. First posted on arXiv 21 Dec 2025.
Builds on
34 of 59 references.
References · 34
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
- 2023The Impact of AI on Developer Productivity: Evidence from GitHub Copilotcited by 264
- 2022Do Users Write More Insecure Code with AI Assistants?cited by 186
- 2025A Survey on Code Generation with LLM-based Agentscited by 104
- 2022Natural Attack for Pre-trained Models of Codecited by 72
- 2023Evaluating the Code Quality of AI-Assisted Code Generation Tools: An Empirical Study on GitHub Copilot, Amazon CodeWhisperer, and ChatGPTcited by 71
- 2023CodeLMSec Benchmark: Systematically Evaluating and Finding Security Vulnerabilities in Black-Box Code Language Modelscited by 52
- 2023Security Weaknesses of Copilot-Generated Code in GitHub Projects: An Empirical Studycited by 36
- 2024Automatic Programming: Large Language Models and Beyondcited by 35
- 2023Vulnerabilities in AI Code Generators: Exploring Targeted Data Poisoning Attackscited by 29
- 2024CodeIP: A Grammar-Guided Multi-Bit Watermark for Large Language Models of Codecited by 21
22 more
- 2025SecVulEval: Benchmarking LLMs for Real-World C/C++ Vulnerability Detectioncited by 19
- 2024Assessing AI Detectors in Identifying AI-Generated Code: Implications for Educationcited by 18
- 2024Transforming Software Development: Evaluating the Efficiency and Challenges of GitHub Copilot in Real-World Projectscited by 18
- 2024Exploring the Limitations of Detecting Machine-Generated Textcited by 15
- 2025MCPGuard : Automatically Detecting Vulnerabilities in MCP Serverscited by 13
- 2024Just another copy and paste? Comparing the security vulnerabilities of ChatGPT generated code and StackOverflow answerscited by 12
- 2025A.S.E: A Repository-Level Benchmark for Evaluating Security in AI-Generated Codecited by 12
- 2024The Impact of Generative AI on Collaborative Open-Source Software Development: Evidence from GitHub Copilotcited by 11
- 2024LLMs: A Game-Changer for Software Engineers?cited by 11
- 2025Security Degradation in Iterative AI Code Generation -- A Systematic Analysis of the Paradoxcited by 10
- 2025textttDroid: A Resource Suite for AI-Generated Code Detectioncited by 9
- 2016Predicting the Popularity of GitHub Repositoriescited by 6
- 2024Enhancing Security of AI-Based Code Synthesis with GitHub Copilot via Cheap and Efficient Prompt-Engineeringcited by 6
- 2024ChatGPT Code Detection: Techniques for Uncovering the Source of Codecited by 6
- 2025CodeMirage: A Multi-Lingual Benchmark for Detecting AI-Generated and Paraphrased Source Code from Production-Level LLMscited by 6
- 2025Assessing the Quality and Security of AI-Generated Code: A Quantitative Analysiscited by 5
- 2025RefleXGen:The unexamined code is not worth usingcited by 4
- 2025Is Your Prompt Poisoning Code? Defect Induction Rates and Security Mitigation Strategiescited by 3
- 2025A Rigorous Turing Test: a Foundation for Evaluating Artificial General Intelligencecited by 2
- 2025MultiAIGCD: A Comprehensive dataset for AI Generated Code Detection Covering Multiple Languages, Models,Prompts, and Scenarioscited by 2
- 2025The Hidden DNA of LLM-Generated JavaScript: Structural Patterns Enable High-Accuracy Authorship Attributioncited by 2
- 2024Enhancing Source Code Classification Effectiveness via Prompt Learning Incorporating Knowledge Featurescited by 1
Built on by
Citing papers per year: 2026: 4.
4 papers.
- 2026Correct Code, Vulnerable Dependencies: A Large Scale Measurement Study of LLM-Specified Library Versionscited by 1
- 2026The Substrate Collapse: AI Code Generation Invalidates Authorship-Based Knowledge Metricscited by 0
- 2026Activation Probes Surface Code-Security Signals that the Model's Output Missescited by 0
- 2026Generation of Web Apps with Agentic IDEs: An Empirical Assessmentcited by 0
- 2026Generation of Web Apps with Agentic IDEs: An Empirical Assessment21 Aug 2026
- 2026Activation Probes Surface Code-Security Signals that the Model's Output Misses10 Aug 2026
- 2026The Substrate Collapse: AI Code Generation Invalidates Authorship-Based Knowledge Metrics18 Jun 2026
- 2026Correct Code, Vulnerable Dependencies: A Large Scale Measurement Study of LLM-Specified Library Versions7 May 2026