Decagon
Decagon logoDecagon · Feature trail

Prompt Engineering Optimization

4 posts · Mar 2026 – Jun 2026

What this trail covers

Decagon is developing systematic approaches to prompt engineering optimization, moving beyond manual iteration. The GEPA (Reflective Prompt Evolution) framework, built on DSPy, uses LLM reflection to automatically improve prompts. Key findings from production deployment include identifying an optimal sample size range (20-100 examples), the critical need for frontier LLMs as reflection models, and the effectiveness of length constraints as regularization to prevent prompt bloat and improve generation. This post details the application of a GAN-like adversarial game to prompt optimization, where a generator and judge are pitted against each other, with GEPA optimizing their prompts based on failure analysis. The system achieved a 34% human fool rate, demonstrating improved realism without model fine-tuning, highlighting the value of adversarial optimization for discovering failure modes and improving prompts, with a methodological takeaway that realism must be validated outside the game.

All Decagon trails