分段优化提示词,让小模型推理更准更稳。
Modular Prompt Optimization: Optimizing Structured Prompts with Section-Local Textual Gradients
- 将提示词拆成多个语义模块,分别优化
- 在两个基准测试中准确率显著提升
- 适合想改进小模型推理的开发者
提示词质量对大语言模型行为、可靠性及推理表现至关重要,尤其对依赖显式结构的小型开源指令微调模型。现有方法多将提示词视为整体文本块,难以定位错误、保护关键指令或控制长度膨胀。本文提出模块化提示优化(MPO),将提示词视为由系统角色、上下文、任务描述、约束和输出格式等固定语义模块组成的结构化对象。MPO利用评论模型生成的局部文本梯度,独立优化每个模块,并通过去重合并更新内容,减少组件间干扰。在ARC-Challenge和MMLU两个推理基准上,使用LLaMA-3 8B-Instruct和Mistral-7B-Instruct作为求解器模型进行评估,MPO在两种模型和两个数据集上均优于未优化的结构化提示和TextGrad基线,显著提升准确率,且无需修改模型参数或改变提示结构。结果表明,在保持提示结构不变的前提下,进行局部分段优化是提升小型开源模型推理性能的有效实用方法。
原文摘要 · Abstract (English)
Prompt quality plays a central role in controlling the behavior, reliability, and reasoning performance of large language models (LLMs), particularly for smaller open-source instruction-tuned models that depend heavily on explicit structure. While recent work has explored automatic prompt optimization using textual gradients and self-refinement, most existing methods treat prompts as monolithic blocks of text, making it difficult to localize errors, preserve critical instructions, or prevent uncontrolled prompt growth. We introduce Modular Prompt Optimization (MPO), a schema-based prompt optimization framework that treats prompts as structured objects composed of fixed semantic sections, including system role, context, task description, constraints, and output format. MPO applies section-local textual gradients, generated by a critic language model, to refine each section independently while keeping the overall prompt schema fixed. Section updates are consolidated through de-duplication to reduce redundancy and interference between components, yielding an interpretable and robust optimization process. We evaluate MPO on two reasoning benchmarks, ARC-Challenge and MMLU, using LLaMA-3 8B-Instruct and Mistral-7B-Instruct as solver models. Across both benchmarks and models, MPO consistently outperforms an untuned structured prompt and the TextGrad baseline, achieving substantial accuracy gains without modifying model parameters or altering prompt structure. These results demonstrate that maintaining a fixed prompt schema while applying localized, section-wise optimization is an effective and practical approach for improving reasoning performance in small open-source LMs.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。