[논문 리뷰] SelfEvolve: A Code Evolution Framework via Large Language Models
SelfEvolve은 모델이 먼저 코드 생성을 위한 자체 소스 지식을 생성하고, 후에 해석기 피드백 루프를 통해 이를 정제하는 두 단계의 LLM 주도 파이프라인을 활용하여 DS-1000, HumanEval, TransCoder 데이터셋에서 강한 향상을 달성하고 GPT-4와의 확장 가능한 개선을 가능하게 한다.
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 \autoknow, that leverages LLMs as both knowledge providers and self-reflective programmers. Unlike retrieval-based methods, \autoknow~obtains the knowledge from input prompts and generates intermediate code based on the generated knowledge. After that, \autoknow~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 \autoknow~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 \autoknow~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 \autoknow, and find that both are superior to other prompting-based methods. Further scalability analysis demonstrates that \autoknow~can be adapted to other more advanced models, such as GPT-4, and bring consistent efficacy improvement.
연구 동기 및 목표
- 검색 기반 프롬프트를 넘어 LLM을 지식 원천 및 디버거로 활용하여 강건한 데이터 과학 및 소프트웨어 공학 코드 생성을 촉진한다.
- 문제 프롬프트에서 필요한 지식을 내부적으로 생성하도록 LLM을 가능하게 하여 외부 리트리버에 대한 의존성을 제거한다.
- Python 해석기로 오류 피드백을 제공하는 자동 정제 루프를 통해 코드의 정확성과 강건함을 개선한다.
- 더 강력한 모델(예: GPT-4) 및 다양한 프로그래밍 태스크에 대한 확장성을 입증한다.
- 2단계 자체 진화가 강력한 프롬프트 기준선보다 우수한 결과를 낳는다는 경험적 근거를 제공한다.]
- method:[
- Two-stage pipeline where the LLM first generates knowledge conditioned on the problem, then produces a trial solution based on that knowledge.
- Knowledge generation uses prompts to extract necessary information from the problem context, potentially bypassing external retrievers (Eq. 4/5).
- A refinement loop uses a runnable program and an interpreter to produce error feedback, prompting the LLM to revise the code until it runs without exceptions or a iteration limit is reached (Eq. 6).
- The approach is evaluated with greedy decoding on DS-1000, HumanEval, and TransCoder benchmarks, comparing against DocPrompting and Self-Debugging baselines.
- The framework is shown to scale with GPT-4, improving performance on several libraries and HumanEval, with iterative refinement contributing additional gains.
제안 방법
- 두 단계 파이프라인에서 LLM은 먼저 문제를 조건으로 지식을 생성한 다음, 그 지식을 바탕으로 시도 솔루션을 생성합니다.
- 지식 생성은 문제 맥락에서 필요한 정보를 추출하기 위해 프롬프트를 사용하며, 외부 리트리버를 우회할 수 있습니다(Eq. 4/5).
- 정제 루프는 실행 가능한 프로그램과 해석기를 사용하여 오류 피드백을 제공하고, LLM이 예외 없이 실행되거나 반복 제한에 도달할 때까지 코드를 수정하도록 촉구합니다(Eq. 6).
- 이 접근법은 DS-1000, HumanEval, TransCoder 벤치마크에서 탐욕적 디코딩으로 평가되며 DocPrompting 및 Self-Debugging 기준선과 비교합니다.
- 프레임워크는 GPT-4로 확장 가능함을 보이고, 여러 라이브러리 및 HumanEval에서 성능을 개선하며, 반복 정제가 추가 이득을 제공합니다.
실험 결과
연구 질문
- RQ1자체적으로 생성된 지식을 생성하고 해석기로 코드를 정제하는 2단계 LLM 주도 프로세스가 리트리버 기반 프롬프트 기준선을 능가할 수 있는가?
- RQ2자가 생성 지식이 검색된 지식보다 더 높은 품질의 일반화된 코드를 낳는가?
- RQ3자가 정제 루프가 생성된 지식과 상호작용하여 코딩 태스크의 성능을 어떻게 향상시키는가?
- RQ4SelfEvolve가 GPT-4와 같은 더 강력한 모델로 DS-1000, HumanEval, TransCoder 데이터셋에서 얼마나 확장될 수 있는가?
- RQ5정제 루프의 반복 깊이가 다양한 과제 난이도에서 성능에 어떤 영향을 미치는가?
주요 결과
- SelfEvolve는 DS-1000에서 강력한 기준선보다 우수한 성능을 보여 Self-Debugging 및 DocPrompting보다 pass@1이 더 높다.
- HumanEval에서 ChatGPT를 활용한 SelfEvolve는 pass@1 및 pass@10에서 상당한 이득을 보이며 GPT-4 수준에 근접한다.
- TransCoder 기반의 C++에서 Python으로의 번역에서 ChatGPT를 사용한 SelfEvolve가 프롟밍 기준선 중에서 가장 높은 계산 정확도와 pass@1를 달성한다.
- GPT-4와의 앙상블은 DS-1000 라이브러리(Scipy, Pytorch, Sklearn, Matplotlib) 및 HumanEval에서 성능을 향상시키며, 자가 정제 모듈로 추가 이득을 얻는다.
- 자가 생성 지식은 사람의 평가에서 검색된 지식보다 더 높은 정밀도와 재현율을 보여 문제 의미에 더 잘 부합한다.
더 나은 연구,지금 바로 시작하세요
연구 설계부터 논문 작성까지, 연구 시간을 획기적으로 줄여보세요.
카드 등록 없음 · 무료 플랜 제공
이 리뷰는 AI가 만들고, 인간 에디터가 검토했습니다.