# Detecting Incorrect LLM Explanations for Automated Program Repair

DevFeed: [Detecting Incorrect LLM Explanations for Automated Program Repair](<https://devfeed.tech/articles/detecting-incorrect-llm-explanations-for-automated-program-repair-107375.md>)

Original publisher: [Read original article](<https://arxiv.org/abs/2610.38311>)

Author: Lam Nguyen Tung, Chenxi Gu, Xiaoning Du, Haoye Tian, Aldeida Aleti, Neelofar Neelofar

Published: 2026-10-30T04:00:00Z

Content type: article

Language: en

Sources: [arXiv: Software Engineering](<https://devfeed.tech/sources/arxiv-software-engineering.md>)

Topics: [llm-reasoning](<https://devfeed.tech/topics/llm-reasoning.md>), [Large Language Model](<https://devfeed.tech/topics/llm.md>), [mutation-testing](<https://devfeed.tech/topics/mutation-testing.md>), [patches](<https://devfeed.tech/topics/patches.md>), [Automated reasoning](<https://devfeed.tech/topics/automated-reasoning.md>)

Tags: [cs-se](<https://devfeed.tech/tags/cs-se.md>), [llm](<https://devfeed.tech/tags/llm.md>), [metamorphic-testing](<https://devfeed.tech/tags/metamorphic-testing.md>), [repair](<https://devfeed.tech/tags/repair.md>)

## AI overview

MetaReJ detects potentially incorrect explanations from automated program repair (APR) systems by testing whether an LLM's reasoning remains consistent across related repair scenarios. It transforms a buggy program into variants that preserve or alter its bug, asks the LLM how to repair each one, and treats contradictions captured as metamorphic-relation violations as evidence against the original explanation. This approach avoids external verifiers and aims to elicit more diverse responses than paraphrasing or re-prompting the same input, which can repeat an error. On a manually labeled set of 1,756 explanations from multiple LLM-based APR systems, MetaReJ reached an MCC of up to 0.43 and outperformed prior methods by up to 333.3% in MCC.

## Source excerpt

arXiv:2610.38311v1 Announce Type: new Abstract: LLM-generated explanations help developers understand automated program repair (APR) rationale and assess patch quality. Incorrect explanations can mislead developers about a repair's reliability, making their detection important. However, manually inspecting the growing volume of generated repairs is impractical, motivating automated detection. Existing methods mainly target incorrect answers from general question-answering LLMs, often by sampling multiple responses and detecting contradictions. Applied to APR, they face two limitations: (1) they may depend on external verifiers that are unavailable or lack APR-specific reasoning; and (2) sampling strategies such as paraphrasing or re-prompting the same input often yield superficial, redundant responses that repeat the original error rather than expose it. We propose MetaReJ, the first method designed to detect incorrect APR explanations using metamorphic testing. Inspired by debate and viva examinations, MetaReJ challenges explanations through an argumentative strategy without requiring external verifiers. It applies novel metamorphic relations (MRs) to recursively question the LLM under equivalent and non-equivalent repair scenarios and detect contradictions. To obtain diverse samples, MetaReJ transforms the buggy program into variants that preserve or alter the underlying bug, then asks the LLM how to repair each variant. Contradictions among responses are encoded as MR violations, which indicate that the original explanation is incorrect. We evaluate MetaReJ on a manually labelled dataset of 1,756 explanations from multiple LLM-based APR systems. MetaReJ achieves an MCC of up to 0.43, outperforming prior methods by up to 333.3% in MCC.