Enhancing Program Repair with Specification Guidance and Intermediate Behavioral Signals
Minh Le-Anh, Cuong Chi Le, Tien N. Nguyen · 2026
Read Enhancing Program Repair with Specification Guidance and Intermediate Behavioral Signals by Minh Le-Anh, Cuong Chi Le, Tien N. Nguyen (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2604-11770.txt.
Introduction
Le-Anh and two colleagues propose SpecTune, a specification-guided debugging tool for program repair. Most LLM-based repair relies on coarse test signals, offering little insight into straying logic. SpecTune splits repair into suspect regions linked by checkpoints and derives local postconditions for expected behavior there. Running the buggy program and checking postconditions yields micro-level signals of observed-versus-intended gaps, enabling precise fault location and fixes. Two signals address shaky postconditions: validation alpha gauging postcondition consistency from partial tests, and discriminative beta spotting breaks in execution.
Catalog record
| CREATOR | Minh Le-Anh, Cuong Chi Le, Tien N. Nguyen |
|---|---|
| YEAR | 2026 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 61017 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2604.11770
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
Enhancing Program Repair with Specification Guidance and Intermediate Behavioral Signals Minh Le-Anh, Cuong Chi Le, Tien N. Nguyen Abstract . Automated Program Repair (APR) has recently benefited from large language models (LLMs). However, most LLM-based APR approaches still rely primarily on coarse end-to-end signals from test-suite outcomes to guide repair, providing limited insight into where a program’s internal logic deviates from its intended behavior. In contrast, human debugging often relies on intermediate reasoning about program states through localized correctness conditions or assertions. Inspired by this observation, we propose SpecTune , a specification-guided debugging framework that incorporates intermediate behavioral reasoning into APR. SpecTune decomposes the repair task into suspicious regions connected by execution checkpoints and derives localized postconditions representing expected program behaviors at those points. By executing the buggy program and evaluating these postconditions, SpecTune produces micro-level debugging signals that indicate mismatches between observed and intended behaviors, enabling more precise fault localization and targeted patch generation. To address the potential unreliability of LLM-generated postconditions, we introduce two complementary signals: a specification validation signal α \alpha , which estimates the consistency of generated postconditions using partial passing test cases, and a discriminative signal β \beta , which detects violations of validated postconditions during execution. With these signals, SpecTune safely leverages automatically generated specifications for APR. Experimental results show that SpecTune improves fault localization and APR effectiveness than the baselines. 1. Introduction Automated Program Repair (APR) aims to automatically localize and fix software defects, reducing the manual effort required to debug and maintain programs. Over the past decade, APR has evolved through several methodological paradigms. Early work largely followed the generate-and-validate paradigm, where candidate patches are enumerated and validated against a test suite serving as the correctness oracle. Search-based approaches ( GenProg ( 43 ; 21 ) ) explored syntactic edits through evolutionary mutation and selection guided by test outcomes. Template-driven systems ( SPR ( 27 ) ) structured the search space using parameterized repair templates, while learning-guided models (e.g., Prophet ( 28 ) ) statistically ranked candidate patches using properties of human-written fixes. Subsequent work incorporated semantic reasoning to improve repair correctness. Constraint-based systems (e.g., SemFix ( 34 ) , Nopol ( 47 ) , and Angelix ( 31 ) ) leveraged symbolic execution and constraint solving to synthesize patches consistent with execution traces and test cases. Others mined recurring fix patterns from historical patches (e.g., PAR ( 17 ) , FixMiner ( 18 ) ) to guide patch generation. Later, neural approaches reframed repair as a translation task from buggy to fixed code. Sequence-to-sequence models (e.g., Sequencer ( 6 ) ) and later ones ( CoCoNuT ( 29 ) , DLFix ( 23 ) , and DEAR ( 24 ) ) learned repair patterns directly from bug-fix corpora. The emergence of large language models (LLMs) has further transformed APR. Modern LLM-based repair systems treat patch generation as conditional code generation with powerful pretrained priors. Empirical studies show that LLMs can outperform many traditional APR systems when combined with prompting and validation workflows ( 44 ; 46 ; 9 ) . Recent approaches further enhance repair through retrieval augmentation (e.g., RAP-Gen ( 41 ) ) or agentic frameworks that iteratively localize faults and refine patches using tools such as compilation and testing (e.g., AutoCodeRover ( 50 ) , RepairAgent ( 3 ) ). Iterative repair strategies such as REx ( 37 ) further formulate repair as a budgeted exploration process that selectively refines promising candidate trajectories. Despite these advances, most existing APR approaches still rely primarily on macro-level debugging signals : they evaluate candidate repairs using final outcomes such as test-suite pass/fail results. While effective, such signals are coarse-grained. A failing test indicates that the program’s final output is incorrect, but it often provides limited fine-grained information about where the program’s internal logic first deviates from the intended behavior. Consequently, the APR process frequently degenerates into a large search over candidate edits guided only by end-to-end outcomes. This reliance on macro signals does not reflect how developers debug programs in practice. Human debugging often proceeds by decomposing the computation into smaller components and reasoning about intermediate program states at checkpoints . Developers form hypotheses about what the program should satisfy at certain checkpoints and validate these hypotheses through intermediate checks, or partial execution. When the observed behavior violates such expectations, the developer can narrow the fault scope and modify the responsible code region. In essence, human debugging is often guided by intermediate behavioral specifications rather than solely by final program outputs. This suggests a new direction for APR: leveraging intermediate specifications as structured debugging signals. However, enabling such a strategy is challenging. First, buggy programs rarely include explicit intermediate specifications such as postconditions. Second, although LLMs can generate plausible specifications from code and problem descriptions, these generated postconditions are not always reliable and may be inconsistent with the intended behavior. In this paper, we propose SpecTune , a specification-guided debugging framework for APR that incorporates intermediate behavioral reasoning into the repair process. It is designed to enhance the reasoning capability of LLMs in APR by introducing micro-level specification signals , enabling more effective fault localization and patch generation. SpecTune is designed to strengthen single-pass repair performance of LLMs . However, SpecTune is complementary to iterative refinement and agentic frameworks, where it can be integrated to further improve APR. Given a buggy program and its problem description, an LLM is used to decompose the repair task into suspicious regions separated by intermediate checkpoints. For each checkpoint, it derives a localized postcondition that captures the expected program behavior at that point. The buggy program is then executed via the given test cases and these postconditions are evaluated against the observed program states. When a specification is violated, the resulting mismatch indicates that the program logic near the corresponding checkpoint may be faulty. These mismatch signals provide structured guidance for fault localization (FL) faults and targeted fix generation . A key aspect of SpecTune is the introduction of two complementary signals that enable safe and effective use of generated specifications. The first is a specification validation signal \alpha , which addresses the potential unreliability of LLM-generated postconditions. The \alpha signal is computed using partial passing test cases obtained from executing the original program and estimates whether a generated postcondition is consistent with the intended behavior supported by available evidence. The second is a micro-level discriminative signal \beta , which measures whether a generated specification is violated during execution. Unlike traditional APR signals that operate only at the final output level, \beta identifies where the internal program behavior diverges from the intended logic. Together, \alpha filters unreliable postconditions while \beta converts validated postconditions into actionable debugging guidance. Figure 1 . An example illustrating how a developer derive debugging signals from program semantics. Step 1: (S)he first reads the problem description to understand the intended behavior of the program. Step 2: Based on this understanding, the developer inspects different regions of the code and reasons about the expected relationships between variables during execution. Step 3: From this reasoning process, the developer formulates his/her intended hypothesis on program logic, which will be expressed as executable postconditions that capture the expected program state after specific regions. Step 4: By