textual-equilibrium-propagation-deep
Textual Equilibrium Propagation for Deep Compound AI Systems
This skill enables Claude to design, optimize, and debug deep compound AI systems — multi-step LLM pipelines where each stage feeds into the next (retrieval, reasoning, code generation, verification, etc.). It applies Textual Equilibrium Propagation (TEP), a technique from Chen et al. (ICLR 2026) that replaces fragile global feedback chains with a two-phase approach: first, each module self-improves via a local LLM critic until stable (free phase), then receives minimal task-aligned nudges propagated forward (nudged phase). This prevents the twin failures of deep prompt optimization — feedback that explodes in length or vanishes in specificity — and scales to 5x+ pipeline depth where global methods like TextGrad collapse.
When to Use
- When the user has a multi-step LLM pipeline (3+ stages) and wants to optimize prompts across stages without manual tuning
- When a compound AI system degrades in quality as depth increases (e.g., a 5-stage agent chain performs worse than a 3-stage one)
- When global feedback propagation (TextGrad-style) produces bloated or vague optimization signals
- When building retrieval-augmented generation pipelines, multi-agent tool-use workflows, or code generation pipelines with analysis/generation/testing/refinement stages
- When the user wants to add self-critique loops to individual agents in a pipeline without destabilizing the whole system
- When optimizing agentic workflows where each agent's prompt needs tuning but agents are black-box LLM calls
Key Technique
The Problem with Global Textual Backpropagation: Methods like TextGrad treat LLM pipelines like neural networks and backpropagate textual feedback from the final output through every upstream module. This works for shallow pipelines (2-3 steps) but fails at depth. Feedback token count grows exponentially (~2.2x per additional stage), and when compressed to fit context windows, the feedback loses specificity — downstream update success rates drop from 36% to 5% at 5x scale.
TEP's Two-Phase Solution: Inspired by Equilibrium Propagation from energy-based models, TEP decouples optimization into local and global concerns. In the free phase, each node in the pipeline gets its own LLM critic that iteratively evaluates and refines the node's prompt/output against six quality dimensions (structural clarity, completeness, consistency, context integration, reasoning transparency, format compliance) until scores stabilize — this is "equilibrium." In the nudged phase, small task-aligned edits are applied to each node's prompt using the actual task objective (e.g., final answer accuracy), propagated via forward signaling rather than backward chains. A nudge strength parameter beta (annealed by 0.9x per iteration) bounds how much each edit can change, preventing oscillation. The result: stable token costs across depth, consistent 33-37% update success rates even at 5x scale, and accuracy gains that grow with depth.