Add MIPROv2 optimizer implementation - #18
Merged
Merged
Conversation
Implements MIPROv2 (Multi-prompt Instruction Proposal Optimizer v2) as an alternative to COPRO for prompt optimization. MIPROv2 uses LLMs to generate program descriptions and candidate prompts based on execution traces and prompting best practices. Key additions: - mipro.rs: Core optimizer with 3-stage process (trace generation, candidate generation via LLM, evaluation/selection) - 29 test cases covering trace handling, candidate selection, configuration, and edge cases - Example (08-optimize-mipro.rs) demonstrating optimization on HotpotQA - Prompting tips library with 15+ best practices - Updated README with optimizer comparison and usage MIPROv2 trades speed for quality - it makes more LLM calls but produces better prompts by leveraging prompting techniques. Recommended for complex tasks with decent training data (15+ examples).
krypticmouse
approved these changes
Oct 6, 2025
krypticmouse
left a comment
Owner
There was a problem hiding this comment.
LGTM! I'll suggest to store all tests in the test folder and docs in the suitable group as well! But now worries if you can't I can take care of it!
Owner
|
Thank you so much for the contribution! |
Owner
|
As another suggestion we can also use Prompting tips as output from Signature but it's mostly an implementation choice. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements MIPROv2 (Multi-prompt Instruction Proposal Optimizer v2) as an alternative to COPRO for prompt optimization. MIPROv2 uses LLMs to generate program descriptions and candidate prompts based on execution traces and prompting best practices.
Key Changes
mipro.rs): 3-stage process08-optimize-mipro.rs): Full working example with HotpotQAImplementation Details
Trace,PromptCandidate,PromptingTipsTrade-offs
MIPROv2 trades speed for quality - makes more LLM calls but produces better prompts by leveraging prompting techniques.
Use MIPROv2 when:
Use COPRO when:
Testing
cargo test optimizer::mipro::tests cargo run --example 08-optimize-mipro --features parquet