ReGAL: 일반화 가능한 추상화를 발견하기 위한 프로그램 리팩토링
ReGAL: Refactoring Programs to Discover Generalizable Abstractions
January 29, 2024
저자: Elias Stengel-Eskin, Archiki Prasad, Mohit Bansal
cs.AI
초록
대규모 언어 모델(LLM)이 프로그램 합성에 점점 더 많이 사용되고 있지만, 이들은 유용한 추상화를 개발하는 데 필요한 전역적 관점이 부족하다. 일반적으로 이러한 모델은 프로그램을 하나씩 예측하며, 종종 동일한 기능을 반복한다. 처음부터 중복 코드를 생성하는 것은 비효율적일 뿐만 아니라 오류가 발생하기 쉽다. 이를 해결하기 위해, 우리는 코드 리팩토링(즉, 실행 결과를 변경하지 않고 코드를 재구성하는 것)을 통해 재사용 가능한 함수 라이브러리를 학습하는 경사 하강법이 필요 없는 방법인 ReGAL(Refactoring for Generalizable Abstraction Learning)을 제안한다. ReGAL은 소규모의 기존 프로그램 집합에서 학습하며, 실행을 통해 추상화를 반복적으로 검증하고 개선한다. 우리는 ReGAL이 발견한 공유 함수 라이브러리가 다양한 도메인에서 프로그램을 더 쉽게 예측할 수 있게 만든다는 것을 발견했다. 세 가지 데이터셋(LOGO 그래픽 생성, 날짜 추론, 그리고 Minecraft 기반 텍스트 게임인 TextCraft)에서, 오픈소스 및 독점 LLM 모두 ReGAL 함수를 사용하여 프로그램을 예측할 때 정확도가 향상되었다. CodeLlama-13B의 경우, ReGAL은 그래픽에서 11.5%, 날짜 이해에서 26.1%, TextCraft에서 8.1%의 절대 정확도 증가를 보였으며, 세 도메인 중 두 도메인에서 GPT-3.5를 능가했다. 우리의 분석은 ReGAL의 추상화가 자주 사용되는 서브루틴과 환경 역학을 캡슐화한다는 것을 보여준다.
English
While large language models (LLMs) are increasingly being used for program
synthesis, they lack the global view needed to develop useful abstractions;
they generally predict programs one at a time, often repeating the same
functionality. Generating redundant code from scratch is both inefficient and
error-prone. To address this, we propose Refactoring for Generalizable
Abstraction Learning (ReGAL), a gradient-free method for learning a library of
reusable functions via code refactorization, i.e. restructuring code without
changing its execution output. ReGAL learns from a small set of existing
programs, iteratively verifying and refining its abstractions via execution. We
find that the shared function libraries discovered by ReGAL make programs
easier to predict across diverse domains. On three datasets (LOGO graphics
generation, Date reasoning, and TextCraft, a Minecraft-based text game), both
open-source and proprietary LLMs improve in accuracy when predicting programs
with ReGAL functions. For CodeLlama-13B, ReGAL results in absolute accuracy
increases of 11.5% on graphics, 26.1% on date understanding, and 8.1% on
TextCraft, outperforming GPT-3.5 in two of three domains. Our analysis reveals
ReGAL's abstractions encapsulate frequently-used subroutines as well as
environment dynamics.