Automatic prompt optimization is a promising direction to boost the performance of Large Language Models (LLMs). However, existing methods often suffer from noisy and conflicting update signals. In this research, we propose C-MOP (Cluster-based Momentum Optimized Prompting), a framework that stabilizes optimization via Boundary-Aware Contrastive Sampling (BACS) and Momentum-Guided Semantic Clustering (MGSC). Specifically, BACS utilizes batch-level information to mine tripartite features--Hard Negatives, Anchors, and Boundary Pairs--to precisely characterize the typical representation and decision boundaries of positive and negative prompt samples. To resolve semantic conflicts, MGSC introduces a textual momentum mechanism with temporal decay that distills persistent consensus from fluctuating gradients across iterations. Extensive experiments demonstrate that C-MOP consistently outperforms SOTA baselines like PromptWizard and ProTeGi, yielding average gains of 1.58% and 3.35%. Notably, C-MOP enables a general LLM with 3B activated parameters to surpass a 70B domain-specific dense LLM, highlighting its effectiveness in driving precise prompt evolution. The code is available at https://github.com/huawei-noah/noah-research/tree/master/C-MOP.
翻译:自动提示优化是提升大语言模型性能的一个有前景的方向。然而,现有方法常受噪声和冲突的更新信号困扰。本研究提出C-MOP,一种基于聚类的动量优化提示框架,它通过边界感知对比采样和动量引导语义聚类来稳定优化过程。具体而言,BACS利用批次级信息挖掘三元特征——困难负例、锚点和边界对——以精确刻画正负提示样本的典型表示与决策边界。为解决语义冲突,MGSC引入了一种具有时间衰减的文本动量机制,该机制能从迭代过程中波动的梯度中提炼出持久的共识。大量实验表明,C-MOP在PromptWizard和ProTeGi等SOTA基线方法上持续取得优势,平均增益分别达到1.58%和3.35%。值得注意的是,C-MOP使一个仅激活30亿参数的通用大语言模型超越了拥有700亿参数的领域专用稠密大语言模型,突显了其在驱动精确提示演化方面的有效性。代码发布于 https://github.com/huawei-noah/noah-research/tree/master/C-MOP。