arXiv:2506.00400cs.CLcs.AI2025-06被引 5

通过采样动量优化文本梯度,实现大规模提示工程的稳定扩展。

Scaling Textual Gradients via Sampling-Based Momentum

  • 引入基于采样动量的文本随机梯度下降,动态重加权更新。
  • 在6个基准上实现一致提升,突破长上下文退化瓶颈。
  • 适合需要大规模自动提示优化的研究者和工程师使用。

基于大模型的提示优化利用大模型提供的“文本梯度”(反馈)来改进提示,已成为自动提示工程的有效方法。然而,当训练数据增多时,其可扩展性和稳定性尚不明确。我们系统研究了在文本梯度下降中扩大训练数据的潜力与挑战。发现直接扩大训练样本不可行,既受显式上下文长度限制,也受隐式上下文墙影响——长上下文退化导致回报递减。受随机梯度下降启发,我们提出文本随机梯度下降带动量(TSGD-M),通过动量采样重加权更新,以自助小批量验证准确率作为历史提示的重要性权重。为在有限上下文窗口内稳定TSGD并实现有效扩展,TSGD-M通过动态探索过往表现最佳提示,无需增加输入上下文长度即可保留历史信息。该方法可无缝集成至TextGrad、DSPy-COPRO和AdalFlow等现有框架,在6个基准上均取得一致增益。

原文摘要 · Abstract (English)

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.

提示优化梯度下降大模型自动化

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。