diff --git a/examples/spo/README.md b/examples/spo/README.md index 4e711e4c2..75dd02241 100644 --- a/examples/spo/README.md +++ b/examples/spo/README.md @@ -1,4 +1,4 @@ -# SPO | Self-Supervised Prompt PromptOptimizer +# SPO | Self-Supervised Prompt Optimization An automated prompt engineering tool for Large Language Models (LLMs), designed for universal domain adaptation. @@ -16,7 +16,7 @@ ## ✨ Core Advantages - ⚡ **Universal Adaptation** - _Closed & open-ended tasks supported_ - 🔄 **Self-Evolving** - _Auto-optimization via LLM-as-judge mechanism_ -[Read our paper on arXiv](coming soon) +[Read our paper](./Self-Supervised Prompt Optimization.pdf) ## 📊 Experiment @@ -74,7 +74,9 @@ ### 2. Define Your Iteration template 📝 ### 3. Implement the PromptOptimizer 🔧 -Use `metagpt/ext/spo/optimize.py` to execute: +You have three ways to run the PromptOptimizer: + +#### Option 1: Python Script ```python from metagpt.ext.spo.components.optimizer import PromptOptimizer @@ -101,7 +103,7 @@ # Create and run optimizer optimizer.optimize() ``` -Or you can use command line interface: +#### Option 2: Command Line Interface ```bash python -m examples.spo.optimize @@ -128,6 +130,14 @@ # Create and run optimizer python -m examples.spo.optimize --help ``` +#### Option 3: Streamlit Web Interface + +For a more user-friendly experience, you can use the Streamlit web interface to configure and run the optimizer: + +```bash +streamlit run metagpt/ext/spo/app.py +``` + ### 4. View Results ``` workspace @@ -152,3 +162,16 @@ ### 4. View Results - `results.json`: Stores whether each iteration round was judged successful and other related information - `prompt.txt`: The optimized prompt for the corresponding round - `answers.txt`: The output results generated using the prompt for the corresponding round + +## Citation + +If you use SPO in your research, please cite our paper: + +``` +@misc{xiang2025spo, + title = {Self-Supervised Prompt Optimization}, + author = {Xiang, Jinyu and Zhang, Jiayi and Yu, Zhaoyang and Teng, Fengwei and Tu, Jinhao and Liang, Xinbing and Hong, Sirui and Wu, Chenglin and Luo, Yuyu}, + year = {2025}, + url = {D:\PythonProject\AFlow\MetaGPT-AFLow\examples\spo\Self-Supervised Prompt Optimization.pdf} +} +``` \ No newline at end of file diff --git a/examples/spo/SPO.pdf b/examples/spo/Self-Supervised Prompt Optimization.pdf similarity index 100% rename from examples/spo/SPO.pdf rename to examples/spo/Self-Supervised Prompt Optimization.pdf