HSR-APR: A Hybrid Secure Reflective Automated Program Repair Framework with Adaptive Reflection Memory
Abstract Automated Program Repair (APR) has benefited from the rapid development of Large Language Models (LLMs), but existing approaches still rely heavily on functional testing, provide limited security validation, insufficient integration of traditional program analysis, and have limited ability to learn from failed repair attempts. This research proposes HSR-APR (Hybrid Secure Reflective Automated Program Repair), a hybrid framework that integrates static analysis, fault localization, Retrieval-Augmented Generation (RAG), LLM-based patch generation, functional and security validation, self-reflection, and Adaptive Reflection Memory (ARM). The framework iteratively evaluates generated patches, analyzes failed attempts, stores repair experiences in ARM, and retrieves relevant knowledge to improve subsequent repair prompts. HSR-APR is evaluated on 300 SWE-Bench Lite instances using four configurations: Baseline LLM, Hybrid APR, Hybrid APR with Security Validation, and HSR-APR. Results show that HSR-APR achieves an 85% Repair Success Rate (255/300), compared with 63% for the Baseline LLM, while increasing the Test Pass Rate from 72% to 92% and Security Warning Reduction from 8% to 87%. It also reduces average repair iterations from 5.8 to 2.9 and execution time from 18 to 13 minutes, demonstrating that combining hybrid analysis, security validation, self-reflection, and adaptive memory improves the effectiveness, security, and efficiency of LLM-based APR.
Authors
- Mahmoud Hussien
- Ashraf Elsisi
- Afaf Mosa
- Esraa Fady
Institutions
- Menoufia University (EG)
Publication Details
- Journal
- Research Square
- Published
- 2026-11-09
- DOI
- https://doi.org/10.21203/rs.3.rs-10924086/v1
- Primary Topic
- Software Testing and Debugging Techniques
- Type
- preprint