Where Are Large Language Models for Code Generation on GitHub?

Xiao Yu, Lei Liu, Xing Hu, Jacky Wai Keung, Jin Liu, Xin XiaarXiv 2024 · DOI

Abstract

While Large Language Models (LLMs) are frequently evaluated on isolated benchmarks like HumanEval, their practical application in real-world software development remains under-explored. This paper investigates "self-admitted" AI-generated code—snippets explicitly identified by developers in GitHub comments. By analyzing 696 snippets across 450 projects, we find that LLMs are predominantly used for low-complexity, supplementary tasks in small-to-medium projects. Notably, this code demonstrates high stability, requiring minimal bug fixes after integration.

Introduction

Most research on LLM code generation relies on controlled benchmarks that fail to capture the "messiness" of real-world development. Questions remain regarding how developers prompt models, how much they edit the results, and how AI-generated code evolves as projects mature. This study addresses this gap by observing the characteristics, complexity, and maintenance history of AI-assisted code in production-like environments on GitHub.

Methodology

The researchers employed a multi-step pipeline to analyze AI-generated code:

  1. Data Collection: A search for keyword "triplets" (e.g., "generated by ChatGPT") via the GitHub REST API.
  2. Filtering: Selection of projects with at least 5 stars across five major languages: Python, Java, C/C++, JavaScript, and TypeScript.
  3. Manual Categorization: Review of snippets to classify functions (e.g., "Text processing") and identify bug types.
  4. Static Analysis: Utilization of SonarQube to measure Lines of Code (LOC) and Cyclomatic Complexity.
  5. Evolutionary Analysis: Tracking commit histories to compare the modification frequency of AI code against human-written baselines.

Results

Project Profiles and Complexity

The study found that AI-generated code is most prevalent in small-to-medium projects. As shown in Figure 1, the median number of stars and files across the studied repositories remains relatively low, supporting the observation that these tools are currently favored by smaller teams (typically 2–11 contributors).

Distribution of project stars and file counts across the five studied programming languages.

AI-generated code generally exhibits low complexity, with a median Cyclomatic Complexity of 1–3. C/C++ served as an outlier, where LLMs were more frequently tasked with complex algorithmic logic. Across all languages, "Algorithm and Data Structure" tasks were the most common use case (41%), followed by "Text Processing" (14%).

Stability and Maintenance

One of the most significant findings is the high initial stability of integrated AI code. Only 8% to 39% of analyzed snippets were modified post-commit. Furthermore, only 4% to 12% of those modifications were bug fixes. This suggests that developers are selective, integrating AI code only when it is "correct enough" to remain stable over time. When bugs did occur, they were primarily algorithmic logic errors (47%) or interface/dependency issues (28%).

Discussion

Despite the technical success of these snippets, documentation practices remain poor. Fewer than 11% of developers included the prompt used, and only 3% mentioned if the code was tested. Additionally, there is a clear "OpenAI monopoly" in self-admissions; developers almost exclusively credit ChatGPT or Copilot, with other high-performing models like DeepSeek or Qwen rarely mentioned in project comments.

Conclusion

LLMs currently serve a supplementary role in software development, handling boilerplate logic and isolated algorithms rather than building entire systems. While the code produced is remarkably stable, the lack of standardized documentation and the potential for selection bias—where developers only admit to using AI for code they trust—highlight the need for better transparency and reporting guidelines in AI-assisted development.

Summary updated

BibTeX
@misc{yu2024where,
  author = {Xiao Yu and Lei Liu and Xing Hu and Jacky Wai Keung and Jin Liu and Xin Xia},
  title = {{Where Are Large Language Models for Code Generation on GitHub?}},
  year = {2024},
  eprint = {2406.19544},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2406.19544},
}
Figure