Skip to main content
QUICK REVIEW

[논문 리뷰] Automatic Code Summarization via ChatGPT: How Far Are We?

Weisong Sun, Chunrong Fang|arXiv (Cornell University)|2023. 05. 22.
Software Engineering ResearchComputer Science인용 수 34
한 줄 요약

본 논문은 CSN-Python에서 자동 코드 요약을 위한 ChatGPT를 평가하고 SOTA 모델(NCS, CodeBERT, CodeT5)과 비교한다; ChatGPT는 BLEU와 ROUGE-L에서 낮은 성능을 보이나 METEOR에서 CodeT5와 비슷한 수준을 보인다.

ABSTRACT

To support software developers in understanding and maintaining programs, various automatic code summarization techniques have been proposed to generate a concise natural language comment for a given code snippet. Recently, the emergence of large language models (LLMs) has led to a great boost in the performance of natural language processing tasks. Among them, ChatGPT is the most popular one which has attracted wide attention from the software engineering community. However, it still remains unclear how ChatGPT performs in (automatic) code summarization. Therefore, in this paper, we focus on evaluating ChatGPT on a widely-used Python dataset called CSN-Python and comparing it with several state-of-the-art (SOTA) code summarization models. Specifically, we first explore an appropriate prompt to guide ChatGPT to generate in-distribution comments. Then, we use such a prompt to ask ChatGPT to generate comments for all code snippets in the CSN-Python test set. We adopt three widely-used metrics (including BLEU, METEOR, and ROUGE-L) to measure the quality of the comments generated by ChatGPT and SOTA models (including NCS, CodeBERT, and CodeT5). The experimental results show that in terms of BLEU and ROUGE-L, ChatGPT's code summarization performance is significantly worse than all three SOTA models. We also present some cases and discuss the advantages and disadvantages of ChatGPT in code summarization. Based on the findings, we outline several open challenges and opportunities in ChatGPT-based code summarization.

연구 동기 및 목표

  • ChatGPT의 자동 코드 요약 능력을 평가한다.
  • ChatGPT를 이용한 디스트리뷰션 내 주석 생성을 이끄는 효과적인 프롬프트를 확인한다.
  • CSN-Python에서 ChatGPT를 SOTA 코드 요약 모델과 벤치마킹한다.
  • ChatGPT 기반 코드 요약에서의 강점과 한계를 주제별 사례 분석을 통해 논의한다.

제안 방법

  • ChatGPT 피드백을 이끌어내는 휴리스틱한 질문을 설계하고 프롬프트를 작성한다.
  • CSN-Python 테스트 세트에 대해 디스트리뷰션 내 한 문장 주석 생성을 위한 프롬프트를 사용한다.
  • 생성된 주석을 실제 정답 요약과 BLEU, METEOR, ROUGE-L로 평가한다.
  • ChatGPT 결과를 NCS, CodeBERT, CodeT5 벤치마크와 비교한다.
  • 코드 요약에서의 ChatGPT의 강점과 약점을 분석하기 위한 사례 연구를 수행한다.

실험 결과

연구 질문

  • RQ1Can ChatGPT perform code summarization tasks effectively on CSN-Python?
  • RQ2What prompts yield concise, in-distribution comments from ChatGPT?
  • RQ3How does ChatGPT compare to SOTA code summarization models on standard metrics?
  • RQ4What are the strengths and limitations of ChatGPT in code summarization tasks?

주요 결과

  • ChatGPT (one sentence prompt) achieves BLEU 10.28, METEOR 14.40, ROUGE-L 20.81 on CSN-Python.
  • CodeT5 outperforms ChatGPT across BLEU (20.0), METEOR (14.7), and ROUGE-L (37.7).
  • CodeBERT outperforms ChatGPT on BLEU (18.7 vs 10.28) and ROUGE-L (34.8 vs 20.81).
  • NCS shows BLEU 15.8, METEOR 10.6, ROUGE-L 31.3, all below CodeT5 but above ChatGPT in BLEU/ROUGE-L.
  • METEOR shows ChatGPT comparable to CodeT5, and better than NCS/CodeBERT.
  • Prompt design studies indicate that a short, one-sentence prompt yields the best overall quantitative performance among tested ChatGPT configurations

이 논문 읽기

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

누빈트에서 이 논문 읽기

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