References & Citations
Computer Science > Computation and Language
Title: Iterative Refinement of Project-Level Code Context for Precise Code Generation with Compiler Feedback
(Submitted on 25 Mar 2024 (v1), last revised 2 Apr 2024 (this version, v2))
Abstract: 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% in generating code dependent on project context, and consistently outperforms the existing retrieval-based code generation baselines.
Submission history
From: Zhangqian Bi [view email][v1] Mon, 25 Mar 2024 14:07:27 GMT (4725kb,D)
[v2] Tue, 2 Apr 2024 08:17:12 GMT (4732kb,D)
Link back to: arXiv, form interface, contact.