Source Code Refactoring Based on LLM and UML Extension


Source Code Refactoring Based on LLM and UML Extension

Karavaeva E.A. (NRU HSE, Moscow, Russia)
Kuligin L.A. (NRU HSE, Moscow, Russia)
Rezunik L.A. (NRU HSE, Moscow, Russia)
Alexandrov D.V. (NRU HSE, Moscow, Russia)

Abstract

The article presents a method for refactoring source code based on the integration of a large language model (LLM) and an extended UML model of the program code. The proposed approach allows identifying problematic code areas using anxiety functions and structural class metrics, and then performing automated refactoring with precondition and postcondition verification in OCL. The UML extension includes local variables, method actions, and the relationships between them, enabling low-level analysis and correct code transformation. Experimental validation showed that the LLM + UML* method provides high defect detection accuracy, complete elimination of anxiety functions, and preservation of system functionality.

Keywords

source code refactoring; large language models; UML extension; software quality metrics; automated code transformation; object-oriented programming; OCL.

Edition

Proceedings of the Institute for System Programming, vol. 38, issue 3, part 2, 2026, pp. 67-94

ISSN 2220-6426 (Online), ISSN 2079-8156 (Print).

DOI: 10.15514/ISPRAS-2026-38(3)-22

For citation

Karavaeva E.A., Kuligin L.A., Rezunik L.A., Alexandrov D.V. Source Code Refactoring Based on LLM and UML Extension. Proceedings of the Institute for System Programming, vol. 38, issue 3, part 2, 2026, pp. 67-94 DOI: 10.15514/ISPRAS-2026-38(3)-22.

Full text of the paper in pdf (in Russian) Back to the contents of the volume