# Optimizing Instructions and Demonstrations for Multi-Stage Language Model Programs

This paper addresses the challenge of optimizing prompts for multi-stage language model (LM) programs, which are sophisticated pipelines composed of modular LM calls.&#x20;

The goal is to maximise a downstream metric without requiring access to module-level labels or gradients. The authors propose a novel optimizer called MIPRO, which employs several strategies to optimize free-form instructions and few-shot demonstrations for each module within the pipeline.

{% embed url="<https://arxiv.org/abs/2406.11695>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://training.continuumlabs.ai/knowledge/retrieval-augmented-generation/optimizing-instructions-and-demonstrations-for-multi-stage-language-model-programs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
