[Paper Review] RAG-Enhanced Commit Message Generation
This paper proposes REACT, a retrieval-augmented framework that enhances commit message generation by retrieving relevant code diff and commit message pairs as exemplars to guide pre-trained language models (PLMs) and large language models (LLMs). By integrating these exemplars via fine-tuning or in-context learning, REACT boosts performance across multiple models, achieving a new state-of-the-art (SOTA) with up to 102% BLEU improvement on Llama 3 and 55% on CodeT5.
Commit message is one of the most important textual information in software development and maintenance. However, it is time-consuming to write commit messages manually. Commit Message Generation (CMG) has become a research hotspot. Recently, several pre-trained language models (PLMs) and large language models (LLMs) with code capabilities have been introduced, demonstrating impressive performance on code-related tasks. Meanwhile, prior studies have explored the utilization of retrieval techniques for CMG, but it is still unclear what effects would emerge from combining advanced retrieval techniques with various generation models. This paper proposed REACT, a REtrieval-Augmented framework for CommiT message generation. It integrates advanced retrieval techniques with different PLMs and LLMs, to enhance the performance of these models on the CMG task. Specifically, a hybrid retriever is designed and used to retrieve the most relevant code diff and commit message pair as an exemplar. Then, the retrieved pair is utilized to guide and enhance the CMG task by PLMs and LLMs through fine-tuning and in-context learning. The experimental results show that REACT significantly enhances these models' performance on the CMG task, improving the BLEU score of CodeT5 by up to 55%, boosting Llama 3's BLEU score by 102%, and substantially surpassing all baselines.
Motivation & Objective
- To address the time-consuming and inconsistent quality of manual commit message writing in software development.
- To explore how retrieval-augmented generation (RAG) can improve commit message generation (CMG) beyond existing methods.
- To evaluate the effectiveness of integrating advanced retrieval techniques with diverse code-capable language models (PLMs and LLMs).
- To establish a generalizable framework that enhances CMG performance across multiple models without requiring task-specific training from scratch.
- To investigate whether retrieval of similar code-commit pairs can significantly improve generation quality beyond standard prompting or fine-tuning.
Proposed method
- Design and implement a hybrid retriever to retrieve the most relevant code diff and commit message pair from a codebase as an exemplar.
- Use the retrieved exemplar to augment the input context for both pre-trained language models (PLMs) and large language models (LLMs).
- Apply in-context learning with the exemplar for LLMs and fine-tune PLMs using the retrieved exemplar as additional training signal.
- Integrate the exemplar information into the generation process to guide more accurate and contextually relevant commit message generation.
- Leverage the prior knowledge in code-capable language models (CLMs) such as CodeT5, Llama 3, and others to improve generation without full retraining.
- Evaluate the framework on a widely used benchmark dataset to ensure reproducibility and generalizability.

Experimental results
Research questions
- RQ1Can retrieval-augmented generation significantly improve commit message generation performance across diverse pre-trained and large language models?
- RQ2How does integrating retrieved exemplars affect the quality of generated commit messages compared to standard prompting or fine-tuning?
- RQ3Does the performance gain from retrieval vary across different types of language models (PLMs vs. LLMs)?
- RQ4Can a unified framework effectively enhance multiple models without requiring model-specific retraining?
- RQ5To what extent does the quality of retrieved exemplars influence the final generation outcome?
Key findings
- REACT achieves a new state-of-the-art (SOTA) performance on the commit message generation task, surpassing all prior baselines.
- The framework improves the BLEU score of CodeT5 by up to 55% through retrieval-augmented fine-tuning.
- Llama 3’s BLEU score is boosted by 102% when using the REACT framework with in-context learning.
- The performance gains are consistent across multiple models, demonstrating the broad applicability of the retrieval-augmented approach.
- The results confirm that leveraging prior knowledge from CLMs in conjunction with relevant exemplars significantly enhances generation quality.
- The framework shows strong effectiveness even with default hyperparameters, indicating robustness to model-specific configurations.

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.