Self-Edit: Fault-Aware Code Editor for Code Generation

05/06/2023
by   Kechi Zhang, et al.
0

Large language models (LLMs) have demonstrated an impressive ability to generate codes on competitive programming tasks. However, with limited sample numbers, LLMs still suffer from poor accuracy. Inspired by the process of human programming, we propose a generate-and-edit approach named Self-Edit that utilizes execution results of the generated code from LLMs to improve the code quality on the competitive programming task. We execute the generated code on the example test case provided in the question and wrap execution results into a supplementary comment. Utilizing this comment as guidance, our fault-aware code editor is employed to correct errors in the generated code. We perform extensive evaluations across two competitive programming datasets with nine different LLMs. Compared to directly generating from LLMs, our approach can improve the average of pass@1 by 89% on APPS-dev, 31% on APPS-test, and 48% on HumanEval over nine popular code generation LLMs with parameter sizes ranging from 110M to 175B. Compared to other post-processing methods, our method demonstrates superior accuracy and efficiency.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
06/04/2022

Fault-Aware Neural Code Rankers

Large language models (LLMs) have demonstrated an impressive ability to ...
research
01/22/2023

CodeScore: Evaluating Code Generation by Learning Code Execution

A proper code evaluation metric (CEM) profoundly impacts the evolution o...
research
05/11/2023

Enabling Programming Thinking in Large Language Models Toward Code Generation

Large Language Models (LLMs) (e.g., ChatGPT) have shown impressive perfo...
research
02/08/2022

Competition-Level Code Generation with AlphaCode

Programming is a powerful and ubiquitous problem-solving tool. Developin...
research
08/18/2022

An Empirical Evaluation of Competitive Programming AI: A Case Study of AlphaCode

AlphaCode is a code generation system for assisting software developers ...
research
06/26/2023

Discriminating Human-authored from ChatGPT-Generated Code Via Discernable Feature Analysis

The ubiquitous adoption of Large Language Generation Models (LLMs) in pr...
research
06/16/2023

Demystifying GPT Self-Repair for Code Generation

Large Language Models (LLMs) have shown remarkable aptitude in code gene...

Please sign up or login with your details

Forgot password? Click here to reset