[Paper Review] Evaluating the Code Quality of AI-Assisted Code Generation Tools: An Empirical Study on GitHub Copilot, Amazon CodeWhisperer, and ChatGPT
An empirical comparison of GitHub Copilot, Amazon CodeWhisperer, and ChatGPT on code quality using the HumanEval benchmark, measuring validity, correctness, security, reliability, and maintainability.
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.
Motivation & Objective
- Assess the overall code quality of leading AI-assisted code generators on real-world prompts.
- Identify strengths and weaknesses in validity, correctness, security, reliability, and maintainability of generated code.
- Examine how docstrings and meaningful function names influence code quality.
- Track tool evolution over time to understand improvements across versions.
Proposed method
- Use HumanEval dataset with function prompts, docstrings, and unit tests as the evaluation base.
- Generate code with GitHub Copilot, Amazon CodeWhisperer, and ChatGPT in typical IDE/browser environments.
- Evaluate code validity by direct execution in Python to detect syntax/runtime errors.
- Assess code correctness via unit tests; compute Code Correctness Score as passed tests over total tests.
- Use SonarQube to measure Code Security (vulnerabilities), Code Reliability (bugs), and Code Maintainability (code smells).
- Conduct two additional experiments: (i) remove docstrings to test the impact of inputs (RQ2), (ii) replace with dummy function names to test naming impact (RQ3).
- Compare performances over time by testing updated tool versions (RQ4).

Experimental results
Research questions
- RQ1RQ1: What is the quality of the code generated by the tools, in terms of validity, correctness, security, reliability, and maintainability?
- RQ2RQ2: What is the impact of docstrings on generated code quality?
- RQ3RQ3: What is the impact of using meaningful function names on generated code quality?
- RQ4RQ4: How do the code generation tools evolve over time across versions?
Key findings
- ChatGPT produced the highest validity (93.3%), correctness (65.2% correct), and average correctness (78.1%) among the three tools.
- GitHub Copilot generated valid code for 91.5% of problems and 46.3% of solutions were correct; 30.5% were incorrect and 23.2% partially correct.
- Amazon CodeWhisperer generated valid code for 90.2% of problems and 31.1% of solutions were correct; 28.7% incorrect and 40.2% partially correct.
- Code quality under security/reliability/maintainability shows no security ratings below the maximum threshold; Copilot, CodeWhisperer, and ChatGPT each incurred minor bugs or code smells in a subset of problems (Copilot: 3 bugs; CodeWhisperer: 1 bug; ChatGPT: 2 bugs; maintainability smells varied across tools).
- Removing docstrings (RQ2) significantly lowered correctness across tools when only function signatures were provided (e.g., Copilot correctness dropped from 46.3% to 20.1%; CodeWhisperer from 31.1% to 14.6%; ChatGPT from 65.2% to 22.0%).
- Using dummy function names (RQ3) generally reduced validity and correctness but preserved some usefulness; validity remained high, but correctness dropped (e.g., Copilot 46.3% correct original vs. 42.1% with dummy names).
- Over time (RQ4), Copilot's validity remained around 91.5% with newer versions; CodeWhisperer showed a drop in validity to 90.2% from 95.1% in earlier results.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.