Prompting and Fine-tuning Large Language Models for Automated Code Review Comment Generation

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Haider, Md. Asif, Mostofa, Ayesha Binte, Mosaddek, Sk. Sabit Bin, Iqbal, Anindya, Ahmed, Toufique
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866912120471289856
author Haider, Md. Asif
Mostofa, Ayesha Binte
Mosaddek, Sk. Sabit Bin
Iqbal, Anindya
Ahmed, Toufique
author_facet Haider, Md. Asif
Mostofa, Ayesha Binte
Mosaddek, Sk. Sabit Bin
Iqbal, Anindya
Ahmed, Toufique
contents Generating accurate code review comments remains a significant challenge due to the inherently diverse and non-unique nature of the task output. Large language models pretrained on both programming and natural language data tend to perform well in code-oriented tasks. However, large-scale pretraining is not always feasible due to its environmental impact and project-specific generalizability issues. In this work, first we fine-tune open-source Large language models (LLM) in parameter-efficient, quantized low-rank (QLoRA) fashion on consumer-grade hardware to improve review comment generation. Recent studies demonstrate the efficacy of augmenting semantic metadata information into prompts to boost performance in other code-related tasks. To explore this in code review activities, we also prompt proprietary, closed-source LLMs augmenting the input code patch with function call graphs and code summaries. Both of our strategies improve the review comment generation performance, with function call graph augmented few-shot prompting on the GPT-3.5 model surpassing the pretrained baseline by around 90% BLEU-4 score on the CodeReviewer dataset. Moreover, few-shot prompted Gemini-1.0 Pro, QLoRA fine-tuned Code Llama and Llama 3.1 models achieve competitive results (ranging from 25% to 83% performance improvement) on this task. An additional human evaluation study further validates our experimental findings, reflecting real-world developers' perceptions of LLM-generated code review comments based on relevant qualitative metrics.
format Preprint
id arxiv_https___arxiv_org_abs_2411_10129
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Prompting and Fine-tuning Large Language Models for Automated Code Review Comment Generation
Haider, Md. Asif
Mostofa, Ayesha Binte
Mosaddek, Sk. Sabit Bin
Iqbal, Anindya
Ahmed, Toufique
Software Engineering
Computation and Language
Machine Learning
Generating accurate code review comments remains a significant challenge due to the inherently diverse and non-unique nature of the task output. Large language models pretrained on both programming and natural language data tend to perform well in code-oriented tasks. However, large-scale pretraining is not always feasible due to its environmental impact and project-specific generalizability issues. In this work, first we fine-tune open-source Large language models (LLM) in parameter-efficient, quantized low-rank (QLoRA) fashion on consumer-grade hardware to improve review comment generation. Recent studies demonstrate the efficacy of augmenting semantic metadata information into prompts to boost performance in other code-related tasks. To explore this in code review activities, we also prompt proprietary, closed-source LLMs augmenting the input code patch with function call graphs and code summaries. Both of our strategies improve the review comment generation performance, with function call graph augmented few-shot prompting on the GPT-3.5 model surpassing the pretrained baseline by around 90% BLEU-4 score on the CodeReviewer dataset. Moreover, few-shot prompted Gemini-1.0 Pro, QLoRA fine-tuned Code Llama and Llama 3.1 models achieve competitive results (ranging from 25% to 83% performance improvement) on this task. An additional human evaluation study further validates our experimental findings, reflecting real-world developers' perceptions of LLM-generated code review comments based on relevant qualitative metrics.
title Prompting and Fine-tuning Large Language Models for Automated Code Review Comment Generation
topic Software Engineering
Computation and Language
Machine Learning
url https://arxiv.org/abs/2411.10129