AUTOGENICS: Automated Generation of Context-Aware Inline Comments for Code Snippets on Programming Q&A Sites Using LLM
Not on the map. Why?
Abstract (arXiv)
Inline comments in the source code facilitate easy comprehension, reusability, and enhanced readability. However, code snippets in answers on Q&A sites like Stack Overflow (SO) often lack comments because answerers volunteer their time and often skip comments or explanations due to time constraints. Existing studies show that these online code examples are difficult to read and understand, making it difficult for developers (especially novices) to use them correctly and leading to misuse. Given these challenges, we introduced AUTOGENICS, a tool designed to integrate with SO to generate effective inline comments for code snippets in SO answers exploiting large language models (LLMs). Our contributions are threefold. First, we randomly select 400 answer code snippets from SO and generate inline comments for them using LLMs. We then manually evaluate these comments' effectiveness using four key metrics: accuracy, adequacy, conciseness, and usefulness. Overall, LLMs demonstrate promising effectiveness in generating inline comments for SO answer code snippets. Second, we surveyed 14 active SO users to perceive the effectiveness of these inline comments. The survey results are consistent with our previous manual evaluation. However, according to our evaluation, LLMs-generated comments are less effective for shorter code snippets and sometimes produce noisy comments. Third, to address the gaps, we introduced AUTOGENICS, which extracts additional context from question texts and generates context-aware inline comments. It also optimizes comments by removing noise (e.g., comments in import statements and variable declarations). We evaluate the effectiveness of AUTOGENICS-generated comments using the same four metrics that outperform those of standard LLMs. AUTOGENICS might (a) enhance code comprehension, (b) save time, and improve developers' ability to learn and reuse code more accurately.
Key facts. Cited by 5 papers in the map (data through 7 Oct 2026). First posted on arXiv 27 Aug 2024.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2025: 2; 2026: 3.
5 papers.
- 2025Uncovering Intention through LLM-Driven Code Snippet Description Generationcited by 1
- 2026RAT: RunAnyThing via Fully Automated Environment Configurationcited by 1
- 2025SmartDoc: A Context-Aware Agentic Method Comment Generation Plugincited by 0
- 2026Human-Aligned Enhancement of Programming Answers with LLMs Guided by User Feedbackcited by 0
- 2026XSearch: Explainable Code Search via Concept-to-Code Alignmentcited by 0
- 2026XSearch: Explainable Code Search via Concept-to-Code Alignment15 May 2026
- 2026RAT: RunAnyThing via Fully Automated Environment Configuration25 Apr 2026
- 2026Human-Aligned Enhancement of Programming Answers with LLMs Guided by User Feedback24 Jan 2026
- 2025SmartDoc: A Context-Aware Agentic Method Comment Generation Plugin1 Nov 2025
- 2025Uncovering Intention through LLM-Driven Code Snippet Description Generation18 Jun 2025