Trick

EvoPrompt — genetic-algorithm prompt optimization (2023)

optimization · works with Any model · via PrompVite

The prompt

Runs a genetic algorithm over prompts: keeps a population of candidates, applies LLM-driven mutation and crossover, and selects survivors each generation. Optimizes a single prompt. Available as a GitHub repo (microsoft/EvoPrompt) — no pip package, so you're adapting the code yourself rather than installing it.

Expected result

A prompt evolved across multiple generations toward higher measured performance on your evaluation set.

Why it works

A maintained research repo, but expect medium setup effort — a DIY adaptation, not a package install. Worth reading even if you never run it as-is: the population/mutation/selection loop is a reusable pattern for a custom prompt-optimization script.

Open in PrompVite to copy, rate, and discuss this prompt →