We analyzed 10,000 comments from AI-generated code snippets. The results were startling. While AI comments are grammatically perfect, they suffer from a phenomenon we call the "Uncanny Valley of Explanation."
The Data
Using the Vibe Code Detector engine, we scanned repositories known to be heavily AI-assisted. We categorized comments into three buckets:
In human-written codebases (like the React source code), the "Why" bucket is typically around 40-50%. This discrepancy is the single biggest signal for AI detection.
The "What" Trap
AI models are trained to be helpful. Unfortunately, they interpret "helpful" as "explain everything." This leads to comments that explain the syntax of the language rather than the purpose of the code.
The AI Style
// Loop through the array of users
for (let i = 0; i < users.length; i++) {
// Check if the user is active
if (users[i].isActive) {
// Add to the active list
activeUsers.push(users[i]);
}
}
This is noise. Any developer who knows JavaScript knows that for loops through an array. These comments add cognitive load without adding value.
The "Why" Gold Standard
Human developers write comments when the code cannot explain itself. This usually involves business logic, edge cases, or workarounds.
The Human Style
// We use a classic for-loop here instead of .filter() because
// this runs on the hot path (60fps) and we need to avoid
// garbage collection from closure allocation.
for (let i = 0; i < users.length; i++) {
if (users[i].isActive) {
activeUsers.push(users[i]);
}
}
This comment is invaluable. It prevents a "helpful" junior dev (or AI!) from refactoring this into a cleaner but slower .filter() chain.
How to Fix Your Vibe
If you use AI to generate code (and you should!), treat the comments as a first draft.
- Delete any comment that explains syntax (e.g., "Define a function").
- Delete any comment that just repeats the function name.
- Add comments that explain constraints (e.g., "Must be less than 1MB").
- Add comments that explain history (e.g., "Fixes bug #123").
The goal isn't no comments—it's high-signal comments.