Skip to main content
QUICK REVIEW

[논문 리뷰] Enhancing Code Generation Performance of Smaller Models by Distilling the Reasoning Ability of LLMs

Zhihong Sun, Chen Lyu|arXiv (Cornell University)|2024. 03. 20.
Natural Language Processing TechniquesComputer Science인용 수 5
한 줄 요약

이 논문은 CodePLAN을 소개합니다. 이는 더 작은 코드 생성 모델이 LLM에서 증류된 고품질 솔루션 계획을 생성하고 활용하도록 가르치는 다중 작업 증류 프레임워크로, APPS에서 pass@1를 130% 이상 향상시킵니다.

ABSTRACT

Large Language Models (LLMs) have recently made significant advances in code generation through the 'Chain-of-Thought' prompting technique. This technique empowers the model to autonomously devise "solution plans" to tackle intricate programming challenges, thereby improving its performance in code generation. Nevertheless, smaller models have been struggling to keep up with LLMs in deducing these plans, adversely affecting their code generation capabilities. Given the considerable size and associated deployment costs, along with concerns about data security, many teams opt for deploying smaller models for code generation. Consequently, there arises a compelling need for transferring LLMs' code generation reasoning abilities to the smaller models. In this paper, we propose the CodePLAN framework, which aims to transfer LLMs' reasoning capabilities to smaller models through distillation. We adopt a multi-task learning approach, jointly undertaking code generation and solution plan generation tasks, to enhance the code generation capabilities of the smaller model. To ensure the superior quality of the solution plans, we advocate for the utilization of backward reasoning and plan sampling strategies. Our experiments show that in comparison to the conventional fine-tuning approach, our approach improves the smaller model's code generation performance (measured in pass@1 metric) by over 130% on the challenging APPS benchmark.

연구 동기 및 목표

  • LLM과 같은 코드 생성 성능을 구현하기 위한 배포 비용이나 데이터 보안 문제 없이 더 작은 모델을 가능하게 하는 동기 부여.
  • LLM 추론을 증류하여 코드 생성과 계획 생성을 함께 학습하는 다중 작업 프레임워크를 개발합니다.
  • 역추론과 계획 샘플링을 통해Training 및 추론의 가이드를 위한 계획 품질을 향상시키는 것.
  • 계획 품질과 샘플링이 다운스트림 코드 생성 성능에 어떤 영향을 미치는지 조사합니다.

제안 방법

  • CodePLAN: 기본 모델이 코드 생성과 솔루션 계획 생성을 모두 학습하도록 하는 다중 작업 프레임워크를 제안합니다.
  • 높은 품질의 솔루션 계획을 제공하는 교사로 LLM을 사용하여 코드 생성과 계획 생성을 모두 최적화하는 결합 손실(L = (1-λ)L_code + λL_plan, λ=0.5)로 학습합니다.
  • 실제 해법에서 프로그래머와 유사한 솔루션 계획을 추출하기 위한 역추론을 도입하여 전방 문제 설명 기반 계획보다 계획 품질을 향상시킵니다.
  • 추론 시 계획 샘플링을 적용하여 여러 후보 계획을 생성하고, 단위 테스트를 통해 평가한 뒤 최적의 계획을 선택하여 코드 생성을 안내합니다.
  • 기본 모델에 계획 헤드를 추가하여 계획을 출력하도록 하여 코드와 계획 작업 간의 교대형 다중 작업 파인 튜닝을 가능하게 합니다.
  • APPS 및 MBPP 데이터셋에서 pass@k 지표로 평가하고 표준 파인 튜닝, CoT 및 RL 기반 기준선과 비교합니다.

실험 결과

연구 질문

  • RQ1LLM의 솔루션 계획을 더 작은 모델로 증류하면 코드 생성 성능이 향상될 수 있는가?
  • RQ2솔루션으로부터의 역추론이 문제 설명으로부터의 전방 계획보다 더 높은 품질의 계획 신호를 제공하는가?
  • RQ3추론 중 계획 샘플링이 생성 코드의 품질과 신뢰성에 어떤 영향을 미치는가?
  • RQ4다양한 데이터셋과 문제 난이도에서 CodePLAN이 표준 파인 튜닝에 비해 상대적으로 얼마나 개선되는가?

주요 결과

  • CodePLAN은 표준 파인 튜닝에 비해 APPS의 작은 모델 코드 생성 성능(pass@1)을 130% 이상 향상시킵니다.
  • 계획 중심 증류는 APPS와 MBPP에서 표준 파인 튜닝 및 CoT 기반 접근법보다 일관된 이점을 제공합니다.
  • 역추론은 문제 설명으로부터 직접 도출한 계획보다 더 높은 품질의 계획을 생성하여 다운스트림 코드 품질을 향상시킵니다.
  • 계획 샘플링은 단위 테스트로 여러 계획을 테스트해 코드 정확성을 크게 높이며, 샘플링 수가 N=1을 넘으면 그 이점이 커집니다.
  • CodePLAN은 코드 순위 기반 후처리(CodeRanker)와 상호 보완적이며 코드 정확도에 큰 합산 이점을 제공합니다.

이 논문 읽기

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

누빈트에서 이 논문 읽기

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