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

By Kechi Zhang, Zhuo Li, Jia Li, Ge Li, Zhi Jin. 2023

184 citations recorded by the source corpus.

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.

Subfields: Artificial Intelligence, Information Systems, Software, Code Generation & Program Synthesis, Software Engineering

How researchers see this paper

The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.

In Artificial Intelligence

  1. Zhi Jin
  2. Jianfeng Gao
  3. Armando Solar-Lezama
  4. Shin Yoo
  5. Mark Harman
  6. Theo X. Olausson
  7. Jeevana Priya Inala
  8. Kechi Zhang

In Information Systems

  1. Shin Yoo
  2. Mark Harman
  3. Shubho Sengupta
  4. Mitya Lyubarskiy
  5. Jie M. Zhang
  6. Angela Fan
  7. Beliz Gokkaya
  8. Armando Solar-Lezama

In Software

  1. Shin Yoo
  2. Mark Harman
  3. Shubho Sengupta
  4. Mitya Lyubarskiy
  5. Jie M. Zhang
  6. Angela Fan
  7. Beliz Gokkaya
  8. Armando Solar-Lezama

In Code Generation & Program Synthesis

  1. Armando Solar-Lezama
  2. Mark Harman
  3. Zhi Jin
  4. Rishabh Singh

In Software Engineering

  1. Mark Harman

Citations in the corpus