Enhancing Code Generation via Bidirectional Comment-Level Mutual Grounding
Not on the map. Why?
Abstract (arXiv)
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.
Key facts. Cited by 3 papers in the map (data through 7 Oct 2026). Builds on 34 of its 62 references that are in the map. First posted on arXiv 12 May 2025.
Builds on
34 of 62 references.
References · 34
- 2014Adam: A Method for Stochastic Optimizationcited by 36,960
- 2022ReAct: Synergizing Reasoning and Acting in Language Modelscited by 8,355
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2021Program Synthesis with Large Language Modelscited by 3,509
- 2023Tree of Thoughts: Deliberate Problem Solving with Large Language Modelscited by 3,155
- 2014Sequence to Sequence Learning with Neural Networkscited by 2,974
- 2022Competition-Level Code Generation with AlphaCodecited by 1,427
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
- 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,154
- 2023Teaching Large Language Models to Self-Debugcited by 963
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 876
- 2019DialoGPT: Large-Scale Generative Pre-training for Conversational Response Generationcited by 842
22 more
- 2023StarCoder: may the source be with you!cited by 790
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
- 2023WizardCoder: Empowering Code Large Language Models with Evol-Instructcited by 728
- 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 638
- 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 492
- 2022DS-1000: A Natural and Reliable Benchmark for Data Science Code Generationcited by 442
- 2016How NOT To Evaluate Your Dialogue System: An Empirical Study of Unsupervised Evaluation Metrics for Dialogue Response Generationcited by 356
- 2022The Stack: 3 TB of permissively licensed source codecited by 354
- 2023Self-collaboration Code Generation via ChatGPTcited by 255
- 2022Efficient Training of Language Models to Fill in the Middlecited by 248
- 2022Grounded Copilot: How Programmers Interact with Code-Generating Modelscited by 216
- 2023Self-planning Code Generation with Large Language Modelscited by 121
- 2023Self-Edit: Fault-Aware Code Editor for Code Generationcited by 110
- 2024CodeRAG-Bench: Can Retrieval Augment Code Generation?cited by 89
- 2022Language Models Can Teach Themselves to Program Bettercited by 75
- 2023CodeChain: Towards Modular Code Generation Through Chain of Self-revisions with Representative Sub-modulescited by 58
- 2019Do Neural Dialog Systems Use the Conversation History Effectively? An Empirical Studycited by 47
- 2021Grounding 'Grounding' in NLPcited by 44
- 2023RAP-Gen: Retrieval-Augmented Patch Generation with CodeT5 for Automatic Program Repaircited by 43
- 2021In-IDE Code Generation from Natural Language: Promise and Challengescited by 41
- 2022No More Fine-Tuning? An Experimental Evaluation of Prompt Tuning in Code Intelligencecited by 41
- 2023Do Large Language Models Pay Similar Attention Like Human Programmers When Generating Code?cited by 13
Built on by
Citing papers per year: 2025: 2; 2026: 1.
3 papers.