ACL Findings2026
Let the Comments Speak: A Multi-Agent Framework based on Large Language Model for Comment-Guided Code Refactoring
Zixuan Wang, Wutong Yu, Deyu Zhou
Abstract
Code refactoring is essential for software maintainability, yet current Large Language Model (LLM) based frameworks primarily focus on syntax and neglect the vital semantic signals in code comments. As pointed out in Fowler's refactoring theory, explanatory comments function as semantic anchors that provide necessary guidance for method extraction. Moreover, research reports show that more than 84 percent of codebases lack appropriate code comments, which hinders the leverage of such guidance. To bridge this gap, we propose MACOR, a Multi-Agent framework for COmment-guided code Refactoring. In specific, MACOR populates original code with precise comments to provide necessary semantic guidance for the subsequent refactoring process. These generated signals are employed to retrieve expert examples. An iterative feedback is incorporated loop for validation. Experiments are conducted on three benchmarks using three base LLMs. Experimental results show that MACOR significantly optimizes code quality and achieves higher developer acceptance compared to the representative baselines.
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.
Lineage
- iSMELL: Assembling LLMs with Expert Toolsets for Code Smell Detection and Refactoring cites Deep Learning Based Feature Envy Detection Boosted by Real-World Examples
- Reflexion: language agents with verbal reinforcement learning cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
Builds on8
- Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma et al.NeurIPS 2022 · 22,562 citations
- Reflexion: language agents with verbal reinforcement learningNoah Shinn, Federico Cassano, Ashwin Gopinath, Karthik Narasimhan et al.NeurIPS 2023 · 5,828 citations
- OctoPack: Instruction Tuning Code Large Language ModelsNiklas Muennighoff, Qian Liu, Armel Randy Zebaze, Qinkai Zheng et al.ICLR 2024 · 203 citations
- iSMELL: Assembling LLMs with Expert Toolsets for Code Smell Detection and RefactoringDi Wu, Fangwen Mu, Lin Shi, Zhaoqiang Guo et al.ASE 2024 · 19 citations
- Deep Learning Based Feature Envy Detection Boosted by Real-World ExamplesBo Liu, Hui Liu, Guangjie Li, Nan Niu et al.FSE 2023 · 19 citations
Related papers
- RefAgent: A Multi-agent LLM-based Framework for Automatic Software RefactoringKhouloud Oueslati, Maxime Lamothe, Foutse KhomhICSE 2026 · 1 citation
- From Draft to Precision: Iterative Agentic Framework for Intent-Aware Code SummarizationYifei Ge, Chunrong Fang, Zhenyu Chen, Juan ZhaiISSTA 2026
- CORE: Resolving Code Quality Issues using LLMsNalin Wadhwa, Jui Pradhan, Atharv Sonwane, Surya Prakash Sahu et al.FSE 2024 · 32 citations
- Failure Localization in Multi-Agent Code Generation via Knowledge-Guided and Transferable ReasoningMingyang Geng, Shanzhi Gu, Zhipeng Liu, Chuanfu Xu et al.AAAI 2026
- An LLM-Based Agent-Oriented Approach for Automated Code Design Issue LocalizationFraol Batole, David O'Brien, Tien N. Nguyen, Robert Dyer et al.ICSE 2025 · 7 citations
