From Draft to Precision: Iterative Agentic Framework for Intent-Aware Code Summarization
Yifei Ge, Chunrong Fang, Zhenyu Chen, Juan Zhai
Abstract
Code summarization aims to generate natural language (NL) descriptions for code snippets to assist developers in understanding and maintaining programs. Recent advances in large language models (LLMs) have substantially improved the quality of automatic code summarization. In real-world projects, code comments are written to serve different developer intents, which has motivated the development of intent-aware summarization methods. However, existing intent-aware methods still struggle to fully capture developer intent, often producing incomplete or misaligned summaries. Our empirical study reveals that real-world comments are typically refined through multiple rounds of developer revision, which we believe is key to achieving high quality. However, current methods typically overlook this iterative refinement. To bridge this gap, we propose a plan-conditioned revision framework that improves code summarization through iterative revision. It integrates two collaborating agents: a Generator that produces and revises summaries, and a Reviewer that assesses the generated summary and drafts targeted revision plans to guide subsequent edits using available contextual information. By iteratively refining summaries with revision plans and contextual information, our framework yields summaries that are more accurate, complete, and better aligned with developer intent. Extensive experiments on an intent-annotated CSN-Java benchmark demonstrate the effectiveness of our method. On automatic metrics, our method achieves a 28.75% improvement over the state-of-the-art baseline methods across all intents. Besides, in human studies, our framework yields average gains of over 20% in usefulness, adequacy, and intent alignment. It also achieves the highest Top-1 preference (over 40% across all intents), underscoring its practical advantage for developers
Ask about this paper
Ask your agent about it.
Lune has read the top-tier papers around this one, so every answer names the papers it rests on.
Related papers
- Enhanced Prompting Framework for Code Summarization with Large Language ModelsMinying Fang, Xing Yuan, Yuying Li, Haojie Li et al.ISSTA 2025 · 3 citations
- 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
- Intention is All you Need: Refining your Code from your IntentionQi Guo, Xiaofei Xie, Shangqing Liu, Ming Hu et al.ICSE 2025 · 7 citations
- CORE: Resolving Code Quality Issues using LLMsNalin Wadhwa, Jui Pradhan, Atharv Sonwane, Surya Prakash Sahu et al.FSE 2024 · 32 citations
- Source Code Summarization in the Era of Large Language ModelsWeisong Sun, Yun Miao, Yuekang Li, Hongyu Zhang et al.ICSE 2025 · 37 citations
