ExpeRepair : Dual-Memory Enhanced LLM-based Repository-Level Program Repair
Fangwen Mu, Junjie Wang, Lin Shi, Song Wang, Shoubin Li, Qing Wang · 2025
Read ExpeRepair : Dual-Memory Enhanced LLM-based Repository-Level Program Repair by Fangwen Mu, Junjie Wang, Lin Shi, Song Wang, Shoubin Li, Qing Wang (2025) 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-2506-10484.txt.
Introduction
Fangwen Mu and five co-authors give language models a dual memory to fix code bugs across a whole repository, in a paper from 2025. Most repair tools treat each bug alone and use fixed prompts, which wastes lessons from past fixes. Human memory pairs concrete episodes with abstract lessons, and the team copies that split.
One memory stores past repair examples, and the other stores distilled repair insights. At fix time, both are recalled and woven into a tailored prompt. Over time the system keeps learning from new repairs. On two standard repair benchmarks, the approach is evaluated against leading baselines.
Catalog record
| CREATOR | Fangwen Mu, Junjie Wang, Lin Shi, Song Wang, Shoubin Li, Qing Wang |
|---|---|
| YEAR | 2025 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 39 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2506-10484
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
ExpeRepair : Dual-Memory Enhanced LLM-based Repository-Level Program Repair Fangwen Mu, Junjie Wang, Lin Shi, Song Wang, Shoubin Li, Qing Wang Abstract Automatically repairing software issues remains a fundamental challenge at the intersection of software engineering and AI. Although recent advancements in Large Language Models (LLMs) have demonstrated potential for repository-level repair tasks, current methodologies exhibit two notable limitations: (1) they often address issues in isolation, neglecting to incorporate insights from previously resolved issues, and (2) they rely on static and rigid prompting strategies, which constrain their ability to generalize across diverse and evolving issue scenarios. Inspired by the dual memory systems of human cognition, where episodic and semantic memories work synergistically to support human reasoning and decision-making, we propose ExpeRepair , a novel LLM-based approach that continuously learns from historical repair experiences through dual-channel knowledge accumulation. ExpeRepair organizes historical repair experiences into two complementary memories: an episodic memory that stores concrete repair demonstrations, and a semantic memory that encodes abstract reflective insights. At inference time, ExpeRepair activates both memory systems by retrieving relevant demonstrations from episodic memory and recalling high-level repair insights from semantic memory. It further enhances adaptability through dynamic prompt composition, synergistically integrating both memory types to replace static prompts with context-aware, experience-driven prompts. Experiments on the SWE-bench Lite benchmark demonstrate that ExpeRepair achieves a pass@1 score of 49.3% with Claude 3.7 Sonnet, outperforming all state-of-the-art open-source methods. 1 Introduction Automated Program Repair (APR) aims to automatically identify and correct bugs in source code, offering the potential to significantly reduce developer effort and improve software reliability le2019automated . Traditional APR techniques have predominantly focused on function-level repair, targeting small, isolated code fragments gazzola2018automatic . However, this narrow scope diverges from real-world software maintenance practices, which typically require reasoning over large codebases, interpreting complex issue descriptions, and addressing inter-file dependencies. Recent advances in Large Language Models (LLMs) for generative tasks, particularly code generation, have shifted attention toward applying LLMs to repository-level program repair bouzenia2024repairagent ; zhang2024autocoderoverautonomousprogramimprovement ; xia2024agentless ; yang2024swe . Unlike function-level repair, repository-level APR involves navigating large codebases, understanding intricate program logic, and identifying subtle bugs embedded across multiple files, introducing new and underexplored challenges. To address these challenges, recent studies have explored two main categories of LLM-based APR methods: agentic and procedural. Agentic approaches zhang2024autocoderoverautonomousprogramimprovement ; yang2024swe ; silva2023repairllama ; DBLP:journals/corr/abs-2503-14269 treat the LLM as an autonomous agent capable of planning and executing actions to resolve bugs by interacting with tools, traversing repositories, modifying code, and running tests. In contrast, procedural approaches xia2024agentless ; ma2024alibaba follow predefined and static pipelines, where the LLM sequentially performs tasks such as bug localization and patch generation using fixed prompts and operation sequences, without autonomous decision-making. While both paradigms have shown promise, they still exhibit two significant limitations: • Neglecting Historical Repair Experience. Current approaches treat each issue in isolation and primarily rely on feedback derived from the ongoing issue resolution process, while largely ignoring valuable historical experience accumulated from previously resolved issues within the same repository. In practice, software projects often exhibit recurring bug patterns during their evolution livshits2005dynamine , for example, incorrect API usage, type mismatch errors, or improper resource management. These recurring issues often follow similar fix patterns, either manifesting as syntactically similar code changes or exhibiting significant syntactic variations while sharing similar underlying correction logics. The absence of mechanisms to capture and exploit such historical repair data results in redundant exploration and missed opportunities for accelerating successful repair. If an APR system could systematically identify previously encountered bug patterns or contextual experience, and adapt past successful patches, it would substantially improve both repair efficiency and success rates. • Limited Dynamic Adaptability Due to Static Prompting. Existing approaches rely on manually crafted, static prompts to guide models in tasks such as bug localization and patch generation. However, these generic prompts fail to account for substantial variations across real-world software projects, including differences in coding conventions, architectural patterns, issue descriptions, and project-specific practices. Manually tailoring prompts for each repository or issue type is impractical and unsustainable, particularly in large, heterogeneous software ecosystems DBLP:conf/iclr/HuCDZLYHTC25 . Moreover, static prompts not only struggle to accommodate this diversity but also lack the capacity to evolve in response to task feedback or adapt to nuanced context shifts during multi-step repair workflows. Addressing this challenge requires a dynamic prompt generation or adaptation mechanism capable of tailoring instructions based on the repository’s characteristics, the issue’s contextual information, and insights from past repairs, thereby enabling more robust and context-aware repair strategies. In real-world software development, human programmers continuously accumulate knowledge from past debugging and repair activities, refining their strategies and reasoning over time. Inspired by this human-like learning process DBLP:conf/aaai/Zhao0XLLH24 ; DBLP:journals/corr/abs-2411-13941 , we make the first attempt to explicitly incorporate historical repair experiences into repository-level APR, aiming to model how developers learn, adapt, and improve across issues within a software project. To effectively capture and reuse these accumulated experiences, we draw further inspiration from cognitive science. The dual-memory system theory evans2013dual ; frankish2010dual posits that human reasoning and decision-making rely on two complementary types of memory: episodic memory, which stores concrete personal experiences, and semantic memory, which captures abstract, generalizable knowledge. These two systems work synergistically, enabling individuals to recall specific events while applying broader insights to novel situations. To this end, we propose ExpeRepair , a novel LLM-based program repair approach that continuously accumulates and reuses historical repair experiences through dual memory systems. ExpeRepair comprises two core modules: a Program Repair Module and a Memory Module. The repair module orchestrates a test agent and a patch agent, which collaboratively perform test generation, patch generation, and patch validation for each issue. The memory module organizes repair experiences into two complementary memories: episodic memory, which stores concrete repair demonstrations, and semantic memory, which distills abstract, natural language insights from past repair trajectories. At inference time, ExpeRepair retrieves relevant repair demonstrations and reflective insights to generate dynamic, context-aware prompts tailored to the current issue and repository. By maintaining both episodic memory and semantic memory, ExpeRepair achieves synergistic benefits: specific demonstrations provide precise implementation references, while reflective insights enable generalized adaptation to new and evolving contexts. We evaluate our method on SWE-Bench Lite jimenez2023swe , a challenging benchmark comprising real-world software issues sourced from popular GitHub repositories. Experimental results show that our approach outperforms all state-of-the-art open-source baselines, achieving a 47.7% pass@1 with Claude 3.5 Sonnet V2 claude5 and a 49.3% pass @1 with Claude 3.7 Sonnet claude7 . Further, ablation studies confirm the effectiveness of our dual-memory mechanism in improving repair performance. Our main contributions are as follows: • We propose ExpeRepair , a LLM-based program repair method that continuously learns from historical repair experiences through dual-channel knowledge accumulation, which is the first attempt to consider the historical repair experience in program repair to the best of our knowledge. By integrating episodic and semantic memories inspired by cognitive science, ExpeRepair enables continuous accumulation and reuse of historical repair experiences, enhancing both the effectiveness and adaptability of program repair. • We design a dynamic, experience-driven prompt generation mechanism that tailors repair strategies to the specific characteristics of each issue and repository. This mechanism addresses the limitations of static, handcrafted prompts by leveraging both concrete repair demonstrations and abstract