An Exploratory Study on LLM-Generated Code and Comments in Code Repositories
This exploratory study analyzes LLM-generated code and comments in company- and community-maintained repositories from 2021 to 2025, revealing that while detected LLM code has decreased over time and is prevalent in test cases with high cloning rates, LLM-generated comments remain stable but often grammatically flawed, and human-labeled bugs show only a small association with LLM-generated code.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine a massive, bustling library where millions of books (software code) are being written every day. Recently, a new kind of "ghost writer" has entered the scene: Artificial Intelligence (LLMs). These ghost writers can whip up sentences and stories (code and comments) at lightning speed.
This paper is like a team of librarians who decided to investigate: "How much of the writing in our library is actually done by these ghost writers, and what does that writing look like?"
Here is what they found, broken down into simple stories:
1. The Mystery of the "Ghost" Writing
The librarians used special "metal detectors" (software tools) to scan the books. These detectors don't know for sure if a human or a robot wrote a page, but they can spot patterns that look like robot writing.
- The Code (The Instructions): They found that the amount of "robot-written" code seems to be shrinking over time. It's as if the ghost writers are getting better at sounding human, or perhaps the human librarians are editing the robot's work so much that the robot's fingerprint disappears. Interestingly, most of the robot-written code they found was in the "Test Cases"—think of these as the practice quizzes or rehearsal scripts. Robots seem to love writing these repetitive practice drills.
- The Comments (The Notes): While the robot code is fading, the robot-written notes (comments explaining what the code does) have stayed steady. It seems the robots are still very good at writing the "sticky notes" that explain the instructions, but humans are taking over the actual building of the machine.
2. Company Libraries vs. Community Libraries
The researchers compared two types of libraries:
- Company Libraries: These are run by big tech giants (like Google or Meta).
- Community Libraries: These are run by groups of volunteers (open-source projects).
The Finding: The Company Libraries had a much higher percentage of "ghost-written" material. It's like the big companies are using the ghost writers more heavily to keep their internal systems running smoothly and consistently. The Community Libraries had less robot writing, and when they did find it, the notes were often grammatically cleaner and more polished than the ones in the company libraries.
3. The "Copy-Paste" Problem
The researchers noticed something strange about the robot code: It was full of clones.
Imagine if a ghost writer wrote a story, and then copied and pasted that same story into 70% of the books in the library. That's what happened with the code. The robots generated code that looked almost identical to other code in the same library. However, when they compared this to a database of known "pure robot code," they found very little overlap. This suggests that humans aren't just copy-pasting the robot's raw output; they are likely tweaking it, which makes it look unique but still leaves behind those repetitive patterns.
4. Did the Ghost Writers Break Anything?
A major worry is that if robots write the code, they might introduce bugs (errors) that break the software.
- The Finding: The researchers looked at a list of known "broken" books (bugs) and asked, "Did a robot write this?"
- The Result: Surprisingly, very few of the broken books were written by robots. Only about 5% to 10% of the known errors seemed to come from the ghost writers.
- The Metaphor: It's like the ghost writers are allowed to write the draft, but the human editors are very strict. They catch the mistakes before the book goes to print. The humans are likely fixing the robot's errors before the code is saved.
5. The Big Caveat (The "Detective's Warning")
The authors are very honest about their limitations. They admit they don't have a "truth serum" to know for sure if a human or a robot wrote a specific line. Their "metal detectors" are just guessing based on patterns.
- The Analogy: It's like trying to guess if a painting was made by a human or a robot by looking at the brushstrokes. Sometimes the robot is so good it looks human, and sometimes a human paints in a very repetitive way that looks like a robot.
- The Conclusion: Because of this, they call their findings "proxy observations." They aren't saying, "This is definitely robot code." They are saying, "This looks very much like robot code based on our tools."
Summary
In short, this study suggests that while AI is helping write software, humans are still the captains of the ship. The AI is doing a lot of the repetitive "test driving" and note-taking, especially in big companies. But the humans are heavily editing the work, fixing the mistakes, and ensuring that the final product doesn't look like a robot wrote it. The "robot fingerprint" is actually getting harder to find in the code itself, even though the robots are still busy writing the explanations.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.