A Preliminary Study on Explaining Risk of Code Changes using LLM-Based Prediction Models

Yalin Liu, Kosay Jabre, Rui Abreu, Zachariah J. Carmichael, Vijayaraghavan Murali +8 more
7/2/2026
cs.SEcs.AI

No confident code implementation found for this paper.

Abstract

Predictions by machine learning (ML) and artificial intelligence (AI) models are often received skeptically unless they are paired with intelligible explanations. In the context of just-in-time defect prediction, highlighting small portions of a software change (diff) -- beyond rule-based lints -- where risk may be concentrated has not yet been extensively investigated.

Show full abstract

In this work, we leverage attention weights from an LLM-based Diff Risk Score (DRS) model to highlight parts of a diff that the model focuses on when predicting risk. We aggregate token-level attention into interpretable code units (lines, hunks, and files), and present the top-K units to developers as a lightweight form of guidance during code review. We evaluate our approach using expert-labeled changes that have caused real outages. Results show that the highlighted snippets cover expert-labeled outage-causing change lines 53.85% of the time when highlighting the top-2 hunks, while requiring developers to review 26.28% of the changed lines on average. Because attention is produced during standard model inference, the approach is scalable for large development workflows and can be surfaced in the code review UI with low additional latency.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{liu2026preliminary,
  title  = {A Preliminary Study on Explaining Risk of Code Changes using LLM-Based Prediction Models},
  author = {Yalin Liu and Kosay Jabre and Rui Abreu and Zachariah J. Carmichael and Vijayaraghavan Murali and Akshay Patel and Jun Ge and Weiyan Sun and Cong Zhang and Audris Mockus and David Khavari and Peter C. Rigby and Nachiappan Nagappan},
  year   = {2026},
  eprint = {2607.02782},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2607.02782v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2607.02782.svg)](https://codeofpaper.com/paper/2607.02782)

Discussion