Skip to main content
QUICK REVIEW

[Paper Review] Generating Commit Messages from Git Diffs

S. R. P. van Hal, Matt Post|arXiv (Cornell University)|Nov 26, 2019
Software Engineering ResearchComputer Science25 references8 citations
TL;DR

This paper reproduces Jiang et al.'s (2017) neural sequence-to-sequence model for generating commit messages from Git diffs and evaluates a novel, more rigorous preprocessing technique. While the reproduction achieves slightly better BLEU scores than the original, the new preprocessing drastically reduces performance—dropping BLEU by at least 78%—revealing that current models rely on memorizing patterns like path names and frequent phrases rather than understanding code semantics.

ABSTRACT

Commit messages aid developers in their understanding of a continuously evolving codebase. However, developers not always document code changes properly. Automatically generating commit messages would relieve this burden on developers. Recently, a number of different works have demonstrated the feasibility of using methods from neural machine translation to generate commit messages. This work aims to reproduce a prominent research paper in this field, as well as attempt to improve upon their results by proposing a novel preprocessing technique. A reproduction of the reference neural machine translation model was able to achieve slightly better results on the same dataset. When applying more rigorous preprocessing, however, the performance dropped significantly. This demonstrates the inherent shortcoming of current commit message generation models, which perform well by memorizing certain constructs. Future research directions might include improving diff embeddings and focusing on specific groups of commits.

Motivation & Objective

  • Reproduce Jiang et al.'s (2017) neural sequence-to-sequence model for commit message generation to validate its results.
  • Investigate whether a more rigorous preprocessing pipeline improves model performance on commit message generation.
  • Collect and analyze two new datasets from top 1000 Java and C# GitHub projects to assess generalization across languages.
  • Identify limitations in current models, particularly their reliance on memorization of surface-level patterns like path names and common phrases.
  • Explore future directions such as code embedding techniques and commit type-specific modeling to improve semantic understanding of code changes.

Proposed method

  • Implement an attentional RNN encoder-decoder model based on Jiang et al. (2017), using LSTMs and sequence-to-sequence learning.
  • Apply greedy decoding during inference to generate commit messages token-by-token based on highest probability predictions.
  • Design a novel preprocessing pipeline to clean noisy commits, remove irrelevant content, and standardize diff formatting.
  • Train the model on the original and preprocessed datasets, including new datasets from top 1000 Java and C# projects.
  • Use BLEU scores as the primary evaluation metric to compare performance across different preprocessing strategies and datasets.
  • Explore alternative approaches such as code embeddings (e.g., Code2Vec) to represent code changes, though these were deemed infeasible due to variable input size and model limitations.

Experimental results

Research questions

  • RQ1RQ1: Can the results from Jiang et al. (2017) be reproduced using the same dataset and model architecture?
  • RQ2RQ2: Does applying a more rigorous preprocessing technique improve the performance of the neural commit message generation model?
  • RQ3RQ3: How does the model perform on newly collected datasets from top 1000 Java and C# projects after applying the novel preprocessing?
  • RQ4RQ4: What are the underlying failure modes of current models, particularly in relation to memorization of surface-level patterns?
  • RQ5RQ5: What future research directions could improve the semantic understanding of code changes in commit message generation?

Key findings

  • The reproduction of Jiang et al.'s (2017) model achieved slightly better BLEU scores than the original on the same dataset, confirming reproducibility.
  • The novel preprocessing technique, intended to remove noise and improve data quality, reduced BLEU scores by at least 78% across all datasets tested.
  • The performance drop indicates that current models rely heavily on memorizing frequent path names and common commit message phrases rather than understanding code semantics.
  • The model’s high performance on raw data is attributed to pattern memorization, not generalization, exposing a fundamental limitation in current approaches.
  • The failure of the preprocessing pipeline suggests that removing noise may inadvertently strip essential signals the model uses for prediction.
  • Future improvements may require better code embeddings that capture structural changes or training separate models for different commit types (e.g., additions, deletions, refactors).

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.