SelfEvolve: A Code Evolution Framework via Large Language Models

06/05/2023
by   Shuyang Jiang, et al.
0

Large language models (LLMs) have already revolutionized code generation, after being pretrained on publicly available code data. However, while various methods have been proposed to augment LLMs with retrieved knowledge and enhance the quality of code generation, the performance of these retrieval-based methods is limited by the strength of the retrievers used. In addition, while LLMs show great emergent ability, they still struggle to produce the correct code in one turn. To address these challenges, we propose a novel two-step pipeline, called , that leverages LLMs as both knowledge providers and self-reflective programmers. Unlike retrieval-based methods,  obtains the knowledge from input prompts and generates intermediate code based on the generated knowledge. After that,  asks LLM to act as an expert programmer to perform debugging for the generated code. This is achieved by receiving the error message from the interpreter, without requiring special test cases for correctness verification. We evaluate  on three code generation datasets, including DS-1000 for data science code, HumanEval for software engineering code, and TransCoder for C++-to-Python translation. Our empirical experiments show that  outperforms strong baselines by a significant margin on all datasets. We also conduct exhaustive analytical experiments to validate the effectiveness of the two stages of , and find that both are superior to other prompting-based methods. Further scalability analysis demonstrates that  can be adapted to other more advanced models, such as GPT-4, and bring consistent efficacy improvement.

READ FULL TEXT

page 15

page 16

page 17

research
05/02/2023

Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generation

Program synthesis has been long studied with recent approaches focused o...
research
02/10/2023

Large Language Models for Code: Security Hardening and Adversarial Testing

Large language models (LMs) are increasingly pretrained on massive codeb...
research
12/20/2022

Generation-Augmented Query Expansion For Code Retrieval

Pre-trained language models have achieved promising success in code retr...
research
01/31/2023

Numeracy from Literacy: Data Science as an Emergent Skill from Large Language Models

Large language models (LLM) such as OpenAI's ChatGPT and GPT-3 offer uni...
research
08/09/2023

Adaptive Intellect Unleashed: The Feasibility of Knowledge Transfer in Large Language Models

We conduct the first empirical study on using knowledge transfer to impr...
research
05/24/2023

ALGO: Synthesizing Algorithmic Programs with Generated Oracle Verifiers

Large language models (LLMs) excel at implementing code from functionali...
research
05/06/2023

TASTY: A Transformer based Approach to Space and Time complexity

Code based Language Models (LMs) have shown very promising results in th...

Please sign up or login with your details

Forgot password? Click here to reset