Exploring the Effect of Genetic Improvement for Large Language Models-Generated Code
SN Computer Science · 22.08.2025 · 6 (7)
DOI: 10.1007/s42979-025-04281-x ↗Kurz gefasst
Fachartikel in der Zeitschrift SN Computer Science, online erschienen am 22.08.2025. Verfasst von Giovanni Pinna und 4 weiteren Autor:innen. Die Arbeit wurde bisher 3-mal zitiert (Crossref) und nennt 103 Literaturangaben. Der Volltext ist frei zugänglich (Open Access, CC BY 4.0). Gefördert von: Università degli Studi di Trieste.
Abstract (Originalsprache)
In recent years, the field of Natural Language Processing (NLP) has made considerable progress with the development of neural network-based models, leading to the creation of various Large Language Models (LLMs). These models have demonstrated strong performance in various NLP tasks, such as language translation, sentiment analysis, and named entity recognition. One notable application of LLMs is their ability to generate code automatically from simple problem descriptions. However, even advanced LLMs frequently generate incorrect code. To address this issue, we extend a recently proposed method that aims to improve the correctness of code generated by LLMs using an evolutionary approach known as Genetic Improvement (GI). Our method involves constructing a dynamic grammar based on the LLM-generated code and using a problem-agnostic fitness function. In our experiments, we evaluated the proposed method on 25 well-known and widely-used problems across four different LLMs, both open-source and proprietary models. We demonstrate that our approach significantly improves the accuracy of code generated by LLMs. Specifically, for problems that the LLM alone does not fully solve, we show that GI significantly improves the initial LLM-generated solution in 50% to 75% of cases across the tested models. Our proposed GI approach remains effective as long as the initial LLM-generated code, despite some errors, provides a solid foundation for constructing a correct program.
Förderung
- Università degli Studi di Trieste
Zitieren
APA
Pinna, G., Ravalico, D., Rovito, L., Manzoni, L., & Lorenzo, A. D. (2025). Exploring the Effect of Genetic Improvement for Large Language Models-Generated Code. SN Computer Science, 6(7). https://doi.org/10.1007/s42979-025-04281-x
Vancouver
Pinna G, Ravalico D, Rovito L, Manzoni L, Lorenzo AD. Exploring the Effect of Genetic Improvement for Large Language Models-Generated Code. SN Computer Science. 2025;6(7). doi:10.1007/s42979-025-04281-x
BibTeX
@article{Pinna2025,
author = {Pinna, Giovanni and Ravalico, Damiano and Rovito, Luigi and Manzoni, Luca and Lorenzo, Andrea De},
title = {Exploring the Effect of Genetic Improvement for Large Language Models-Generated Code},
journal = {SN Computer Science},
year = {2025},
volume = {6},
number = {7},
doi = {10.1007/s42979-025-04281-x}
}
EUVIMED