Context-Aware Large Language Model Repair for Evolving Software Defects

Authors

  • syarizal Alas Putra Pagan Universitas Nurul Hasanah Kutacane Author
  • Muasir Pagan Universitas Nurul Hasanah Kutacane Author

DOI:

https://doi.org/10.36520/joofin.v1.i1.4

Keywords:

Automated Program Repair

Abstract

Large language models have expanded automated program repair, yet defect repair remains sensitive to incomplete context, repository evolution, and weak validation. This paper proposes PromptRepair-SE, a context-aware repair architecture that separates defect localization, repository-context retrieval, candidate generation, test-based validation, and repair-memory feedback. The central hypothesis is that evolving software requires a repair system to reason beyond the faulty line and reuse evidence from semantically related historical defects. To study this mechanism without dependence on a proprietary model API, a reproducible surrogate benchmark of 500 Python defect instances was created across five bug families. A retrieval-and-ranking experiment compares local-code context, prompt plus file-level context, and PromptRepair-SE with defect-memory augmentation. The proposed strategy achieves the highest exact repair rate and exhibits a smaller decline in a late-evolution split. The study does not claim that the surrogate generator is itself a production-scale LLM; instead, it isolates the contextual orchestration that can wrap an open or commercial code model. The results motivate repository-aware prompting, executable validation, and evolving repair memory as first-class components of LLM-based automated program repair

Downloads

Download data is not yet available.

References

[1] J. Wang et al., “Software testing with large language models: Survey, landscape, and vision,"IEEE Trans. Softw. Eng., vol. 50, no. 4, pp. 911–936, 2024, doi: 10.1109/TSE.2024.3368208.

[2] Y. Li et al., “Evaluating large language models for software testing,"Computer Standards & Interfaces, vol. 93, art. 103942, 2025, doi: 10.1016/j.csi.2024.103942.

[3] F. Zubair, M. Al-Hitmi, and C. Catal, “The use of large language models for program repair,"Computer Standards & Interfaces, vol. 93, art. 103951, 2025, doi: 10.1016/j.csi.2024.103951.

[4] A. Zirak and H. Hemmati, “Improving automated program repair with domain adaptation,"ACM Trans. Softw. Eng. Methodol., vol. 33, no. 3, art. 65, 2024, doi: 10.1145/3631972.

[5] X. Hou et al., “Large language models for software engineering: A systematic literature review,"ACM Trans. Softw. Eng. Methodol., vol. 33, no. 8, art. 220, 2024, doi: 10.1145/3695988.

[6] “Enhanced automated code vulnerability repair using large language models,"Engineering Applications of Artificial Intelligence, vol. 138, art. 109291, 2024, doi: 10.1016/j.engappai.2024.109291.

[7] “T5APR: Empowering automated program repair across languages through checkpoint ensemble,"Journal of Systems and Software, vol. 214, art. 112083, 2024, doi: 10.1016/j.jss.2024.112083.

[8] X. Zhou, S. Cao, X. Sun, and D. Lo, “Large language model for vulnerability detection and repair: Literature review and the road ahead,"ACM Trans. Softw. Eng. Methodol., 2024, doi: 10.1145/3708522.

[9] Y. Yu et al., “Fine-tuning large language models to improve accuracy and comprehensibility of automated code review,"ACM Trans. Softw. Eng. Methodol., vol. 34, no. 1, art. 14, 2025, doi: 10.1145/3695993.

[10] “Fine-tuning and prompt engineering for large language models-based code review automation,"Information and Software Technology, vol. 175, art. 107523, 2024, doi: 10.1016/j.infsof.2024.107523.

[11] “A search-and-fill strategy to code generation for complex software requirements,"Information and Software Technology, vol. 177, art. 107584, 2025, doi: 10.1016/j.infsof.2024.107584.

[12] L. Zhang, A. Singhal, Q. Zou, X. Sun, and P. Liu, “Can AI fix buggy code? Exploring the use of large language models in automated program repair,"Computer, vol. 58, no. 7, pp. 122–128, 2025, doi: 10.1109/MC.2025.3527407.

[13] M. Alhanahnah et al., “An empirical evaluation of pre-trained large language models for repairing declarative formal specifications,"Empirical Software Engineering, vol. 30, art. 149, 2025, doi: 10.1007/s10664-025-10687-1.

[14] A. Sajadi et al., “Do LLMs consider security? An empirical study on responses to programming questions,"Empirical Software Engineering, vol. 30, art. 101, 2025, doi: 10.1007/s10664-025-10658-6.

[15] “Automated program repair for variability bugs in software product line systems,"Journal of Systems and Software, vol. 221, art. 112152, 2025, doi: 10.1016/j.jss.2024.112152.

[16] “Translating code with large language models and human-in-the-loop feedback,"Information and Software Technology, vol. 186, art. 107785, 2025, doi: 10.1016/j.infsof.2025.107785.

[17] “Formal requirements engineering and large language models: A two-way roadmap,"Information and Software Technology, vol. 181, art. 107697, 2025, doi: 10.1016/j.infsof.2025.107697.

[18] “SecureQwen: Leveraging LLMs for vulnerability detection in Python codebases,"Computers & Security, vol. 148, art. 104151, 2025, doi: 10.1016/j.cose.2024.104151.

[19] “Still just personal assistants? A multiple case study of generative AI adoption in software organizations,"Information and Software Technology, vol. 186, art. 107805, 2025, doi: 10.1016/j.infsof.2025.107805.

[20] X. Bai et al., “Collaboration between intelligent agents and large language models: A novel approach for enhancing code generation capability,"Expert Systems with Applications, vol. 269, art. 126357, 2025, doi: 10.1016/j.eswa.2024.126357.

[21] “Software refactoring research with large language models: A systematic literature review,"Journal of Systems and Software, vol. 235, art. 112762, 2026, doi: 10.1016/j.jss.2025.112762.

[22] “MENTOR: Fixing introductory programming assignments with formula-based fault localization and LLM-driven program repair,"Journal of Systems and Software, vol. 234, art. 112690, 2026, doi: 10.1016/j.jss.2025.112690.

[23] “Practically implementing an LLM-supported collaborative vulnerability remediation process: A team-based approach,"Computers & Security, vol. 148, art. 104113, 2025, doi: 10.1016/j.cose.2024.104113.

[24] L. Banh, F. Holldack, and G. Strobel, “Copiloting the future: How generative AI transforms software engineering,"Information and Software Technology, vol. 183, art. 107751, 2025, doi: 10.1016/j.infsof.2025.107751.

[25] “Applying generative artificial intelligence for vulnerability fixing in a proprietary software ecosystem,"Journal of Systems and Software, vol. 234, art. 112723, 2026, doi: 10.1016/j.jss.2025.112723.

Downloads

Published

2026-07-29

Issue

Section

Articles