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,Xuanhua Shi,Hai Jin

arxiv(2024)

引用 0|浏览5
暂无评分
摘要
Large language models (LLMs) have shown remarkable progress in automated code generation. Yet, incorporating LLM-based code generation into real-life software projects poses challenges, as the 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. To this end, this paper puts forward a novel approach, termed ProCoder, which iteratively refines the project-level code context for precise code generation, guided by the compiler feedback. In particular, ProCoder first leverages compiler techniques to identify a mismatch 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 ProCoder 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 ProCoder significantly improves the vanilla LLMs by over 80 dependent on project context, and consistently outperforms the existing retrieval-based code generation baselines.
更多
查看译文
AI 理解论文
溯源树
样例
生成溯源树,研究论文发展脉络
Chat Paper
正在生成论文摘要