Bi, Z., Wan, Y., Wang, Z. orcid.org/0000-0001-6157-0662 et al. (7 more authors) (2024) Iterative Refinement of Project-Level Code Context for Precise Code Generation with Compiler Feedback. In: Findings of the Association for Computational Linguistics ACL 2024. Association for Computational Linguistics ACL 2024, 11-16 Aug 2024, Bangkok, Thailand. Association for Computational Linguistics , pp. 2336-2353.
Abstract
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.
Metadata
Item Type: | Proceedings Paper |
---|---|
Authors/Creators: |
|
Copyright, Publisher and Additional Information: | ©2024 Association for Computational Linguistics. This is an open access article under the terms of the Creative Commons Attribution License (CC-BY 4.0), which permits unrestricted use, distribution and reproduction in any medium, provided the original work is properly cited. |
Dates: |
|
Institution: | The University of Leeds |
Academic Units: | The University of Leeds > Faculty of Engineering & Physical Sciences (Leeds) > School of Computing (Leeds) > Distributed Systems & Services |
Depositing User: | Symplectic Publications |
Date Deposited: | 22 Oct 2024 09:15 |
Last Modified: | 22 Oct 2024 09:15 |
Status: | Published |
Publisher: | Association for Computational Linguistics |
Identification Number: | 10.18653/v1/2024.findings-acl.138 |
Open Archives Initiative ID (OAI ID): | oai:eprints.whiterose.ac.uk:218627 |