A fun experimental project exploring genetic algorithms applied to Stable Diffusion prompts. This project evolves text prompts over multiple generations to try to find the maximum aesthetic score. Crossover, Mutation, and initial prompts are generated using tiny LLMs.
- Initial Population: Starts with a population of random prompts generated by a tiny LLM
- Fitness Evaluation: Generates images from each prompt and scores them with an aesthetic score
- Selection: Selects the top 75% of prompts based on their fitness scores
- Crossover: Creates new prompts by combining the top prompts (using a tiny LLM)
- Mutation: Randomly mutates the new prompts
- Repeat: The process continues for multiple generations
Here's an example of the algorithm trying to evolve prompts to match a target image:
Starting image (sample from dataset) with an aesthetic score of 6.5: