Manuscript Offprint

arXiv:2610.31552

CAMGen: A Core Change-Aware Multi-View Framework for Commit Message Generation

Bo Xiong, Weisheng Chen, Zongen Ren, Yifeng Zhu, Xutian Li, Runbang Yan, Chong Wang, Peng Liang

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

BO XIONG, School of Computer Science, Wuhan University, China and School of Computer Science, Peking University, China

WEISHENG CHEN, School of Computer Science, Wuhan University, China

ZONGEN REN, School of Computer Science, Wuhan University, China

YIFENG ZHU, School of Computer Science, Peking University, China

XUTIAN LI, School of Computer Science, Peking University, China

RUNBANG YAN, School of Computer Science, Peking University, China

CHONG WANG, School of Computer Science, Wuhan University, China

PENG LIANG, School of Computer Science, Wuhan University, China

Commit messages help developers understand code changes and support software maintenance. Recent approaches use repository context to improve commit message generation (CMG) with large language models (LLMs). However, existing CMG methods provide limited support for understanding how local edits affect functionality jointly implemented by multiple code entities. This functional understanding is essential for generating commit messages that explain the main change and its impact. To address this problem, we propose CAMGen, a core change-aware multi-view commit message generation framework that incorporates functional context into generation. CAMGen identifies core entities that represent the primary change intent. It then forms candidate functional units through repository-wide semantic clustering and uses those containing the core entities to construct a Functional Semantic View. This view supplies semantic context for interpreting the affected functionality. CAMGen also uses context provided by the Structural Dependency View and the Historical Exemplar View. The context from all three views is then provided to the LLM together with the code diff to guide CMG. The experimental results show that CAMGen outperforms representative CMG baselines across three programming languages. Human evaluation further shows that CAMGen generates more complete commit messages with clearer explanations of change rationale and impact. These results demonstrate the value of functional context and complementary repository information for CMG.

CCS Concepts: • Software and its engineering → Software maintenance tools.

Additional Key Words and Phrases: Commit Message Generation, Large Language Models, Semantic Clustering

Authors' addresses: Bo Xiong, School of Computer Science, Wuhan University, Wuhan, China and School of Computer Science, Peking University, Beijing, China, yueshaomoon_@whu.edu.cn; Weisheng Chen, School of Computer Science, Wuhan University, Wuhan, China, wisychan@whu.edu.cn; Zongen Ren, School of Computer Science, Wuhan University, Wuhan, China, zongnren@whu.edu.cn; Yifeng Zhu, School of Computer Science, Peking University, Beijing, China, yifengzhu25@stu.pku.edu.cn; Xutian Li, School of Computer Science, Peking University, Beijing, China, xtli25@stu.pku.edu.cn; Runbang Yan, School of Computer Science, Peking University, Beijing, China, rbyan25@stu.pku.edu.cn; Chong Wang, School of Computer Science, Wuhan University, Wuhan, China, cwang@whu.edu.cn; Peng Liang, School of Computer Science, Wuhan University, Wuhan, China, liangp@whu.edu.cn.

Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from permissions@acm.org.

© 2026 ACM.

ACM 1049-331X/2026/0-ART0

https://doi.org/10.1145/xxxxxxx.xxxxxxx

0:2

Xiong et al.

ACM Reference Format:

Bo Xiong, Weisheng Chen, Zongen Ren, Yifeng Zhu, Xutian Li, Runbang Yan, Chong Wang, and Peng Liang. 2026. CAMGen: A Core Change-Aware Multi-View Framework for Commit Message Generation. ACM Trans. Softw. Eng. Methodol. 0, 0, Article 0 (2026), 32 pages. https://doi.org/10.1145/xxxxxxx.xxxxxxx

1 INTRODUCTION

Commit messages are essential software artifacts through which developers record, understand, and communicate code changes. Prior work commonly characterizes the core content of a high-quality commit message in terms of what and why: what summarizes the primary code modifications, whereas why explains the motivation or intended objective of the change [38, 52]. Together, these two types of information allow developers to understand a commit without inspecting the entire diff or tracing its complete history, thereby supporting code review, program comprehension, collaborative development, and long-term maintenance. Commit Message Generation (CMG) aims to automatically generate natural-language commit messages from code changes. Early approaches primarily rely on predefined templates [3, 25] or formulate CMG as a diff-to-text translation task [14, 30]. Subsequent research uses the code understanding and natural-language generation capabilities of pretrained models and large language models (LLMs) while incorporating repository context, such as abstract syntax trees (ASTs), call graphs, dependency graphs, repository-level code fragments, and historical diff-message pairs [7, 20, 48, 49]. These approaches supplement code diffs with structural, semantic, and historical information and have substantially improved the quality of generated commit messages.

Despite this progress, representative CMG methods still select repository context primarily according to its direct relevance to a diff. Structural approaches expand context along dependencies near changed locations, semantic retrieval approaches return code fragments with representations similar to the diff, and history-based approaches retrieve similar diff-message pairs. These approaches treat individual code fragments, structural relations, or historical exemplars as the basic units of context construction for the code diff query, but they do not systematically identify and organize the program entities that jointly implement the affected functionality. Since the implementation of software functionality often spans multiple entities distributed across different files or modules, context captured through local structural expansion or fragment-level similarity retrieval typically covers only a subset of the entities that implement the functionality affected by the diff. Such partial context cannot fully reveal the functional units affected by a diff or the responsibilities of these units within the system. The key challenge is therefore to help LLMs understand code diffs from a functional perspective so that they can generate commit messages that accurately describe the primary change and its functional impact.

Motivation. Consider the scenario illustrated in Figure 1, which is drawn from commit b8a8f57 1^{1} in Apache Hudi project. The primary purpose of this commit is to add Hive-style partitioning support to the Flink writer, as expressed by the reference commit message written by the developer “[HUDI-2094] Supports hive style partitioning for flink writer”. The commit modifies multiple files. It introduces and propagates the Hive-style partitioning configuration, adjusts partition path parsing and reading logic, and extends the corresponding tests. Meanwhile, the diff also contains changes to configuration option names and local logic such as instantToWrite. These distributed and co-occurring edits make it difficult for the LLM to identify the primary functional intent of the commit. When the diff is supplemented with explicit structural dependency information, the LLM generates a commit message Refactor partition config options and fix instant write logic. This message identifies the changes to configuration options and write logic but

1^{1}https://github.com/apache/hudi/commit/b8a8f57

0:3

Figure

∗^{*} Only part of the code diff is shown due to space constraints.

Fig. 1. Motivating example of CMG with different context types.

still characterizes the commit as refactoring. Likewise, when the diff is supplemented with similar historical changes and their reference commit messages, the LLM generates Refactor partition configuration and fix checkpoint waiting logic in stream write. The historical context helps the model follow project-specific wording, but the generated message still focuses on local operations, such as configuration adjustments and checkpoint waiting logic, and fails to reveal the primary functional impact of adding Hive-style partitioning support. In contrast, when provided with context constructed through functional semantic clustering, the LLM generates feat(flink): Add Hive style partitioning support and rename URL encode option, which more closely reflects the primary intent expressed in the human-written commit message. This comparison between different context strategies shows that functionally cohesive repository context enables the model to associate relevant entities distributed across configuration declarations, parameter propagation, partition path processing, and test code with the same functional unit. The model can consequently understand the shared functional objective and behavioral impact of these local edits, thereby generating a commit message that accurately summarizes the primary modification and clearly explains its functional impact.

The limited ability of existing CMG methods to provide repository context that captures the functionality affected by code changes reduces the practical value of generated commit messages for developers and downstream software engineering tasks. Although a code diff records every edit in a commit, understanding the actual impact of these edits requires knowledge of the functional responsibilities of the affected entities and how the edits alter the execution logic or externally observable behavior of the corresponding functionality. Without functional context, an LLM may identify concrete operations, such as adding a condition check or adjusting a method call, but it may still fail to determine which functional unit is affected or what program behavior is changed. The resulting commit messages, therefore, tend to remain at the level of local operations or generic summaries and fail to provide complete and accurate descriptions of change impacts. Such quality limitations of commit messages force developers to inspect the code to determine the functional scope of a change, weakening the support provided by commit messages for code review, program comprehension, and software maintenance. Automated CMG, therefore, requires change-impact-aware repository context centered on functional context. Such context should connect the entities carrying the primary modification with related repository code, enabling the LLM to examine their functional responsibilities and the effects of the edits. This understanding supports commit messages that explain both the main modification and its functional and behavioral implications.

0:4

Xiong et al.

To address this challenge, we propose CAMGen, a core change-aware multi-view framework for commit message generation. Code modifications within a commit differ in their relevance to its primary purpose. Huang et al. [11] show that prioritizing core-class changes under a fixed input budget improves several CMG methods. This finding motivates focusing functional analysis on the main modification. CAMGen first identifies its core entities: classes or functions that carry the main logic modification, feature enhancement, or defect fix in the diff. Examining these entities together with functionally related entities helps reveal which functionality is affected and how the edits change its behavior. Core entity identification thus provides the starting point for understanding the diff from a functional perspective. Based on these core entities, CAMGen constructs complementary views corresponding to three types of information considered by developers when interpreting key changes: explicit structural relations between program entities, the functional roles of the changed entities within the system, and historical examples of similar changes. Specifically, CAMGen uses the core entities to construct a Structural Dependency View (ViewStruct) and a Functional Semantic View (ViewFunc), while retrieving similar changes and their human-written commit messages from project history to construct a Historical Exemplar View (ViewExemplar). The ViewStruct captures explicit dependencies between the core entities and other program entities. The ViewFunc organizes repository code into candidate functional units through semantic clustering. Following [57], we adopt method clusters as candidate functional features and select those containing the core entities to provide context for interpreting the affected functionality. The ViewExemplar provides project-specific terminology and writing conventions. The ViewFunc constitutes the central contribution of CAMGen: it helps the LLM relate the primary edits to the responsibilities of the changed entities and explain the functional impact of the code diff. By integrating local structural, global functional, and historical information, CAMGen enables LLMs to understand the effects of local code edits on system functionality and to generate accurate, comprehensive, and project-consistent commit messages.

The main contributions of this paper are as follows:

• Approach: We propose CAMGen, a core change-aware multi-view CMG framework that constructs functional context through semantic clustering. It combines this context with structural dependencies and historical examples to guide LLMs in generating commit messages.

• Evaluation: We evaluate CAMGen across three programming languages through automatic evaluation, human evaluation, and ablation studies. We also analyze cases where CAMGen-generated messages receive low automatic metric scores to identify the causes.

• Implication: We provide implications for the effective integration and use of functional context in LLM-based CMG. This context helps LLMs understand the functional intent and impact of code changes and generate higher-quality commit messages.

Organization: Section 2 reviews the related work. Section 3 presents the proposed CAMGen framework. Section 4 describes the research design. Section 5 presents and analyzes the experimental results. Section 6 discusses threats to validity. Section 7 concludes the paper and outlines future work.