An LLM-Based Genetic Algorithm for Prompt Engineering

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. This paper investigates the use of Genetic Algorithms (GAs) to autonomously generate, evolve, and judge LLM prompts. Specifically, we customized 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 findings suggest that GA-driven prompt engineering can consistently produce solutions that are superior in both accuracy and efficiency compared to those acquired by prompt engineers who possess technical skills but lack domain-specific knowledge and a full understanding of vendor-specific prompting idiosyncrasies. This conclusion is supported by experimental results obtained from four public datasets and three modern LLMs developed by OpenAI, Meta, and Mistral AI. Ultimately, this study highlights the viability and potential of fully automated optimization tools in minimizing human effort in writing high-performance prompts.

Authors

Institutions

Publication Details

Journal
Proceedings of the Genetic and Evolutionary Computation Conference Companion
Published
2025-07-14
DOI
https://doi.org/10.1145/3712255.3726633
Primary Topic
Oil and Gas Production Techniques
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

An LLM-Based Genetic Algorithm for Prompt Engineering

Leandro A. Loss, Pratikkumar Dhuvad
Proceedings of the Genetic and Evolutionary Computation Conference Companion
Oil and Gas Production Techniques
article

An LLM-Based Genetic Algorithm for Prompt Engineering

Leandro A. Loss, Pratikkumar Dhuvad
article en

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. This paper investigates the use of Genetic Algorithms (GAs) to autonomously generate, evolve, and judge LLM prompts. Specifically, we customized 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 findings suggest that GA-driven prompt engineering can consistently produce solutions that are superior in both accuracy and efficiency compared to those acquired by prompt engineers who possess technical skills but lack domain-specific knowledge and a full understanding of vendor-specific prompting idiosyncrasies. This conclusion is supported by experimental results obtained from four public datasets and three modern LLMs developed by OpenAI, Meta, and Mistral AI. Ultimately, this study highlights the viability and potential of fully automated optimization tools in minimizing human effort in writing high-performance prompts.

Proceedings of the Genetic and Evolutionary Computation Conference Companion
School District of Philadelphia (US), Rights and Resources (US)
Openalex Percentile: Top 53%
Oil and Gas Production Techniques
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.