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

arXiv: https://arxiv.org/abs/2607.02782 · HTML: https://mlsanity.com/paper/2607.02782/

## Key facts

- No citing papers in the map yet (data through 14 Oct 2026).
- Builds on 8 of its 25 references that are in the map.
- First posted on arXiv 2 Jul 2026.

## Builds on (most cited first, 8 of 8)

- [Attention is not Explanation](https://mlsanity.com/paper/1902.10186/) (2019)
- [Captum: A unified and generic model interpretability library for PyTorch](https://mlsanity.com/paper/2009.07896/) (2020)
- [Explainable Reinforcement Learning Through a Causal Lens](https://mlsanity.com/paper/1905.10958/) (2019)
- [On scientific understanding with artificial intelligence](https://mlsanity.com/paper/2204.01467/) (2022)
- [Shapley values for feature selection: The good, the bad, and the axioms](https://mlsanity.com/paper/2102.10936/) (2021)
- [Explainable Software Analytics](https://mlsanity.com/paper/1802.00603/) (2018)
- [AI Explainability 360: Impact and Design](https://mlsanity.com/paper/2109.12151/) (2021)
- [Moving Faster and Reducing Risk: Using LLMs in Release Deployment](https://mlsanity.com/paper/2410.06351/) (2024)

## Abstract (arXiv)

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. 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.
