Skip to main content
QUICK REVIEW

[논문 리뷰] Improving Code Generation by Training with Natural Language Feedback

Angelica Chen, Jérémy Scheurer|arXiv (Cornell University)|2023. 03. 28.
Software Engineering ResearchComputer Science인용 수 10
한 줄 요약

요지는 이 논문이 사람의 자연어 피드백과 수정안을 활용한 학습 시 ILF(Imitation Learning from Language Feedback)를 도입하고, 이를 통해 CodeGen 모델의 합격률을 향상시키며 baselines의 파인튜닝 성능을 능가한다는 점을 제시합니다.

ABSTRACT

The potential for pre-trained large language models (LLMs) to use natural language feedback at inference time has been an exciting recent development. We build upon this observation by formalizing an algorithm for learning from natural language feedback at training time instead, which we call Imitation learning from Language Feedback (ILF). ILF requires only a small amount of human-written feedback during training and does not require the same feedback at test time, making it both user-friendly and sample-efficient. We further show that ILF can be seen as a form of minimizing the KL divergence to the ground truth distribution and demonstrate a proof-of-concept on a neural program synthesis task. We use ILF to improve a Codegen-Mono 6.1B model's pass@1 rate by 38% relative (and 10% absolute) on the Mostly Basic Python Problems (MBPP) benchmark, outperforming both fine-tuning on MBPP and fine-tuning on repaired programs written by humans. Overall, our results suggest that learning from human-written natural language feedback is both more effective and sample-efficient than training exclusively on demonstrations for improving an LLM's performance on code generation tasks.

연구 동기 및 목표

  • 테스트 시점이 아닌 학습 시점에서 인간이 작성한 피드백을 활용해 코드 생성 성능을 개선하려는 동기를 제시합니다.
  • ILF를 더 높은 품질의 코드의 ground-truth 분포에 대한 KL 발산을 최소화하는 방식으로 formalize합니다.
  • _MBPP와 인간이 수정한 데이터에 대해 표준 파인튜닝보다 ILF가 더 나은 성능을 낼 수 있음을 보여줍니다_.

제안 방법

  • 수정이 단위 테스트 통과율을 높이는 보상 기반 목표를 정의합니다.
  • 오 incorrect code x0를 피드백 f를 사용해 올바른 코드 x1로 변환하도록 학습된 수정 모델 πRefine을 만듭니다.
  • 피드백을 반영한 고품질 수정을 우선 샘플링하도록 제안 분포 qt를 구성합니다.
  • πRefine가 생성한 수정으로 기본 모델 θ를 미세조정해 θ*를 얻고, 이를 통해 반복적인 개선을 가능하게 만듭니다.
  • 기본 모델로 CodeGen-Mono 6.1B를 사용하고 MBPP를 평가 기준으로 Pass@k 지표를 사용합니다.
  • 제로샷, MBPP 골드 파인튜닝, InstructGPT 생성 수정안 등의 baselines와 ILF를 비교합니다.
Figure 1: An overview of imitation learning from language feedback (ILF) for code generation. Given an initial LLM $\pi_{\theta}$ , we sample programs from $\pi_{\theta}$ that do not pass unit tests (indicated by the red X). Human annotators write natural language feedback for the incorrect program
Figure 1: An overview of imitation learning from language feedback (ILF) for code generation. Given an initial LLM $\pi_{\theta}$ , we sample programs from $\pi_{\theta}$ that do not pass unit tests (indicated by the red X). Human annotators write natural language feedback for the incorrect program

실험 결과

연구 질문

  • RQ1인간이 작성한 자연어 피드백으로의 학습이 표준 시연보다 코드 생성 성능을 향상시킬 수 있는가?
  • RQ2ILF가 골드 MBPP 데이터나 인간이 작성한 수정안만 학습하는 것과 비교해 어떤 성능 차이가 있는가?
  • RQ3인간 피드백 대 모델 생성 피드백의 사용이 최종 통과율에 어떤 영향을 미치는가?
  • RQ4수정의 품질과 다수의 버그 처리 방식이 ILF의 효과에 어떤 영향을 미치는가?

주요 결과

  • ILF는 MBPP에서 CodeGen-Mono 6.1B의 Pass@1을 제로샷 대비 상대적으로 38% 향상(절대 10% 향상)시킵니다.
  • ILF는 MBPP 골드 프로그램에 대한 파인튜닝 및 인간 수정안에 의한 파인튜닝에서 Pass@1 기준으로 각각 14% 절대, 64% 상대(그리고 3% 절대, 9% 상대)의 이점을 보였습니다.
  • πRefine으로 생성된 수정안으로 파인튜닝하면 단일 피드백보다 큰 이득을 얻고 수정 통과율을 개선합니다(Pass@1: 19% vs 0% 제로샷; Pass@10: 47% vs 0%).
  • 인간이 작성한 피드백은 더 많은 버그를 다루고 InstructGPT 피드백보다 더 유익하여 더 큰 이익에 기여합니다.
  • 적은 양의 인간 수정안으로도 경쟁력 있는 개선을 얻을 수 있으며, ILF는 비교적 적은 피드백 샘플(총 122개)로도 효과적일 수 있습니다.
  • ILF는 더 높은 품질의 코드 분포에 대한 KL 발산을 최소화하는 실용적이고 샘플 효율적인 감독 학습의 한 형태로 볼 수 있습니다.
Figure 2: An example of a zero-shot LLM prompt for repairing incorrect code based on human-written feedback.
Figure 2: An example of a zero-shot LLM prompt for repairing incorrect code based on human-written feedback.

이 논문 읽기

누빈트 뷰어에서 원문을 열고, 읽으면서 궁금한 곳을 바로 물어보세요.

누빈트에서 이 논문 읽기

이 리뷰는 AI가 논문 원문을 바탕으로 만들었습니다. 인용하기 전에 원문을 확인해 주세요.