Prompt workshop
What is TextGrad?
TextGrad optimizes textual variables by a forward generation, a language loss, a textual gradient, and an update.
The loop is search. This encyclopedia does not execute it.
Why it matters
TextGrad optimizes text variables (prompts, templates, instructions) using a forward-backward loop. Generate output, compute a language-based loss, produce a textual gradient (critique), and update the text.
It brings gradient descent principles to prompt engineering, making optimization systematic rather than trial-and-error.
Key takeaways
- 1TextGrad applies gradient descent principles to text optimization.
- 2The loop: generate → evaluate → critique → update.
- 3It makes prompt optimization systematic, not ad-hoc.
Common mistakes
- ✕Running TextGrad without enough evaluation examples.
- ✕Not inspecting the gradients to understand what is being optimized.
Related terms
Concept neighborhood
Terms linked from TextGrad in the glossary graph.
- TextGrad
- Textual Gradient
- GEPA