Toward Fully Automated Prompting: An LLM-Powered Genetic Algorithm for Prompt Generation, Optimization, and Self-Evaluation

Authors

  • Leandro A. Loss AI R&D, AML RightSource, USA and MBA Department, ESSCA School of Management, France https://orcid.org/0009-0003-3766-3369
  • Pratikkumar Dhuvad AI R&D, AML RightSource, USA

DOI:

https://doi.org/10.47852/bonviewJDSIS62028440

Keywords:

genetic algorithms, LLM prompt optimization, automated prompt engineering, LLM-guided genetic operators

Abstract

Large language models (LLMs) have gained recognition as valuable assets across virtually all industries, yet they rely heavily on manually crafted input prompts. In real-world applications, the dependence on specialized staff, skilled prompt engineering, and domain-specific knowledge often leads to suboptimal performance and increased costs. In this study, we investigate the use of genetic algorithms (GAs) to generate, evolve, and judge LLM prompts in a completely autonomous fashion. The main novelty presented here is the integration of general-purpose LLM-guided genetic operators with LLM-based fitness evaluation, enabling prompt optimization without human intervention. Full prompting automation is possible via the customization of a standard GA implementation to handle textual individuals, which are manipulated by LLM-guided genetic operators that iteratively create and enhance candidate prompts. Additionally, LLMs are employed to assess the correctness of outputs, forming the basis of our GA’s fitness function. Our experimental results indicate that our approach produces solutions that are, on average, 22% more correct than those generated by humans. This conclusion is supported by extensive testing utilizing 10 public datasets and 6 modern LLMs by OpenAI, Meta, and MistralAI. Ablation studies and sensitivity analysis further substantiate our approach’s robustness under probabilistic scenarios. Our findings suggest that this GA-driven prompt engineering approach can produce superior solutions compared with those written by prompt engineers who possess technical skills but lack domain-specific knowledge and a full understanding of vendor-specific prompting idiosyncrasies. Ultimately, this study highlights the viability and potential of fully automated optimization for minimizing human effort in writing performant prompts.

 

Received: 26 November 2025 | Revised: 28 April 2026 | Accepted: 25 May 2026

 

Conflicts of Interest

The authors declare that they have no conflicts of interest related to this work.

 

Data Availability Statement

All data that support the findings of this study are in the public domain and openly available on GitHub at https://www.github.com/leloss/gallm.

 

Author Contribution Statement

Leandro A. Loss: Conceptualization, Conceptualization, Methodology, Software, Validation, Formal analysis, Investigation, Resources, Data curation, Writing – original draft, Writing – review & editing, Visualization, Supervision, Project administration. Pratikkumar Dhuvad: Conceptualization, Conceptualization, Methodology, Software, Validation, Formal analysis, Investigation, Resources, Data curation, Writing – original draft, Writing – review & editing, Visualization, Supervision, Project administration.

Downloads

Published

2026-06-25

Issue

Section

Research Articles

How to Cite

Loss, L. A., & Dhuvad, P. (2026). Toward Fully Automated Prompting: An LLM-Powered Genetic Algorithm for Prompt Generation, Optimization, and Self-Evaluation. Journal of Data Science and Intelligent Systems. https://doi.org/10.47852/bonviewJDSIS62028440