ACL Findings2024
Iterative Refinement of Project-Level Code Context for Precise Code Generation with Compiler Feedback
Zhangqian Bi, Yao Wan, Zheng Wang, Hongyu Zhang, Batu Guan, Fangxin Lu, Zili Zhang, Yulei Sui, Hai Jin, Xuanhua Shi
摘要
Large Language Models (LLMs) have shown remarkable progress in automated code generation. Yet, LLM-generated code may contain errors in API usage, class, data structure, or missing project-specific information. As much of this project-specific context cannot fit into the prompts of LLMs, we must find ways to allow the model to explore the project-level code context. We present COCOGEN, a new code generation approach that uses compiler feedback to improve the LLM-generated code. COCOGEN first leverages static analysis to identify mismatches between the generated code and the project's context. It then iteratively aligns and fixes the identified errors using information extracted from the code repository. We integrate COCOGEN with two representative LLMs, i.e., GPT-3.5-Turbo and Code Llama (13B), and apply it to Python code generation. Experimental results show that COCOGEN significantly improves the vanilla LLMs by over 80% in generating code dependent on the project context and consistently outperforms the existing retrieval-based code generation baselines.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 16 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- RepoBench: Benchmarking Repository-Level Code Auto-Completion Systems 引用了 Repository-Level Prompt Generation for Large Language Models of Code
- ReACC: A Retrieval-Augmented Code Completion Framework 引用了 CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation
- ReACC: A Retrieval-Augmented Code Completion Framework 引用了 Dense Passage Retrieval for Open-Domain Question Answering
- Repository-Level Prompt Generation for Large Language Models of Code 引用了 CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation
- UICopilot: Automating UI Synthesis via Hierarchical Code Generation from Webpage Designs 引用了 WebCode2M: A Real-World Dataset for Code Generation from Webpage Designs
- PEACE: Towards Efficient Project-Level Efficiency Optimization via Hybrid Code Editing 引用了 CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation
- PEACE: Towards Efficient Project-Level Efficiency Optimization via Hybrid Code Editing 引用了 ReACC: A Retrieval-Augmented Code Completion Framework
- PEACE: Towards Efficient Project-Level Efficiency Optimization via Hybrid Code Editing 引用了 Repository-Level Prompt Generation for Large Language Models of Code
引用它的顶会 Paper16
- WebCode2M: A Real-World Dataset for Code Generation from Webpage DesignsYi Gui, Zhen Li, Yao Wan, Yemin Shi 等WWW 2025 · 38 次引用
- UICopilot: Automating UI Synthesis via Hierarchical Code Generation from Webpage DesignsYi Gui, Yao Wan, Zhen Li, Zhongyi Zhang 等WWW 2025 · 24 次引用
- PEACE: Towards Efficient Project-Level Efficiency Optimization via Hybrid Code EditingXiaoxue Ren, Jun Wan, Yun Peng, Zhongxin Liu 等ASE 2025 · 5 次引用
- CodeEvo: Interaction-Driven Synthesis of Code-centric Data through Hybrid and Iterative FeedbackQiushi Sun, Jingyang Gong, Lei Li, Qipeng Guo 等ACL 2026 · 4 次引用
- RethinkMCTS: Refining Erroneous Thoughts in Monte Carlo Tree Search for Code GenerationQingyao Li, Wei Xia, Xinyi Dai, Kounianhua Du 等EMNLP 2025 · 2 次引用
它引用的 Paper15
- 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 次引用
- RepoBench: Benchmarking Repository-Level Code Auto-Completion SystemsTianyang Liu, Canwen Xu, Julian J. McAuleyICLR 2024 · 338 次引用
- ReACC: A Retrieval-Augmented Code Completion FrameworkShuai Lu, Nan Duan, Hojae Han, Daya Guo 等ACL 2022 · 208 次引用
- Repository-Level Prompt Generation for Large Language Models of CodeDisha Shrivastava, Hugo Larochelle, Daniel TarlowICML 2023 · 184 次引用
- Dense Passage Retrieval for Open-Domain Question AnsweringVladimir Karpukhin, Barlas Oguz, Sewon Min, Patrick Lewis 等EMNLP 2020 · 142 次引用
相关 Paper
- Can Language Models Replace Programmers for Coding? REPOCOD Says 'Not Yet'Shanchao Liang, Nan Jiang, Yiran Hu, Lin TanACL 2025 · 9 次引用
- Do Large Language Models Pay Similar Attention Like Human Programmers When Generating Code?Bonan Kou, Shengmai Chen, Zhijie Wang, Lei Ma 等FSE 2024 · 8 次引用
- Is Self-Repair a Silver Bullet for Code Generation?Theo X. Olausson, Jeevana Priya Inala, Chenglong Wang, Jianfeng Gao 等ICLR 2024 · 195 次引用
- FGit: Fault-Guided Fine-Tuning for Code GenerationLishui Fan, Zhongxin Liu, Haoye Wang, Lingfeng Bao 等ASE 2025
- ROCODE: Integrating Backtracking Mechanism and Program Analysis in Large Language Models for Code GenerationXue Jiang, Yihong Dong, Yongding Tao, Huanyu Liu 等ICSE 2025 · 6 次引用
