What is it about?

When you ask an AI assistant a question, the exact wording of your request dramatically affects the quality of the answer. Crafting the perfect prompt is time-consuming, requires expertise, and often involves frustrating trial and error. This paper automates that process. We adapted a nature-inspired algorithm called the Squirrel Search Algorithm (SSA) — originally modeled on how flying squirrels forage for food — to automatically discover high-performing prompts for large language models (LLMs). Instead of manually engineering prompts, our system encodes prompt structure (instructions, tone, reasoning style, output format) as a numerical "genome," then evolves a population of candidate prompts over successive generations, keeping the best-performing ones. We tested this on three sentiment analysis datasets and three AI models ranging from 3.8 to 20 billion parameters. The system consistently found better prompts than random initialization, improving performance by up to 57%, and always converged within 33 iterations — no gradient access or internal model knowledge required.

Featured Image

Why is it important?

Most cutting-edge AI models today — including GPT, Gemini, and Claude — are "black boxes." Developers can only interact with them through APIs; they cannot peek inside or adjust internal weights. This makes traditional fine-tuning impossible for most practitioners. Our work provides a practical, gradient-free alternative. By treating prompt optimization as an evolutionary search problem, we enable anyone — even without access to a model's internals — to systematically improve AI performance on their specific task. This is especially valuable for organizations deploying AI at scale where even small accuracy gains translate to significant real-world impact. Beyond the results, we show that evolution-inspired algorithms can discover non-obvious prompt strategies (like adopting an expert persona or simplifying output formatting) that humans might not think to try. This opens a new direction for automated AI adaptation research.

Perspectives

As AI models become more capable but also more locked down behind APIs, the question of how to get the best out of them without touching their internals becomes increasingly urgent. Prompt engineering is currently more art than science — highly dependent on practitioner intuition and expensive experimentation. We believe metaheuristic approaches like SSA represent an underexplored but promising direction for making prompt optimization systematic, reproducible, and accessible. Future work could extend this to reasoning tasks, code generation, or multi-modal models, and could incorporate richer genome encodings or hybrid approaches combining SSA with LLM-based mutation operators (as in EvoPrompt). We also see potential for applying this framework to multi-objective optimization — balancing accuracy, cost, latency, and safety simultaneously.

Yash Patel
Stetson University

Read the Original

This page is a summary of: Prompt Optimization for Large Language Models via Squirrel Search Algorithm, April 2026, ACM (Association for Computing Machinery),
DOI: 10.1145/3746467.3801519.
You can read the full text:

Read

Contributors

The following have contributed to this page