[논문 리뷰] Prompt Engineering or Fine-Tuning: An Empirical Assessment of LLMs for Code
이 연구는 GPT-4 프롬프트 전략을 미세조정된 LLM 베이스라인과 비교하고, 주석 생성, 코드 생성, 코드 번역에서, GPT-4와 대화식 프롬팅에 대한 질적 사용자 연구를 포함한다.
The rapid advancements in large language models (LLMs) have greatly expanded the potential for automated code-related tasks. Two primary methodologies are used in this domain: prompt engineering and fine-tuning. Prompt engineering involves applying different strategies to query LLMs, like ChatGPT, while fine-tuning further adapts pre-trained models, such as CodeBERT, by training them on task-specific data. Despite the growth in the area, there remains a lack of comprehensive comparative analysis between the approaches for code models. In this paper, we evaluate GPT-4 using three prompt engineering strategies -- basic prompting, in-context learning, and task-specific prompting -- and compare it against 17 fine-tuned models across three code-related tasks: code summarization, generation, and translation. Our results indicate that GPT-4 with prompt engineering does not consistently outperform fine-tuned models. For instance, in code generation, GPT-4 is outperformed by fine-tuned models by 28.3% points on the MBPP dataset. It also shows mixed results for code translation tasks. Additionally, a user study was conducted involving 27 graduate students and 10 industry practitioners. The study revealed that GPT-4 with conversational prompts, incorporating human feedback during interaction, significantly improved performance compared to automated prompting. Participants often provided explicit instructions or added context during these interactions. These findings suggest that GPT-4 with conversational prompting holds significant promise for automated code-related tasks, whereas fully automated prompt engineering without human involvement still requires further investigation.
연구 동기 및 목표
- ASE 작업에서 기본 프롬프트, 문맥 내, 작업 특화 프롬프트 등 자동 프롬프트 전략 하의 GPT-4의 효과를 미세조정된 LLM 베이스라인과 비교하여 평가한다.
- 주석 생성(SC to NL), 코드 생성(NL to SC), 코드 번역(SC to SC)의 세 가지 ASE 작업을 평가한다.
- ASE 작업을 위한 GPT-4 대화 상호작용에서 참가자들이 프롬프트를 어떻게 인식하고 발전시키는지 탐구한다.
- 완전 자동화된 프롬프트 엔지니어링이 미세조정보다 더 우수한지 여부를 조사하고 휴먼 인 더 루프 프롬팅의 공백을 확인한다.
제안 방법
- CodeXGLUE, HumanEval, MBPP 벤치마스를 사용한 정량적 비교로 세 가지 프롬프트 전략 하의 GPT-4를 공개된 미세조정 베이스라인과 대조 평가.
- 세 가지 프롬프트 전략: 기본 프롬프트, BM25 기반 예시 선택을 활용한 문맥 학습(In-context learning), 작업 특화 설계 프롬프트.
- BLEU, pass@1, ACC, CodeBLEU를 작업별 평가 지표로 사용.
- 작업 간 공정한 평가를 보장하기 위한 후처리 및 토크나이제이션 조정.
- 대화식 프롬프팅 및 프롬프트 진화 패턴 분석을 위한 27명 대학원생 및 10명의 업계 실무자와의 질적 사용자 연구.
실험 결과
연구 질문
- RQ1RQ1: 세 가지 ASE 작업에서 서로 다른 프롬프트 전략이 미세조정 베이스라인에 비해 GPT-4에 대해 얼마나 효과적인가.
- RQ2RQ2: 참여자들은 ASE 작업에서 기본 프롬프트를 사용한 GPT-4의 유용성을 어떻게 인식하는가.
- RQ3RQ3: 참가자들은 ASE 작업을 위한 GPT-4와 상호 작용할 때 프롬프트를 어떻게 다듬는가.
- RQ4RQ4: 다른 프롬프트 진화 패턴이 GPT-4의 ASE 작업 성능에 어떤 영향을 미치는가.
주요 결과
- 가장 우수한 프롬프트 전략을 적용한 GPT-4은 주석 생성에서 1위 미세조정 모델보다 평균 8.33 BLEU 포인트 앞섰다.
- 코드 생성의 경우, 1위 미세조정 모델이 GPT-4의 최고 프롬프트보다 평균 16.61 및 28.3 BLEU 포인트 앞섰다.
- 코드 번역에서 GPT-4와 미세조정 베이스라인은 동률을 이루고 있으며, 각자 다른 번역 작업에서 서로를 능가한다.
- GPT-4와의 대화식 프롬프팅은 세 가지 ASE 작업 모두에서 자동 프롬프트 전략에 비해 유의미한 성능 향상을 보였으며(해당 작업에서 각각 15.8%, 11.83%, 16.1% 향상).
- 질적 결과는 인간이 유용한 피드백, 맥락 및 지시를 제공하여 GPT-4 출력물을 크게 향상시키며, 인간-루프 프롬프트의 가능성을 강조한다.
이 논문 읽기
누빈트 뷰어에서 원문을 열고, 읽으면서 궁금한 곳을 바로 물어보세요.
누빈트에서 이 논문 읽기이 리뷰는 AI가 논문 원문을 바탕으로 만들었습니다. 인용하기 전에 원문을 확인해 주세요.