An Exploratory Study on LLM-Generated Code and Comments in Code Repositories

· Source: Artificial Intelligence · Field: Technology & Digital — Software Development & Engineering, Artificial Intelligence & Machine Learning · Depth: Expert, quick

Summary

An exploratory study on LLM-generated code and comments in code repositories analyzed active company- and community-maintained repositories from 2021 to 2025. The research, using various detection tools, found that code likely generated by LLMs decreased over time and frequently appeared in test cases, while LLM-generated comments remained relatively stable. Company-maintained repositories showed a higher percentage of LLM-generated code and comments compared to community-maintained ones. Furthermore, LLM-generated code exhibited substantial intra-repository code clones, and comments often lacked grammatical correctness. Critically, only a small percentage of human-labeled bugs were associated with LLM-generated code.

Key takeaway

For software engineers integrating LLM-generated code, you should prioritize its use in test case generation, where its presence is decreasing but still frequent. While LLM-generated code shows low bug association, be vigilant for substantial intra-repository code clones. Additionally, carefully review LLM-generated comments for grammatical correctness, as their quality remains a concern.

Key insights

LLM-generated code decreased over time and appeared in test cases, while comments remained stable, with few associated bugs.

Principles

Method

Conducted extensive experiments on active company- and community-maintained repositories from 2021 to 2025 using various LLM-generated code/comment detection tools.

In practice

Topics

Best for: AI Engineer, Research Scientist, AI Scientist, Machine Learning Engineer, Software Engineer

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by Artificial Intelligence.