Hugging Face · 2026-04-28 · notable
Hugging Face Cookbook: Optimizing Language Models with DSPy GEPA
Step-by-step notebook tutorial showing how DSPy's GEPA optimizer uses error-driven feedback and a dual-model architecture (cheap inference model + smart reflection model) to automatically improve prompts, boosting mathematical reasoning accuracy by ~6% for under $0.50.

Automatically improve your LLM prompts with error analysis — a complete runnable tutorial.
What is it?
A Hugging Face Open-Source AI Cookbook notebook demonstrating DSPy's GEPA (Generalized Error-driven Prompt Augmentation) optimizer for automatically improving prompts through reflective error analysis.
How does it work?
GEPA runs a dual-model cycle: a cheap model handles high-volume inference, while a smarter reflection model analyzes error patterns and generates improved prompt instructions. The cycle repeats until validation accuracy plateaus.
Why does it matter?
Manual prompt engineering is a bottleneck — GEPA automates the improvement cycle with interpretable, textual feedback rather than opaque gradient-based tuning.
Who is it for?
ML engineers who want to improve LLM output quality without manual prompt iteration.
Try it
https://huggingface.co/learn/cookbook/en/dspy_gepa