Treffer: Iterative Refinement of Project-Level Code Context for Precise Code Generation with Compiler Feedback

Title:
Iterative Refinement of Project-Level Code Context for Precise Code Generation with Compiler Feedback
Publisher Information:
Association for Computational Linguistics (ACL) 2024-01-01
Document Type:
E-Ressource Electronic Resource
Index Terms:
Availability:
Open access content. Open access content
info:eu-repo/semantics/closedAccess
Other Numbers:
LT1 oai:opus.lib.uts.edu.au:10453/187198
Proceedings of the Annual Meeting of the Association for Computational Linguistics, 2024, pp. 2336-2353
0736-587X
1523719867
Contributing Source:
UNIV OF TECH, SYDNEY
From OAIster®, provided by the OCLC Cooperative.
Accession Number:
edsoai.on1523719867
Database:
OAIster

Weitere Informationen

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.