Developer-Intent Driven Code Comment Generation
Fangwen Mu, Xiao Chen, Lin Shi, Song Wang, Qing Wang
Abstract
Existing automatic code comment generators mainly focus on producing a general description of functionality for a given code snippet without considering developer intentions. However, in real-world practice, comments are complicated, which often contain information reflecting various intentions of developers, e.g., functionality summarization, design rationale, implementation details, code properties, etc. To bridge the gap between automatic code comment generation and real-world comment practice, we define Developer-Intent Driven Code Comment Generation, which can generate intent-aware comments for the same source code with different intents. To tackle this challenging task, we propose DOME, an approach that utilizes Intent-guided Selective Attention to explicitly select intent-relevant information from the source code, and produces various comments reflecting different intents. Our approach is evaluated on two real-world Java datasets, and the experimental results show that our approach outperforms the state-of-the-art baselines. A human evaluation also confirms the significant potential of applying DOME in practical usage, enabling developers to comment code effectively according to their own needs.
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
6 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
- Atomizer: An LLM-based Collaborative Multi-Agent Framework for Intent-Driven Commit Untangling cites CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation
- Atomizer: An LLM-based Collaborative Multi-Agent Framework for Intent-Driven Commit Untangling cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
- Atomizer: An LLM-based Collaborative Multi-Agent Framework for Intent-Driven Commit Untangling cites MiSum: Multi-modality Heterogeneous Code Graph Learning for Multi-intent Binary Code Summarization
- Source Code Summarization in the Era of Large Language Models cites Retrieval-based neural source code summarization
- Source Code Summarization in the Era of Large Language Models cites Retrieval-Augmented Generation for Code Summarization via Hybrid GNN
- MAGIS: LLM-Based Multi-Agent Framework for GitHub Issue Resolution cites CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation
- Testora: Using Natural Language Intent to Detect Behavioral Regressions cites Retrieval-based neural source code summarization
- MiSum: Multi-modality Heterogeneous Code Graph Learning for Multi-intent Binary Code Summarization cites CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation
- MiSum: Multi-modality Heterogeneous Code Graph Learning for Multi-intent Binary Code Summarization cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
- Retrieval-Augmented Generation for Code Summarization via Hybrid GNN cites Retrieval-based neural source code summarization
Cited by top-tier papers6
- MAGIS: LLM-Based Multi-Agent Framework for GitHub Issue ResolutionWei Tao, Yucheng Zhou, Yanlin Wang, Wenqiang Zhang et al.NeurIPS 2024 · 210 citations
- Source Code Summarization in the Era of Large Language ModelsWeisong Sun, Yun Miao, Yuekang Li, Hongyu Zhang et al.ICSE 2025 · 37 citations
- MiSum: Multi-modality Heterogeneous Code Graph Learning for Multi-intent Binary Code SummarizationKangchen Zhu, Zhiliang Tian, Shangwen Wang, Weiguo Chen et al.FSE 2025 · 2 citations
- Testora: Using Natural Language Intent to Detect Behavioral RegressionsMichael PradelICSE 2026 · 1 citation
- Atomizer: An LLM-based Collaborative Multi-Agent Framework for Intent-Driven Commit UntanglingKangchen Zhu, Zhiliang Tian, Shangwen Wang, Mingyue Leng et al.ICSE 2026
Builds on16
- CodeBERT: A Pre-Trained Model for Programming and Natural LanguagesZhangyin Feng, Daya Guo, Duyu Tang, Nan Duan et al.EMNLP Findings 2020 · 2,828 citations
- GraphCodeBERT: Pre-training Code Representations with Data FlowDaya Guo, Shuo Ren, Shuai Lu, Zhangyin Feng et al.ICLR 2021 · 1,644 citations
- CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and GenerationYue Wang, Weishi Wang, Shafiq R. Joty, Steven C. H. HoiEMNLP 2021 · 1,224 citations
- Retrieval-based neural source code summarizationJian Zhang, Xu Wang, Hongyu Zhang, Hailong Sun et al.ICSE 2020 · 242 citations
- Retrieval-Augmented Generation for Code Summarization via Hybrid GNNShangqing Liu, Yu Chen, Xiaofei Xie, Jing Kai Siow et al.ICLR 2021 · 194 citations
Related papers
- Towards Context-Aware Code Comment GenerationXiaohan Yu, Quzhe Huang, Zheng Wang, Yansong Feng et al.EMNLP Findings 2020 · 18 citations
- Automatic Comment Generation via Multi-Pass DeliberationFangwen Mu, Xiao Chen, Lin Shi, Song Wang et al.ASE 2022 · 10 citations
- From Draft to Precision: Iterative Agentic Framework for Intent-Aware Code SummarizationYifei Ge, Chunrong Fang, Zhenyu Chen, Juan ZhaiISSTA 2026
- Large Language Models are Few-Shot Summarizers: Multi-Intent Comment Generation via In-Context LearningMingyang Geng, Shangwen Wang, Dezun Dong, Haotian Wang et al.ICSE 2024 · 124 citations
- Retrieve and Refine: Exemplar-based Neural Comment GenerationBolin Wei, Yongmin Li, Ge Li, Xin Xia et al.ASE 2020 · 68 citations
