Skip to main content
QUICK REVIEW

[논문 리뷰] Exploring the Potential of ChatGPT in Automated Code Refinement: An Empirical Study

Qi Guo, Junming Cao|arXiv (Cornell University)|2023. 09. 15.
Software Engineering ResearchComputer Science인용 수 9
한 줄 요약

본 논문은 리뷰 코멘트를 기반으로 코드 정제를 위한 ChatGPT를 실증적으로 평가하며, 새로운 데이터셋에서 CodeReviewer보다 일반화가 더 낫지만 개선의 여지가 있음을 보여주고, 프롬프트, 온도 및 오류의 근본 원인을 분석합니다.

ABSTRACT

Code review is an essential activity for ensuring the quality and maintainability of software projects. However, it is a time-consuming and often error-prone task that can significantly impact the development process. Recently, ChatGPT, a cutting-edge language model, has demonstrated impressive performance in various natural language processing tasks, suggesting its potential to automate code review processes. However, it is still unclear how well ChatGPT performs in code review tasks. To fill this gap, in this paper, we conduct the first empirical study to understand the capabilities of ChatGPT in code review tasks, specifically focusing on automated code refinement based on given code reviews. To conduct the study, we select the existing benchmark CodeReview and construct a new code review dataset with high quality. We use CodeReviewer, a state-of-the-art code review tool, as a baseline for comparison with ChatGPT. Our results show that ChatGPT outperforms CodeReviewer in code refinement tasks. Specifically, our results show that ChatGPT achieves higher EM and BLEU scores of 22.78 and 76.44 respectively, while the state-of-the-art method achieves only 15.50 and 62.88 on a high-quality code review dataset. We further identify the root causes for ChatGPT's underperformance and propose several strategies to mitigate these challenges. Our study provides insights into the potential of ChatGPT in automating the code review process, and highlights the potential research directions.

연구 동기 및 목표

  • 리뷰 코멘트를 기반으로 코드를 정제하는 ChatGPT의 능력을 최신 기법인 CodeReviewer와 비교해 평가한다.
  • ChatGPT의 성능을 극대화하는 설정(프롬프트와 온도)을 확인한다.
  • ChatGPT의 저성과 상황을 조사하고 근본 원인을 밝혀낸다.
  • 일반화 평가를 위한 고품질 CodeReview-New 데이터셋을 제안하고 완화 전략을 제시한다.

제안 방법

  • CodeReview를 기준선으로 사용하고 일반화 테스트를 위한 CodeReview-New를 구성한다.
  • 다중 데이터셋에서 CodeReviewer에 대해 제로샷 GPT-3.5-Turbo로 ChatGPT를 평가한다.
  • EM 및 BLEU 지표에 미치는 영향을 평가하기 위해 프롬프트와 온도를 체계적으로 변화시킨다.
  • 실용적 코드 정제 결과를 더 잘 반영하기 위해 EM-trim 및 BLEU-trim을 도입한다.
  • 근본 원인과 완화 전략을 식별하기 위한 실패 사례에 대한 질적 분석을 수행한다.
  • RQ4의 미향상 사례에서 GPT-4(GPT-4)와의 비교를 선택적으로 수행한다.
Figure 1. Overview of our study
Figure 1. Overview of our study

실험 결과

연구 질문

  • RQ1RQ1: 서로 다른 ChatGPT 프롬프트와 온도 설정이 코드 정제 성능에 어떤 영향을 미치는가?
  • RQ2RQ2: 표준 데이터셋과 새로운 데이터셋에서 ChatGPT는 최첨단 CodeReviewer와 어떻게 비교되는가?
  • RQ3RQ3: 어떤 케이스에서 ChatGPT가 잘 작동하거나 실패하는가, 정성적 패턴은 무엇이 나타나는가?
  • RQ4RQ4: ChatGPT의 저성과 케이스의 근본 원인은 무엇이며 이를 어떻게 완화할 수 있는가?

주요 결과

  • 낮은 온도(0)와 간결한 프롬프트가 일반적으로 가장 강하고 안정적인 결과를 낳는다.
  • 시나리오 설명을 포함한 프롬프트 변형(P2, P5)이 다른 프롬프트보다 우수하고, 지나치게 상세한 프롬프트(P3)는 성능에 악영향을 줄 수 있다.
  • CodeReview-New 데이터셋에서 ChatGPT가 EM-T 및 BLEU-T에서 CodeReviewer를 능가한다(EM-T: 22.78대 15.50; BLEU-T: 76.44 대 62.88).
  • CodeReview-New에서 ChatGPT가 CodeReview보다 더 높은 EM 및 BLEU를 달성하여 보지 않은 언어와 리뷰에 대한 일반화가 더 잘 이루어짐을 시사한다.
  • CodeReview(CR)에서 ChatGPT의 EM은 16.70(EM), 19.47(EM-T); BLEU는 68.26, BLEU-T 75.12로 기존 벤치마크에서의 개선 여지가 남아 있음을 강조한다.
  • 근본 원인 분석은 리뷰 이해도, 과잉 삭제, 추가 수정, 그리고 정답의 모호성을 주요 실패 모드로 식별한다.
Figure 2. Construction strategies of Prompt 1 and Prompt 2
Figure 2. Construction strategies of Prompt 1 and Prompt 2

이 논문 읽기

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

누빈트에서 이 논문 읽기

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