[논문 리뷰] Evaluating the Code Quality of AI-Assisted Code Generation Tools: An Empirical Study on GitHub Copilot, Amazon CodeWhisperer, and ChatGPT
HumanEval 벤치마크를 사용하여 GitHub Copilot, Amazon CodeWhisperer, ChatGPT의 코드 품질을 경험적으로 비교하고, 유효성, 정확성, 보안성, 신뢰성, 유지보수성을 측정한다.
Context: AI-assisted code generation tools have become increasingly prevalent in software engineering, offering the ability to generate code from natural language prompts or partial code inputs. Notable examples of these tools include GitHub Copilot, Amazon CodeWhisperer, and OpenAI's ChatGPT. Objective: This study aims to compare the performance of these prominent code generation tools in terms of code quality metrics, such as Code Validity, Code Correctness, Code Security, Code Reliability, and Code Maintainability, to identify their strengths and shortcomings. Method: We assess the code generation capabilities of GitHub Copilot, Amazon CodeWhisperer, and ChatGPT using the benchmark HumanEval Dataset. The generated code is then evaluated based on the proposed code quality metrics. Results: Our analysis reveals that the latest versions of ChatGPT, GitHub Copilot, and Amazon CodeWhisperer generate correct code 65.2%, 46.3%, and 31.1% of the time, respectively. In comparison, the newer versions of GitHub CoPilot and Amazon CodeWhisperer showed improvement rates of 18% for GitHub Copilot and 7% for Amazon CodeWhisperer. The average technical debt, considering code smells, was found to be 8.9 minutes for ChatGPT, 9.1 minutes for GitHub Copilot, and 5.6 minutes for Amazon CodeWhisperer. Conclusions: This study highlights the strengths and weaknesses of some of the most popular code generation tools, providing valuable insights for practitioners. By comparing these generators, our results may assist practitioners in selecting the optimal tool for specific tasks, enhancing their decision-making process.
연구 동기 및 목표
- 실제 프롬프트에서 선도적인 AI 보조 코드 생성기의 전반적인 코드 품질을 평가한다.
- 생성된 코드의 유효성, 정확성, 보안성, 신뢰성, 유지보수성에서 강점과 약점을 식별한다.
- 도큐스트링(docstrings)과 의미 있는 함수 이름이 코드 품질에 미치는 영향을 검토한다.
- 시간에 따른 도구의 진화를 추적하여 버전 간의 개선을 이해한다.
제안 방법
- 평가 기초로 함수 프롬프트, 도큐스트링, 단위 테스트가 포함된 HumanEval 데이터세트를 사용한다.
- 일반 IDE/브라우저 환경에서 GitHub Copilot, Amazon CodeWhisperer, ChatGPT로 코드를 생성한다.
- Python에서의 직접 실행을 통해 구문/런타임 오류를 감지하여 코드의 유효성을 평가한다.
- 단위 테스트를 통해 코드 정확성을 평가하고, Code Correctness Score를 passed tests / total tests로 계산한다.
- Code Security(취약점), Code Reliability(버그), Code Maintainability(코드 냄새)를 측정하기 위해 SonarQube를 사용한다.
- 두 가지 추가 실험을 수행한다: (i) 도큐스트링을 제거하여 입력의 영향을 테스트한다 (RQ2), (ii) 더미 함수 이름으로 교체하여 명명 영향(RQ3)을 테스트한다.
- 업데이트된 도구 버전을 테스트하여 시간에 따른 성능을 비교한다 (RQ4).

실험 결과
연구 질문
- RQ1RQ1: 도구가 생성한 코드의 품질은 유효성, 정확성, 보안성, 신뢰성, 유지보수성 측면에서 어떠한가?
- RQ2RQ2: 도큐스트링이 생성된 코드 품질에 미치는 영향은 무엇인가?
- RQ3RQ3: 의미 있는 함수 이름의 사용이 생성된 코드 품질에 미치는 영향은 무엇인가?
- RQ4RQ4: 버전 간에 코드 생성 도구가 시간에 따라 어떻게 진화하는가?
주요 결과
- ChatGPT는 세 도구 중에서 가장 높은 유효성(93.3%), 정확성(65.2%), 평균 정확도(78.1%)를 보였다.
- GitHub Copilot은 문제의 91.5%에서 유효한 코드를 생성했고 해결책의 46.3%가 정확했다; 30.5%는 부정확했고 23.2%는 부분적으로 정확했다.
- Amazon CodeWhisperer은 문제의 90.2%에서 유효한 코드를 생성했고 해결책의 31.1%가 정확했다; 28.7%가 부정확했고 40.2%는 부분적으로 정확했다.
- 보안/신뢰성/유지보수성에서 코드 품질은 최대 임계값 이하의 보안 등급이 나타나지 않으며; Copilot, CodeWhisperer, ChatGPT 각각 문제의 일부에서 경미한 버그 또는 코드 냄새를 발생시켰다( Copilot: 3 bugs; CodeWhisperer: 1 bug; ChatGPT: 2 bugs; maintainability smells는 도구별로 달랐다 ).
- 도큐스트링 제거(RQ2)는 함수 시그니처만 제공될 때 도구 전반의 정확성을 현저히 감소시켰다(예: Copilot의 정확도는 46.3%에서 20.1%로, CodeWhisperer는 31.1%에서 14.6%로, ChatGPT는 65.2%에서 22.0%로 하락).
- 더미 함수 이름 사용(RQ3)은 일반적으로 유효성 및 정확성을 감소시키지만 일부 유용성은 유지되었다; 유효성은 여전히 높았으나 정확성은 떨어졌다(예: Copilot 원본에서 46.3% 정답, 더미 이름 사용 시 42.1%).
- 시간에 따라(RQ4), 최신 버전에서 Copilot의 유효성은 약 91.5%를 유지했고; CodeWhisperer는 초기 결과의 95.1%에서 90.2%로 유효성이 하락했다.

이 논문 읽기
누빈트 뷰어에서 원문을 열고, 읽으면서 궁금한 곳을 바로 물어보세요.
누빈트에서 이 논문 읽기이 리뷰는 AI가 논문 원문을 바탕으로 만들었습니다. 인용하기 전에 원문을 확인해 주세요.