Skip to main content
QUICK REVIEW

[논문 리뷰] LLM-Assisted Code Cleaning For Training Accurate Code Generators

Naman Jain, Tianjun Zhang|arXiv (Cornell University)|2023. 11. 25.
Software Engineering Research인용 수 4
한 줄 요약

이 논문은 코드 생성 성능을 햖스키기 위해 훈련 데이터를 더 읽기 쉽게 하고 모듈러하게 만드는 데에 LLM을 활용한 새로운 데이터 정제 파이프라인을 제안한다. 변수 이름을 바꾸고, 복잡한 코드를 보조 함수로 분해하며, 자연어 계획을 삽입함으로써, 원본 데이터셋에 비해 CodeLLaMa-7B의 정확도를 최대 30% 향상시킨다. 이는 단지 정제된 데이터의 15%만을 사용해도 더 큰 폐쇄형 모델인 AlphaCode를 능가하는 성능을 내는 등, 고품질 데이터의 효과를 입증한다.

ABSTRACT

Natural language to code generation is an important application area of LLMs and has received wide attention from the community. The majority of relevant studies have exclusively concentrated on increasing the quantity and functional correctness of training sets while disregarding other stylistic elements of programs. More recently, data quality has garnered a lot of interest and multiple works have showcased its importance for improving performance. In this work, we investigate data quality for code and find that making the code more structured and readable leads to improved code generation performance of the system. We build a novel data-cleaning pipeline that uses these principles to transform existing programs by 1.) renaming variables, 2.) modularizing and decomposing complex code into smaller helper sub-functions, and 3.) inserting natural-language based plans via LLM based transformations. We evaluate our approach on two challenging algorithmic code generation benchmarks and find that fine-tuning CodeLLaMa-7B on our transformed modularized programs improves the performance by up to 30% compared to fine-tuning on the original dataset. Additionally, we demonstrate improved performance from using a smaller amount of higher-quality data, finding that a model fine-tuned on the entire original dataset is outperformed by a model trained on 15% of our cleaned dataset. Even in comparison to closed-source models, our models outperform the much larger AlphaCoder models.

연구 동기 및 목표

  • 기능 정확성 이상의 데이터 품질 향상을 통해 코드 생성 성능을 향상시키기.
  • 훈련 데이터의 가독성, 모듈성, 구조적 명확성이 모델 성능에 미치는 영향을 조사하기.
  • 기존 코드 데이터셋을 고품질로 개선하면서도 기능 정확성을 유지하는 자동화된 LLM 기반 파이프라인 개발하기.
  • 고품질 데이터가 데이터 효율성을 향상시켜 대규모 훈련 세트의 필요성을 줄일 수 있음을 입증하기.
  • 프로그래밍의 최고 실천 방법을 식별하고 적용함으로써 데이터 정제 프레임워크를 구축하기.

제안 방법

  • 지시 흐름에 맞춘 LLM을 사용해 세 가지 반복적 변환을 수행: 맥락에 맞는 변수 이름 변경, 코드의 모듈화를 통한 보조 함수 분리, 주석으로 상향식 자연어 계획 삽입.
  • 각 변환을 자연어 프롬프트와 입력-출력 예시를 사용해 기존 프로그램과 변환된 프로그램 간의 기능 동일성을 보장하기.
  • 코드를 처음부터 생성하는 것보다 수정하는 것이 더 쉬운 점을 활용해, LLM을 통해 기존 프로그램을 개선하는 방식으로, 처음부터 생성하는 것보다 효율적으로 활용하기.
  • 기본 테스트 데이터셋(APPS 및 Code-Contests)의 프로그램을 정제, 모듈화, 계획화된 버전으로 변환하여 평행 데이터셋을 구축하기.
  • 원본 데이터셋과 변환된 데이터셋에 대해 CodeLLaMa-7B를 미세조정하여 성능 향상을 평가하기.
  • 입력-출력 예시를 활용해 변환된 프로그램이 원본 프로그램과 동일한 출력을 내는지 검증하기.
Figure 1: The overview of our code cleaning approach . We apply instruction-tuned LLMs to transform existing datasets by providing natural language prompts and use input-output examples to maintain function equivalence between original and transformed programs. Our cleaning approach works in three s
Figure 1: The overview of our code cleaning approach . We apply instruction-tuned LLMs to transform existing datasets by providing natural language prompts and use input-output examples to maintain function equivalence between original and transformed programs. Our cleaning approach works in three s

실험 결과

연구 질문

  • RQ1데이터 정제를 통해 코드의 가독성과 모듈성을 향상시키면 코드 생성 모델의 성능에 어떤 영향을 미치는가?
  • RQ2더 작은 고품질 데이터셋이 더 큰 저품질 데이터셋보다 코드 생성 모델의 미세조정 성능을 높일 수 있는가?
  • RQ3변수 이름 변경, 모듈화, 계획 주석과 같은 LLM 기반 변환이 모델의 일반화 능력과 기능 정확성에 얼마나 기여하는가?
  • RQ4코드에 자연어 계획을 포함시키면 순수한 코드만 있는 경우보다 모델 성능이 향상되는가?
  • RQ5프로그래밍 최고 실천 방법을 강조하는 데이터 정제 기법이 코드 생성 작업의 데이터 효율성 향상에 기여하는가?

주요 결과

  • 정제되고 모듈화된 데이터셋으로 CodeLLaMa-7B를 미세조정하면 원본 데이터셋으로 미세조정한 경우에 비해 성능이 최대 30% 향상되었다.
  • 정제된 데이터셋의 단지 15%만을 사용해 미세조정한 모델이 원본 데이터셋 전체를 사용한 모델보다 뛰어난 성능을 보였으며, 이는 높은 데이터 효율성 향상을 입증한다.
  • 더 나은 변수 이름, 모듈화된 함수, 상향식 계획 주석을 포함한 정제된 데이터셋은 모델 출력에서 더 체계적이고 가독성 있는 코드를 생성하는 데 기여했다.
  • 더 큰 폐쇄형 모델인 AlphaCode와 비교해도, 정제된 데이터로 훈련된 미세조정된 CodeLLaMa-7B 모델은 알고리즘 기반 코드 생성 벤치마크에서 뛰어난 성능을 보였다.
  • LLM 기반 정제 파이프라인이 기존 프로그램을 고품질로 변환하면서도 기능 정확성을 유지했으며, 입력-출력 테스트를 통한 검증을 통해 이를 확인했다.
  • 데이터 품질, 특히 구조성과 가독성의 향상이 데이터셋 크기와 무관하게 코드 생성 성능에 측정 가능한 상당한 영향을 미친다는 점을 입증했다.
Figure 3: Effect of quality on data-efficiency of the model . Finetuning on 15% of clean $\mathcal{D}_{modular}$ dataset results in similar performance as finetuning on the entire $\mathcal{D}_{original}$ dataset.
Figure 3: Effect of quality on data-efficiency of the model . Finetuning on 15% of clean $\mathcal{D}_{modular}$ dataset results in similar performance as finetuning on the entire $\mathcal{D}_{original}$ dataset.

더 나은 연구,지금 바로 시작하세요

논문 읽기부터 검토까지, 연구 시간을 획기적으로 줄여보세요.

카드 등록 없음 · 무료 플랜 제공

이 리뷰는 AI가 만들고, 인간 에디터가 검토했습니다.