Large Language Model Based Code Completion is an Effective Genetic Improvement Mutation
In this work, we introduce a novel large language model (LLM)-based masking mutation operator for Genetic Improvement (GI), which leverages code completion capabilities of large language models to replace masked code segments with contextually relevant modifications. Our approach was tested on five open-source Java projects, where we compared its effectiveness against both traditional GI mutations and an existing LLM-based replacement mutation operator using random and local search algorithms. Results show that the masking mutation operator creates a search space with more compiling and test-passing patches, reducing model response time by up to 60.7 % compared to the replacement mutation. Additionally, it outperforms the replacement mutation in achieving the highest runtime improvement on four out of five projects and discovers more runtime-improving patches across all projects. However, combining the masking mutation with traditional GI mutations yielded inconsistent results, suggesting further investigation is needed. This study highlights the promise of LLM-based code completion to boost the efficiency and effectiveness of GI for automated software optimisation.
Authors
- Justyna Petke (ORCID: https://orcid.org/0000-0002-7833-6044)
- Carol Hanna (ORCID: https://orcid.org/0000-0002-2790-3555)
- Jingyuan Wang (ORCID: https://orcid.org/0000-0003-0651-1592)
Institutions
- University College London (GB)
Publication Details
- Published
- 2025-04-27
- DOI
- https://doi.org/10.1109/gi66624.2025.00011
- Citations
- 2
- Primary Topic
- Genomics and Phylogenetic Studies
- Type
- article
- Field-Weighted Citation Impact
- 1.61