Abstract
This paper introduces MIPRO (Multi-prompt Instruction PRoposal Optimizer), a novel algorithm for the automatic optimization of multi-stage Language Model (LM) programs. As NLP transitions from single prompts to complex pipelines, manual prompt engineering becomes increasingly difficult due to the challenge of credit assignment across multiple modules. MIPRO addresses this by jointly tuning free-form instructions and few-shot demonstrations using a grounded proposal mechanism and Bayesian search. Experimental results across seven diverse reasoning tasks demonstrate that MIPRO achieves up to a 13% accuracy improvement over existing baselines, highlighting the efficacy of joint optimization in complex LM workflows.
Introduction
Modern NLP applications are increasingly built as "LM Programs"—complex pipelines where multiple LM calls are chained together to perform tasks like multi-hop reasoning or Retrieval-Augmented Generation (RAG). While powerful, these programs introduce a significant optimization challenge: "prompt engineering" for a single stage is difficult, but for a multi-stage pipeline, it becomes exponentially harder. Developers often find themselves in a manual trial-and-error loop, attempting to find a configuration where all modules work effectively together without clear signals on which specific prompt in the chain is underperforming.
The Challenge of Credit Assignment
The core difficulty in optimizing multi-stage programs is credit assignment. If a final answer is incorrect, it is often unclear which intermediate step was responsible. Most existing optimizers either focus on single-stage prompts or require expensive "gold labels" for every intermediate step, which are rarely available in real-world scenarios.
The MIPRO Optimization Framework
The researchers propose MIPRO, a factorized approach that treats instructions and few-shot demonstrations as separate parameters to be tuned. The MIPRO workflow consists of three primary stages:
- Bootstrapping Demonstrations: The system runs training inputs through the program and saves "traces" of successful executions. These successful traces serve as candidate few-shot examples for each module.
- Grounded Instruction Proposal: A "proposer" LM generates new instruction candidates. To ensure relevance, the proposer is "grounded" with context, including a summary of the dataset, the program's control flow, and examples of successful bootstrapped traces.
- Bayesian Search: To navigate the vast space of possible instruction and demonstration combinations, MIPRO employs a Bayesian surrogate model (specifically the Tree-structured Parzen Estimator). This model learns which combinations are likely to succeed based on previous trials, making the search significantly more efficient than random sampling.
Additionally, the authors introduced MIPRO++, which adds a meta-optimization layer to tune the proposer's own hyperparameters, such as temperature and specific generation "tips," to further refine the instruction quality for specific tasks.
Experimental Setup and Datasets
The effectiveness of MIPRO was evaluated on a benchmark of seven diverse LM programs:
- HotPotQA & HotPotQA Conditional: Multi-hop retrieval and QA tasks.
- Iris & Iris-Typo: Classification tasks testing robustness.
- Heart Disease: Clinical classification requiring opinion aggregation.
- ScoNe: Natural language inference focusing on logical negation.
- HoVer: Complex multi-hop claim verification.
Results and Key Insights
MIPRO outperformed baseline optimizers on five out of seven tasks using Llama-3-8B as the task model. Notably, on the ScoNe task, MIPRO reached 79.4% accuracy, compared to a 69.1% zero-shot baseline. On HotPotQA Conditional, performance jumped from 6% to 23.3%, showcasing the model's ability to learn complex formatting rules through optimized instructions.
Key insights from the study include:
- Joint Optimization is Essential: Tuning both demonstrations and instructions together consistently yields the best results compared to optimizing either in isolation.
- Instructions for Subtle Logic: For tasks with strict formatting or logical rules, instruction optimization is significantly more impactful than few-shot examples.
- The Power of Grounding: Providing the proposer LM with dataset summaries and program code significantly improves the quality of generated instructions.
- Baseline Strength: The researchers found that even simple Bootstrap Random Search is a remarkably strong baseline, often outperforming instruction-only optimizers.
Conclusion and Future Work
While MIPRO represents a significant step forward, limitations remain. The optimizer still requires a reasonable "seed" prompt to discover complex latent rules. Future research will explore the impact of different proposer models and the dynamics of optimization under varying computational budgets. MIPRO has been integrated into the DSPy framework, providing the developer community with robust tools for building and optimizing complex LM programs.
Summary updated