stanfordnlp / dspy

DSPy: The framework for programming—not prompting—foundation models
https://dspy-docs.vercel.app/
MIT License
16.73k stars 1.29k forks source link

Grammar-Based Prompt Format Optimization #1384

Closed diegovalenzuelaiturra closed 1 month ago

diegovalenzuelaiturra commented 1 month ago

Hi,

As I’m learning about DSPy, I came across an interesting approach that uses grammar-based prompt format optimization. I’m curious if this is something already implemented in DSPy, or if the current method is considered more effective.

The method I found involves defining a prompt format optimization problem as a search over a space of semantically equivalent prompt formats defined by a grammar. They propose using Bayesian optimization to explore this space efficiently under a user-specified computational budget.

Here’s the paper for reference:

Quantifying Language Models' Sensitivity to Spurious Features in Prompt Design or: How I learned to start worrying about prompt formatting

IMG_6184

Thanks for your insights!

arnavsinghvi11 commented 1 month ago

This might be better placed in Discussions, and feel free to explore the MIPROv2 optimizer which uses Bayesian optimization to produce optimized prompts - might be a useful application here or room for improvement to include in MIPRO!