Optimizing Instructions and Demonstrations for Multi-Stage Language Model Programs
Krista Opsahl-Ong, Michael J. Ryan, Josh Purtell, David Broman, Christopher Potts, Matei Zaharia, Omar Khattab
摘要
Language Model Programs, i.e. sophisticated pipelines of modular language model (LM) calls, are increasingly advancing NLP tasks. However, building these pipelines requires crafting prompts that are jointly effective for all modules. We study prompt optimization for LM programs, i.e. how to update these prompts to maximize a downstream metric without access to module-level labels or gradients. To make this tractable, we factorize our problem into optimizing the free-form instructions and few-shot demonstrations of every module and introduce several strategies to craft task-grounded instructions and navigate credit assignment across modules. Our strategies include (i) program-and-data-aware techniques for proposing effective instructions, (ii) a stochastic mini-batch evaluation function for learning a surrogate model of our objective, and (iii) a meta-optimization procedure in which we refine how LMs construct proposals over time. Using these insights we develop MIPRO, a novel optimizer that outperforms baselines on five of seven diverse LM programs using a best-in-class open-source model (Llama3-8B), by as much as 13% accuracy. We have released our new optimizers and benchmark in DSPy at http://dspy.ai .
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 49 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Teach Better or Show Smarter? On Instructions and Exemplars in Automatic Prompt Optimization 引用了 Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
- Multi-Agent Design: Optimizing Agents with Better Prompts and Topologies 引用了 Teach Better or Show Smarter? On Instructions and Exemplars in Automatic Prompt Optimization
- Meta Context Engineering via Agentic Skill Evolution 引用了 Agentic Context Engineering: Evolving Contexts for Self-Improving Language Models
- DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction 引用了 Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
- ToolLLM: Facilitating Large Language Models to Master 16000+ Real-world APIs 引用了 Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
- Agentic Context Engineering: Evolving Contexts for Self-Improving Language Models 引用了 Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
- Agentic Context Engineering: Evolving Contexts for Self-Improving Language Models 引用了 GEPA: Reflective Prompt Evolution Can Outperform Reinforcement Learning
- GEPA: Reflective Prompt Evolution Can Outperform Reinforcement Learning 引用了 Teach Better or Show Smarter? On Instructions and Exemplars in Automatic Prompt Optimization
- GEPA: Reflective Prompt Evolution Can Outperform Reinforcement Learning 引用了 SGLang: Efficient Execution of Structured Language Model Programs
- GEPA: Reflective Prompt Evolution Can Outperform Reinforcement Learning 引用了 Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
引用它的顶会 Paper49
- GEPA: Reflective Prompt Evolution Can Outperform Reinforcement LearningLakshya A. Agrawal, Shangyin Tan, Dilara Soylu, Noah Ziems 等ICLR 2026 · 466 次引用
- Agentic Context Engineering: Evolving Contexts for Self-Improving Language ModelsQizheng Zhang, Changran Hu, Shubhangi Upasani, Boyuan Ma 等ICLR 2026 · 374 次引用
- Multi-Agent Design: Optimizing Agents with Better Prompts and TopologiesHan Zhou, Xingchen Wan, Ruoxi Sun, Hamid Palangi 等ICLR 2026 · 127 次引用
- Teach Better or Show Smarter? On Instructions and Exemplars in Automatic Prompt OptimizationXingchen Wan, Ruoxi Sun, Hootan Nakhost, Sercan Ö. ArikNeurIPS 2024 · 35 次引用
- Meta Context Engineering via Agentic Skill EvolutionHaoran Ye, Xuning He, Vincent Arak, Haonan Dong 等ICML 2026 · 30 次引用
它引用的 Paper23
- Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma 等NeurIPS 2022 · 22,562 次引用
- SGLang: Efficient Execution of Structured Language Model ProgramsLianmin Zheng, Liangsheng Yin, Zhiqiang Xie, Chuyue Sun 等NeurIPS 2024 · 1,586 次引用
- ToolLLM: Facilitating Large Language Models to Master 16000+ Real-world APIsYujia Qin, Shihao Liang, Yining Ye, Kunlun Zhu 等ICLR 2024 · 1,469 次引用
- AutoPrompt: Eliciting Knowledge from Language Models with Automatically Generated PromptsTaylor Shin, Yasaman Razeghi, Robert L. Logan IV, Eric Wallace 等EMNLP 2020 · 1,162 次引用
- DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-CorrectionMohammadreza Pourreza, Davood RafieiNeurIPS 2023 · 909 次引用
相关 Paper
- DSPy: Compiling Declarative Language Model Calls into State-of-the-Art PipelinesOmar Khattab, Arnav Singhvi, Paridhi Maheshwari, Zhiyuan Zhang 等ICLR 2024 · 170 次引用
- Large Language Models as OptimizersChengrun Yang, Xuezhi Wang, Yifeng Lu, Hanxiao Liu 等ICLR 2024 · 817 次引用
- metaTextGrad: Automatically optimizing language model optimizersGuowei Xu, Mert Yüksekgönül, Carlos Guestrin, James Y. ZouNeurIPS 2025 · 5 次引用
- Dual-Phase Accelerated Prompt OptimizationMuchen Yang, Moxin Li, Yongle Li, Zijun Chen 等EMNLP Findings 2024
- LangProBe: a Language Program BenchmarkShangyin Tan, Lakshya A. Agrawal, Arnav Singhvi, Liheng Lai 等EMNLP Findings 2025
