Exploring the potential of ChatGPT in automated code refinement: An empirical study

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 perf...

Full description

Saved in:
Bibliographic Details
Main Authors: QI, Guo, CAO, Junming, XIE, Xiaofei, LIU, Shangqing, LI, Xiaohong, CHEN, Bihuan, PENG, Xin
Format: text
Language:English
Published: Institutional Knowledge at Singapore Management University 2024
Subjects:
Online Access:https://ink.library.smu.edu.sg/sis_research/9175
https://ink.library.smu.edu.sg/context/sis_research/article/10180/viewcontent/2309.08221v1.pdf
Tags: Add Tag
No Tags, Be the first to tag this record!
Institution: Singapore Management University
Language: English
id sg-smu-ink.sis_research-10180
record_format dspace
spelling sg-smu-ink.sis_research-101802024-10-30T02:58:22Z Exploring the potential of ChatGPT in automated code refinement: An empirical study QI, Guo CAO, Junming XIE, Xiaofei LIU, Shangqing LI, Xiaohong CHEN, Bihuan PENG, Xin 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. 2024-04-01T07:00:00Z text application/pdf https://ink.library.smu.edu.sg/sis_research/9175 info:doi/10.1145/3597503.3623306 https://ink.library.smu.edu.sg/context/sis_research/article/10180/viewcontent/2309.08221v1.pdf http://creativecommons.org/licenses/by-nc-nd/4.0/ Research Collection School Of Computing and Information Systems eng Institutional Knowledge at Singapore Management University Automated code Code review Cutting edges Development process Empirical studi s; Error prone tasks High quality Language model Review process Software project Artificial Intelligence and Robotics Databases and Information Systems
institution Singapore Management University
building SMU Libraries
continent Asia
country Singapore
Singapore
content_provider SMU Libraries
collection InK@SMU
language English
topic Automated code
Code review
Cutting edges
Development process
Empirical studi
s; Error prone tasks
High quality
Language model
Review process
Software project
Artificial Intelligence and Robotics
Databases and Information Systems
spellingShingle Automated code
Code review
Cutting edges
Development process
Empirical studi
s; Error prone tasks
High quality
Language model
Review process
Software project
Artificial Intelligence and Robotics
Databases and Information Systems
QI, Guo
CAO, Junming
XIE, Xiaofei
LIU, Shangqing
LI, Xiaohong
CHEN, Bihuan
PENG, Xin
Exploring the potential of ChatGPT in automated code refinement: An empirical study
description 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.
format text
author QI, Guo
CAO, Junming
XIE, Xiaofei
LIU, Shangqing
LI, Xiaohong
CHEN, Bihuan
PENG, Xin
author_facet QI, Guo
CAO, Junming
XIE, Xiaofei
LIU, Shangqing
LI, Xiaohong
CHEN, Bihuan
PENG, Xin
author_sort QI, Guo
title Exploring the potential of ChatGPT in automated code refinement: An empirical study
title_short Exploring the potential of ChatGPT in automated code refinement: An empirical study
title_full Exploring the potential of ChatGPT in automated code refinement: An empirical study
title_fullStr Exploring the potential of ChatGPT in automated code refinement: An empirical study
title_full_unstemmed Exploring the potential of ChatGPT in automated code refinement: An empirical study
title_sort exploring the potential of chatgpt in automated code refinement: an empirical study
publisher Institutional Knowledge at Singapore Management University
publishDate 2024
url https://ink.library.smu.edu.sg/sis_research/9175
https://ink.library.smu.edu.sg/context/sis_research/article/10180/viewcontent/2309.08221v1.pdf
_version_ 1814777824208224256