Share your thoughts, 1 month free Claude Pro on usSee more
WorkDL logo mark

Scaling Textual Gradients via Sampling-Based Momentum

About

LLM-based prompt optimization, which uses LLM-provided ``textual gradients'' (feedback) to refine prompts, has emerged as an effective method for automatic prompt engineering. However, its scalability and stability are unclear when using more data in training. We systematically investigate the potential and challenges of scaling training data in textual gradient descent. We show that naively scaling training examples is infeasible due to both explicit context-length limits and an implicit context wall, where long-context degradation yields diminishing returns. Inspired by prior wisdom in stochastic gradient descent, we propose Textual Stochastic Gradient Descent with Momentum (TSGD-M), which reweights updates through momentum sampling, using bootstrapped minibatch validation accuracy as importance weights over historical prompts. To stabilize TSGD and enable effective scaling within a limited context window, TSGD-M carries prior prompts information by \textit{dynamically} exploring the past top performing prompts without expanding input context length. TSGD-M integrates seamlessly into existing prompt optimization frameworks, including TextGrad, DSPy-COPRO, and AdalFlow, and achieves consistent gains across 6 benchmarks.

Zixin Ding, Junyuan Hong, Zhan Shi, Jiachen T. Wang, Zinan Lin, Li Yin, Meng Liu, Zhangyang Wang, Yuxin Chen• 2025

Related benchmarks

TaskDatasetResultRank
Multi-hop Question AnsweringHotpotQA (test)--
334
Question ClassificationTREC (test)
Accuracy87.98
150
Text ClassificationTREC (test)
Accuracy85.44
132
Science Question AnsweringARC Challenge (test)
Accuracy94.02
60
Mathematical Problem SolvingMATH (test)
Accuracy93.22
45
Instruction FollowingIFBench (test)
Score40.91
36
MathGSM8K (test)
Mean@494.04
28
Mathematical Problem SolvingMATH Algebra (test)
Accuracy86.78
11
Long-Form Generation and RetrievalHotPotQA full-wiki (test)
Accuracy50.66
10
Showing 9 of 9 rows

Other info

Follow for update