Manuscript Offprint

arXiv:2609.01087

Fine-Tuning Large Language Models to Classify Pull Request-Issue Alignments: Going Beyond Prompting

Mustafa Yasir Altunhan, Hüseyin Özgür Kamalı, Eray Tüzün

Mustafa Yasir Altunhan*

Department of Computer Engineering

Bilkent University

Ankara, Turkey

yasir.altunhan@bilkent.edu.tr

ORCID: 0000-0002-4584-5643

Hüseyin Özgür Kamali*

Department of Computer Engineering

Bilkent University

Ankara, Turkey

ozgurkamali@bilkent.edu.tr

ORCID: 0009-0009-9864-9513

Eray Tüzün

Department of Computer Engineering

Bilkent University

Ankara, Turkey

eraytuzun@cs.bilkent.edu.tr

ORCID: 0000-0002-5550-7816

September 2, 2026

ABSTRACT

Context Accurate alignment between pull requests (PRs) and corresponding issues is crucial for efficient software development and maintaining code quality, as these misalignments can lead to reduced traceability, hindered defect localization, and decreased maintainability.

Objective This study aims to improve automated PR–issue alignment classification by leveraging fine-tuned large language models (LLMs) across multiple alignment categories, and conducts interpretability analysis to investigate the effects of PR-issue fields on the fine-tuned LLMs predictions.

Method Our methodology consists of dataset preparation, LLM fine-tuning, and interpretability analysis. We first extended an existing dataset and applied data augmentation to address class imbalance. Subsequently, GPT-4o was fine-tuned via instruction-tuning, and open-source LLMs: including CodeLlama-7B, CodeQwen1.5-7B, StableCode-3B, CodeGemma-7B, and Deepseek-Coder-6.7B were fine-tuned using classification-specific heads. Additionally, interpretability analysis using Shapley Additive Explanations (SHAP) was conducted to examine the influences of PR–issue fields on LLMs predictions for the best performing open-source LLM.

Results Fine-tuned LLMs outperformed baseline models, achieving average improvements of 6.15% in accuracy and F1-micro, 14.69% in F1-macro, and 6.15% in recall. CodeLlama-7B emerged as the best-performing fine-tuned LLM overall, demonstrating consistent proficiency across metrics, while interpretability analysis revealed that code diffs together with issue body and PR body contents exert the greatest influence on predictions.

Conclusions Fine-tuning substantially enhances PR–issue alignment classification, improving both accuracy and efficiency. Furthermore, interpretability analysis provides actionable insights into the dataset features driving alignment decisions, deepening understanding of how LLMs reason over software artifacts.

Keywords Pull Request-Issue Alignment · Pull Request Intention · Code Review · Pull Request Review · Large Language Models · Fine-Tuning · Instruction Tuning · Interpretability · SHAP · Software Maintenance

*These authors contributed equally.

1 Introduction

Pull Request (PR)-based development is a cornerstone of contemporary software engineering; however, misalignment between PR commits and related issues can silently erode code traceability and maintainability [1]. In modern software development environment developers open an issue that specifies a particular artifact or requirement, then a PR is used to close the issue by addressing the specified artifact in the issue. This process is intended to promote structured collaboration, improve traceability and maintain consistency between code changes and documented requirements. Best practices suggest that each issue represents a single, well-defined task, and each PR should fully address the specific content of its corresponding issue [2]. However, in practice, PR commits may contain changes that are not requested or discussed in the corresponding issues, a phenomenon known as tangled commits [3]. Traditionally, these Tangling commits has been identified manually by developers, who take action if they think there is a irrelevant change. When Tangling commits are not adequately addressed, they can lead to reduced traceability, hindered defect localization, and decreased maintainability [3]. Therefore, the effective detection and handling of Tangling is critical for ensuring project traceability and maintainability.

The problem of tangling is not merely a theoretical concern; its existence and detrimental effects have been widely validated by empirical studies. While various types inconsistencies exists between commits and issue, prior researchers have largely focused on tangling commits, a particularly pervasive and well-documented issue due to its measurable impact on software quality [1, 3]. A Tangling commit is defined as a commit that combines unrelated changes into a single commit. Tangling commits complicates code review and debugging processes by hindering program comprehension and eroding the separation of concerns. Studies have provided concrete evidence of this problem's prevalence and impact. For example, a seminal study by Herzig and Zeller [1] demonstrated that up to 20% of bug-fixing commits are tangled, introducing substantial noise that can skew defect prediction models. Their findings revealed that this noise can lead to a considerable portion of files (up to 16.6%) being incorrectly associated with bug reports. Building on this work, Herbold et al. [3] showed that depending on the context, up to 47% of commits in open-source repositories involve task mixing, further highlighting the widespread nature of the problem. Such empirical findings validate the importance of the misalignment problem and demonstrate its widespread prevalence.

Previous studies have investigated methods to detect and untangle tangling commits. Some researchers focused on post-hoc detection and correction, while others explored preventive approaches. Building on the empirical evidence of tangling commits, researchers have developed automated and semi-automated methods to detect and untangle them. Early approaches, such as EpiceaUntangler [4], leveraged fine-grained edit histories from Integrated Development Environments (IDEs) to accurately cluster changes, though this method was limited by its heavy reliance on developer instrumentation. Subsequent efforts, including Flexeme [5] and ComUnt [6], advanced the field by introducing more generalizable, graph-based techniques that framed the untangling problem as attributed graph clustering. While these approaches improved automation and applicability, they were often limited by the inherent challenges of unsupervised methods or their own performance. More recently, UTango [7] explored a supervised learning approach, demonstrating improved accuracy in detecting tangling commits by adapting to developer-specific grouping behaviors, but this came with the challenge of a high-quality labeled data requirement. In contrast to these post-hoc detection and untangling systems, other research has explored preventive approaches. For instance, Kirinuki et al. [8] proposed a method that analyzes past commits to learn common patterns and provides developers with real-time feedback to encourage more atomic commit practices.

Building on the limitations of prior work that primarily focused on the binary classification of tangled versus non-tangled commits, recent research by İşik et al. [9] extended this alignment to the relationship between PRs and issues, introducing a more nuanced taxonomy to capture the full spectrum of PR-issue alignment. Previous studies primarily focused on the existence of irrelevant concerns, but they did not systematically consider whether the intended issue was fully addressed [4, 5, 6, 7]. This new taxonomy represents a significant step forward by formally defining and categorizing PR-issue alignment based on both the presence of irrelevant changes and the fulfillment of the issue's requirements. This work defines four distinct types: Exact, where a PR fully addresses an issue's requirements and includes no unrelated changes; Tangling, where a PR includes changes unrelated to the issue; Missing, where the PR does not fully address the intended issue; and Missing and Tangling, a combination of Missing and Tangling alignment. Furthermore, İşik et al. [9] used prompt engineering to assess LLMs performance in classifying PR-issue alignments according to this taxonomy.

Parallel to these research efforts, recent advancements in LLMs have significantly impacted text classification methodologies. LLMs like GPT-4 and Llama [10, 11] have enabled zero-shot and few-shot prompting, facilitating classification without extensive fine-tuning. However, while these models offer broad applicability, studies have consistently shown that their performance diminishes in domain-specific, fine-grained classification, particularly when processing noisy or highly technical software artifacts [12]. This limitation is especially problematic for tasks such as PR-issue alignment, where deep contextual understanding and high precision are essential.

Despite the advances in both detecting and untangling commits and the introduction of a new PR-issue alignment taxonomy [9], A notable research gap remains in an effective classification method for PR-issue alignment. Previous work on tangling commits is limited, as it addresses the existence of irrelevant changes in commits and thus fails to measure whether the issue's requirements were actually satisfied [4, 5, 6, 7]. Conversely, while the new taxonomy proposed by İşik et al. [9] provides a comprehensive framework, the prompt-based method used to evaluate it does not fully leverage the fine-tuning capabilities of LLMs and lacks the robustness and domain-specific precision required for this task. These gaps highlight the need for a new methodology that harnesses the full potential of LLMs to address the nuanced challenges of PR-issue alignment.

Our research aims to address these gaps by fine-tuning LLMs on a PR-issue dataset labeled with the new taxonomy classes. We compare the performance of these fine-tuned models with previous work to evaluate their effectiveness for this task [9]. Additionally, we analyze different fine-tuned LLMs to identify the most effective LLM in PR-issue alignment classification. Furthermore, our analysis investigates which parts of the PR-issue pair are most influential in models classification outcomes, providing insight into the LLMs decision-making process. To guide our research, we pose the following research questions:

RQ1: How do fine-tuned LLMs perform in classifying PR-issue alignment compared to previous approaches?

To answer this question, we apply supervised fine-tuning to both closed-source and open-source models, though with different training strategies. For GPT-4o, a state-of-the-art closed-source LLM, we leverage its generative capabilities by instruction tuning it to produce the correct class label through text generation. For the open-source models -CodeLlama-7B, CodeQwen1.5-7B, StableCode-3B, CodeGemma-7B, and Deepseek-Coder-6.7B- we fine-tune classification-specific heads that output probability distributions over the defined alignment categories. We then compare the classification performance and storage space requirements of these fine-tuned models against the prior prompt-based approach proposed by İşik et al. [9].

RQ2: Which fine-tuned LLM achieves the best performance in classifying PR-issue alignment?

To address this RQ, we compare the performance metrics of fine-tuned instances of GPT-4o, CodeLlama-7B, CodeQwen1.5-7B, StableCode-3B, CodeGemma-7B, and Deepseek-Coder-6.7B, rank each LLM on individual metrics, and compute an overall rank to identify the most effective fine-tuned LLM for PR-issue alignment classification.

RQ3: Which PR-issue fields exert the greatest influence on classification prediction?

To answer this question, we apply Shapley Additive Explanations (SHAP) [13] analysis to the open-source LLM that achieved the highest accuracy to reveal the contribution of different fields within the PR-issue pairs to the LLMs classification decisions.

The rest of the paper is structured as follows: Section 2 reviews related literature. Section 3 describes the proposed methodology. Section 4 presents and interprets the experimental findings. Section 5 details the study's threats to validity and limitations. Section 6 discusses the results and suggests future research directions. Section 7 concludes the paper.

References (42)