합성 편집 시퀀스로 언어 모델을 훈련시키면 코드 합성이 개선됩니다.
Training Language Models on Synthetic Edit Sequences Improves Code Synthesis
October 3, 2024
저자: Ulyana Piterbarg, Lerrel Pinto, Rob Fergus
cs.AI
초록
소프트웨어 엔지니어들은 주로 기존 프로그램을 편집하여 코드를 작성합니다. 반면에 대형 언어 모델(Large Language Models, LLMs)은 자동 회귀적으로 한 번에 프로그램을 합성합니다. 이에 대한 하나의 설명은 오픈 소스 편집 데이터의 부족입니다. 코드 합성을 위한 고품질 지시 데이터가 이미 부족한 상황에서 고품질 편집 데이터는 더욱 부족합니다. 이 갭을 메우기 위해 우리는 LintSeq라는 합성 데이터 생성 알고리즘을 개발했습니다. 이 알고리즘은 린터를 사용하여 기존 코드를 리팩터링하여 순차적으로 프로그램을 작성할 수 있는 오류 없는 삽입을 절차적으로 샘플링하여 코드 편집의 시퀀스로 변환합니다. 이는 프로그램 차이의 연속으로 이루어진 텍스트 문자열로 편집 시퀀스를 출력합니다. LintSeq를 테스트하기 위해, 우리는 지시 + 프로그램 쌍 데이터셋을 지시 + 프로그램-차이-시퀀스 튜플로 리팩터링하는 데 사용합니다. 그런 다음, 2.6B에서 14B의 매개변수를 가진 여러 작은 LLMs에 대해 이 데이터셋의 리팩터링된 버전과 원본 모두에서 지시를 세밀하게 조정하여 코드 합성 벤치마크에서 제로샷 성능을 비교합니다. 반복 샘플링 중에, 편집 시퀀스를 세밀하게 조정한 모델이 기존 모델보다 다양한 프로그램을 생성하며, 이는 샘플의 함수로 벤치마크 커버리지에 대한 추론 시간 스케일링을 향상시킵니다. 예를 들어, HumanEval의 pass@50에서, 합성 편집 시퀀스에 대해 세밀하게 조정된 소형 LLMs는 GPT-4와 경쟁하며, 기준 데이터셋에 대해 세밀하게 조정된 모델보다 절대 점수에서 +20% (+/-3%)를 능가합니다. 마지막으로, 우리는 코드 이해를 위해 자체 소형 LMs를 사전 훈련시킵니다. 우리는 합성 코드 편집에 대해 소형 모델을 세밀하게 조정하는 것이 장치 내 모델 클래스에 대한 최첨단 코드 합성 결과를 도출한다는 것을 보여줍니다. 150M 매개변수 편집 시퀀스 LM은 Codex 및 AlphaCode를 포함한 두 배의 매개변수를 가진 코드 모델을 반복 샘플링을 포함하거나 미포함하여 능가하거나 맞먹습니다.
English
Software engineers mainly write code by editing existing programs. In
contrast, large language models (LLMs) autoregressively synthesize programs in
a single pass. One explanation for this is the scarcity of open-sourced edit
data. While high-quality instruction data for code synthesis is already scarce,
high-quality edit data is even scarcer. To fill this gap, we develop a
synthetic data generation algorithm called LintSeq. This algorithm refactors
existing code into a sequence of code edits by using a linter to procedurally
sample across the error-free insertions that can be used to sequentially write
programs. It outputs edit sequences as text strings consisting of consecutive
program diffs. To test LintSeq, we use it to refactor a dataset of instruction
+ program pairs into instruction + program-diff-sequence tuples. Then, we
instruction finetune a series of smaller LLMs ranging from 2.6B to 14B
parameters on both the re-factored and original versions of this dataset,
comparing zero-shot performance on code synthesis benchmarks. We show that
during repeated sampling, edit sequence finetuned models produce more diverse
programs than baselines. This results in better inference-time scaling for
benchmark coverage as a function of samples, i.e. the fraction of problems
"pass@k" solved by any attempt given "k" tries. For example, on HumanEval
pass@50, small LLMs finetuned on synthetic edit sequences are competitive with
GPT-4 and outperform models finetuned on the baseline dataset by +20% (+/-3%)
in absolute score. Finally, we also pretrain our own tiny LMs for code
understanding. We show that finetuning tiny models on synthetic code edits
results in state-of-the-art code synthesis for the on-device model class. Our
150M parameter edit sequence LM matches or outperforms code models with twice
as many parameters, both with and without repeated sampling, including Codex
and AlphaCode.Summary
AI-Generated Summary