Instance vs Prompt Optimization
Optimize one test-time solution for a single query, or optimize a prompt that must generalize across many queries — different variables, same feedback loop.
TextGrad-style textual gradient descent supports two harness patterns:
- Instance optimization — the variable is a single solution (answer, code patch, plan, domain artifact) refined at test time for that query. Closest kin to reflection and error correction / Reflexion, but driven by graph-local textual gradients rather than only episodic memory. See test-time solution refinement for the self-supervised LLM-loss pattern (e.g. GPQA/MMLU gains) and test-time code refinement when local tests exist. Domain simulators (molecules, treatment plans) can be loss edges too — use multi-metric objectives when no single score suffices, and treat in-silico wins as provisional under compound AI system optimization.
- Prompt optimization — the variable is a prompt (often a system instruction) trained on a small set so it generalizes to new queries — instruction vs demonstration optimization and strong-to-weak prompt optimization.
Do not confuse them in the harness: instance updates are per-episode and must not silently rewrite shared templates; prompt updates are offline artifacts that need validation suites before becoming the default system prompt architecture.
Sources
- TextGrad (Yuksekgonul et al.), ch. 2