An Exploratory Study on LLM-Generated Code and Comments in Code Repositories
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
- LLM-generated code shows substantial intra-repository code clones.
- Company repositories use more LLM-generated content than community ones.
- LLM-generated comments often lack grammatical correctness.
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
- Focus LLM code generation on test cases.
- Review LLM-generated comments for grammatical accuracy.
- Monitor intra-repository code clones from LLM outputs.
Topics
- LLM Code Generation
- Code Repositories
- Software Engineering
- Code Quality
- AI in Development
- Code Comments
Best for: AI Engineer, Research Scientist, AI Scientist, Machine Learning Engineer, Software Engineer
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by Artificial Intelligence.