Enhancing Code Generation via Bidirectional Comment-Level Mutual Grounding
Large Language Models (LLMs) have demonstrated unprecedented capability in code generation. However, LLM-generated code is still plagued with a wide range of functional errors, especially for complex programming tasks that LLMs have not seen before. Recent studies have shown that developers often struggle with inspecting and fixing incorrect code generated by LLMs, diminishing their productivity and trust in LLM-based code generation. Inspired by the mutual grounding theory in communication, we propose an interactive approach that leverages code comments as a medium for developers and LLMs to establish a shared understanding. Our approach facilitates iterative grounding by interleaving code generation, inline comment generation, and contextualized user feedback through editable comments to align generated code with developer intent. We evaluated our approach on two popular benchmarks and demonstrated that our approach significantly improved multiple state-of-the-art LLMs, e.g., 17.1% pass@1 improvement for code-davinci-002 on HumanEval. Furthermore, we conducted a user study with 12 participants in comparison to two baselines: (1) interacting with GitHub Copilot, and (2) interacting with a multi-step code generation paradigm called Multi-Turn Program Synthesis. Participants completed the given programming tasks 16.7% faster and with 10.5% improvement in task success rate when using our approach. Both results show that interactively refining code comments enables the collaborative establishment of mutual grounding, leading to more accurate code generation and higher developer confidence.
Code (1)
Tasks
Code GenerationComment GenerationHumanEvalProgram SynthesisMethods 이 논문이 사용한 방법론
Similar Papers 제목 키워드 기반
Towards Context-Aware Code Comment Generation
Code comments are vital for software maintenance and comprehension, but many software projects suffer from the lack of meaningful and up-to-date comments in practice. This paper presents a novel approach to automatically…
Code Comment GenerationComment GenerationGraph AttentionA Transfer Learning Approach for Dialogue Act Classification of GitHub Issue Comments
Social coding platforms, such as GitHub, serve as laboratories for studying collaborative problem solving in open source software development; a key feature is their ability to support issue reporting which is used by te…
Dialogue Act ClassificationGeneral ClassificationSentenceTransfer LearningTowards Automatic Soccer Commentary Generation with Knowledge-Enhanced Visual Reasoning
Soccer commentary plays a crucial role in enhancing the soccer game viewing experience for audiences. Previous studies in automatic soccer commentary generation typically adopt an end-to-end method to generate anonymous …
Visual ReasoningDCA: Diversified Co-Attention towards Informative Live Video Commenting
We focus on the task of Automatic Live Video Commenting (ALVC), which aims to generate real-time video comments with both video frames and other viewers' comments as inputs. A major challenge in this task is how to prope…
Comment GenerationMetric LearningGenerating Pertinent and Diversified Comments with Topic-aware Pointer-Generator Networks
Comment generation, a new and challenging task in Natural Language Generation (NLG), attracts a lot of attention in recent years. However, comments generated by previous work tend to lack pertinence and diversity. In thi…
ArticlesComment GenerationDiversityText Generation