The Commonplace
Home Papers Evidence Explore Trends Syntheses Digests References Docs 🎲 Workforce Futures
← Papers
Direction, evidence grade, and study type are AI-generated labels (gpt-5-mini), not human-verified. Syntheses are LLM-written. "Tensions" are machine-detected candidates, not confirmed contradictions. A research-acceleration tool, not peer review. How this is built →

AI-generated code is already common in new open-source contributions—mostly in boilerplate and tests—but certain classes of insecure templates are overrepresented and can spread across projects when human review is cursory.

AI Code in the Wild: Measuring Security Risks and Ecosystem Shifts of AI-Generated Code in Modern Software
Bin Wang, Wenjie Yu, Yilu Zhong, Hao Yu, Keke Lian, Chaohua Lu, Hongfang Zheng, Dong Zhang, Hui Li · December 21, 2025
arxiv descriptive medium evidence 8/10 relevance Full text usable extracted full text Source PDF

Structured author observations

Linked only from stored provider relations; the raw author line above is never matched by name.

Arxiv

Latest observation:

  1. Bin Wang unresolved corpus identity
  2. Wenjie Yu unresolved corpus identity
  3. Yilu Zhong unresolved corpus identity
  4. Hao Yu unresolved corpus identity
  5. Keke Lian unresolved corpus identity
  6. Chaohua Lu unresolved corpus identity
  7. Hongfang Zheng unresolved corpus identity
  8. Dong Zhang unresolved corpus identity
  9. Hui Li unresolved corpus identity

Semantic Scholar

Latest observation:

  1. Bin Wang provider ID
  2. Wenjie Yu provider ID
  3. YiLu Zhong provider ID
  4. Hao Yu provider ID
  5. Keke Lian provider ID
  6. Chaohua Lu provider ID
  7. Hong-Xiang Zheng provider ID
  8. Dong Zhang provider ID
  9. Hui Li provider ID
Using a validated detector on commits from top GitHub repos and CVE-linked edits, the paper finds AI-generated code is already a substantial share of new code—concentrated in boilerplate and tests—while certain vulnerability types and near-identical insecure templates are overrepresented in AI-tagged code and propagate across projects when human review is shallow.

Citation observations

Cumulative provider counts captured on specific dates; providers are never combined.

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.

Summary

Main Finding

AI-generated code (AIGCode) is already a substantial and structured component of modern open-source development. Adoption concentrates in boilerplate areas (glue code, tests, refactorings, docs) rather than core logic or security-critical configs, but AIGCode nonetheless creates distinct security risks: some CWE families are overrepresented, near-identical insecure templates recur across unrelated projects (indicative of model-driven propagation), and AI-driven high-throughput edits expand vulnerability exposure when human review is shallow. The authors build a high-precision ensemble detector and apply it at scale to trace AIGCode through projects and vulnerability life cycles.

Key Points

  • Detection advance: the paper introduces the Cascade–Aggregation (ensemble) detection framework for distinguishing AIGCode from human-written code; the authors will open-source the model, dataset, and analysis artifacts.
  • Benchmark dataset: a large, high-confidence evaluation benchmark with two balanced subsets:
    • Trusted human code: ~40k files from 172 repositories, commits dated 2008–2010 (pre-LLM era) to ensure label purity.
    • Trusted AIGCode: ~40k synthesized files from 11 LLMs across 165 tasks and 33 topics to capture cross-model diversity.
  • Languages & domains: coverage across 10 mainstream programming languages (top: Java, C++, Python) and nine application domains (Web/apps largest share).
  • Complexity measure: a lightweight Lexical Complexity Score (LCS) (counts control-flow statements and logical operators) used to compare complexity distributions; human-written data shows higher incidence of very high-complexity code.
  • Large-scale application: detector applied to (i) development commits in the top 1,000 GitHub repositories (2022–2025) and (ii) 7,000+ CVE-linked code changes to study prevalence and security correlations.
  • Ecological patterns found:
  • Structured adoption: AI is used heavily for copy/boilerplate tasks (glue code, tests, refactors, docs), while core business logic and security-critical config remain predominantly human-authored.
  • Security signals: certain CWE families are overrepresented in AI-tagged code; repeated, near-identical insecure templates appear across unrelated projects, consistent with propagation through shared models rather than shared maintainers.
  • Human-AI edit chains: AI enables high-volume edits; humans often act as gatekeepers, but when reviews are cursory, AI-introduced defects persist longer, remain exposed on network-facing surfaces, and spread across files/repos.
  • Limitations acknowledged: attribution/detection is inherently noisy and adversarially fragile; dataset choices (e.g., human subset time window) and synthesized AI samples may not capture all real-world generation modes.

Data & Methods

  • Detection framework:
    • Cascade–Aggregation ensemble that combines multiple base detectors to improve accuracy and robustness against stylistic variation across models and languages.
    • Compared against seven representative content-detection approaches (transferred from natural-language AIGC detection) and evaluated using multiple metrics (accuracy, precision, recall, etc.).
  • Benchmark construction:
    • Human subset: crawled source files (2008–2010) from high-starred repositories, filtered by file types, total ~40k files.
    • AI subset: structured synthesis of 165 tasks across 33 topics; generated by 11 mainstream closed- and open-source LLMs to capture generation diversity; total ~40k files.
    • Dataset covers 10 languages and nine domains; scanned with CodeQL + LLM-based checks to surface CWE distributions.
  • Complexity metric: Lexical Complexity Score (LCS) = 1 + N_cf + (N_op)/2, where N_cf = control-flow occurrences, N_op = logical operators (language-adapted regex counting).
  • Empirical application:
    • Top-1000 GitHub repositories: labeled commits, files, and functions on a human/AI axis for 2022–2025 to measure penetration and edit chains.
    • CVE-linked changes: analyzed 7,000+ vulnerability-associated code changes to correlate AIGCode presence with specific CWE families and propagation patterns.
  • Analyses performed:
    • Granular measurements across commit→file→function units.
    • CWE frequency comparison between AI-tagged vs. human code.
    • Cross-repository template matching to identify near-identical insecure snippets suggesting model-propagated patterns.
    • Edit-chain analysis to quantify persistence, exposure (network-facing surfaces), and spread across files/repos under varying human review depth.

Implications for AI Economics

  • Labor substitution vs. complementarity:
    • Partial automation: AIGCode concentrates in low-complexity, boilerplate tasks—implying productivity gains for routine work but limited replacement of skilled core-development labor. Expect complementarity: developers focus more on high-complexity design, security, and review.
    • Skill premium shifts: demand and wages may rise for roles emphasizing security review, code-ownership, and systems thinking (human gatekeepers), while routine coding tasks may see reduced marginal value.
  • Firm-level costs and investment:
    • Security externalities: AI-induced vulnerabilities that propagate across unrelated projects create systemic supply-chain risk, increasing expected costs from breaches and remediation. Firms may need to invest more in code provenance, auditing, and security pipelines.
    • Compliance and tooling spend: increased demand for detection, verification, and automated auditing tools (and for insurers’ risk-assessment services). Vendors offering secure, provenance-aware AI code generation or integrated code-audit toolchains may capture significant value.
  • Market structure and concentration:
    • Model-driven correlation risk: if many projects use the same LLMs, a single model’s insecure pattern can cause correlated losses across firms—raising the value of diversified modeling, model certification, or proprietary vetted generation services.
    • Platform advantages: providers that can certify/verify generation provenance or embed security alignment may command premium pricing (or become de facto defaults for enterprise usage).
  • Insurance, liability, and regulation:
    • Insurers: need new actuarial models to price correlated systemic cyber risk from model-driven vulnerabilities; may require proof of provenance, mandatory audits, or minimum review standards.
    • Liability frameworks: findings strengthen the case for regulation or industry standards on provenance, watermarking, mandatory security reviews, and disclosure of model training provenance for high-risk code.
  • Open-source ecosystem effects:
    • Faster code churn but higher systemic vulnerability risk may shift maintainers’ priorities—more time on triage and review, potential contributor fatigue, and higher coordination costs. Projects with strict review workflows may disproportionately attract enterprise adoption.
  • Research and evaluation markets:
    • Growth opportunity for empirical security-as-a-service: continuous scanning for AI-pattern vulnerabilities, cross-repo template detection, and remediation patch markets.
  • Policy-relevant trade-offs:
    • Productivity gains vs. systemic risk: policymakers and firms must balance faster development and lower per-unit coding costs with amplified systemic vulnerability exposure. Interventions (standards, provenance requirements, audit subsidies) can mitigate externalities.

Suggested next economic research directions: quantify net labor-hour savings vs. expected remediation/incident costs; measure wage dynamics for security-focused developer roles; estimate insurer premiums under model-correlated risk; and study adoption differences across firm size, governance regimes, and review intensity.

Assessment

Paper Typedescriptive Evidence Strengthmedium — The paper presents large-scale, empirical measurements using a purpose-built detection pipeline and a benchmark, plus linkage to 7,000+ CVE-linked changes, which provides substantial descriptive evidence about prevalence and patterns; however, labels depend on classifier accuracy and the study is observational, so causal claims about AI causing vulnerabilities or propagation are not firmly established. Methods Rigorhigh — Authors build and validate a high-precision detection pipeline and a representative benchmark, analyze a large corpus (top 1,000 GitHub repos, 2022–2025) and thousands of CVE-linked edits, trace edit chains, and commit to open-sourcing artifacts and documentation — all hallmarks of rigorous empirical work — though results remain sensitive to detector error rates, repo selection, language coverage, and operationalization choices. SampleDevelopment commits from the top 1,000 GitHub repositories over 2022–2025, plus a separate corpus of 7,000+ recent CVE-linked code changes; analysis labels commits, files, and functions along a human/AI axis to study adoption patterns, CWE distributions, and edit chains. Themesadoption human_ai_collab governance GeneralizabilityRestricted to top 1,000 public GitHub repositories — may not generalize to smaller, private, or enterprise codebases., Time window 2022–2025 may not reflect later LLM capabilities or changing usage patterns., Language and ecosystem coverage may be skewed (popular languages prioritized), limiting transferability across stacks., Detection model errors (false positives/negatives) can bias prevalence and vulnerability attributions., CVE-linked analysis covers known and reported vulnerabilities only, missing undisclosed security issues., Observational design prevents strong causal claims about AI causing vulnerabilities or propagation.

Claims (13)

ClaimDirectionOutcomeConfidence & EvidenceDetails
We present the first large-scale empirical study of AI-generated code (AIGCode) in the wild. Other positive existence/novelty of a large-scale empirical study of AIGCode
Reading fidelity high
Study strength low
not reported
0.09
We build a high-precision detection pipeline and a representative benchmark to distinguish AIGCode from human-written code. Other positive accuracy/ability to classify code as AI-generated vs human-written
Reading fidelity high
Study strength medium
not reported
0.18
We apply our methods to development commits from the top 1,000 GitHub repositories (2022-2025). Other positive coverage of analysis across top GitHub repositories
Reading fidelity high
Study strength high
n=1000
0.3
We apply our methods to 7,000+ recent CVE-linked code changes. Other positive coverage of vulnerability-linked code changes
Reading fidelity high
Study strength high
n=7000
0.3
We label commits, files, and functions along a human/AI axis and trace how AIGCode moves through projects and vulnerability life cycles. Other positive labels along a human/AI axis and tracked propagation of labeled code
Reading fidelity high
Study strength medium
not reported
0.18
AIGCode is already a substantial fraction of new code. Adoption Rate positive fraction/proportion of new code that is AI-generated
Reading fidelity high
Study strength medium
not reported
0.18
Adoption is structured: AI concentrates in glue code, tests, refactoring, documentation, and other boilerplate. Adoption Rate mixed relative prevalence of AI-generated code across code categories (glue, tests, docs, refactorings, boilerplate vs core logic)
Reading fidelity high
Study strength medium
not reported
0.18
Core logic and security-critical configurations remain mostly human-written. Adoption Rate mixed proportion of AI-generated code in core logic and security-critical configurations
Reading fidelity high
Study strength medium
not reported
0.18
Some CWE families are overrepresented in AI-tagged code. Error Rate negative frequency/overrepresentation of specific CWE families in AI-tagged code
Reading fidelity high
Study strength medium
n=7000
0.18
Near-identical insecure templates recur across unrelated projects, suggesting 'AI-induced vulnerabilities' propagated by shared models rather than shared maintainers. Error Rate negative occurrence and recurrence of near-identical insecure code templates across unrelated projects
Reading fidelity medium
Study strength low
not reported
0.05
In human-AI edit chains, AI introduces high-throughput changes while humans act as security gatekeepers. Team Performance mixed throughput (number/rate) of AI-introduced changes and human review activity
Reading fidelity high
Study strength medium
not reported
0.18
When review is shallow, AI-introduced defects persist longer, remain exposed on network-accessible surfaces, and spread to more files and repositories. Error Rate negative defect survival time, network exposure, and spread across files/repositories for AI-introduced defects under varying review depths
Reading fidelity medium
Study strength medium
not reported
0.11
We will open-source the complete dataset and release analysis artifacts and fine-grained documentation of our methodology and findings. Other positive availability of dataset and analysis artifacts (planned release)
Reading fidelity high
Study strength low
not reported
0.09

Notes