Self-Supervised Prompt Optimization

Jinyu Xiang, Jiayi Zhang, Zhaoyang Yu, Xinbing Liang, Fengwei Teng +6 more
2/7/2025
cs.CLcs.AIcs.LG

Official code: FoundationAgents/SPO (76 stars, MIT, last commit 2025-10-19). 2 more implementations below.

Abstract

Well-designed prompts are crucial for enhancing Large language models' (LLMs) reasoning capabilities while aligning their outputs with task requirements across diverse domains. However, manually designed prompts require expertise and iterative experimentation. While existing prompt optimization methods aim to automate this process, they rely heavily on external references such as ground truth or by humans, limiting their applicability in real-world scenarios where such data is unavailable or costly to obtain. To address this, we propose Self-Supervised Prompt Optimization (SPO), a cost-efficient framework that discovers effective prompts for both closed and open-ended tasks without requiring external reference. Motivated by the observations that prompt quality manifests directly in LLM outputs and LLMs can effectively assess adherence to task requirements, we derive evaluation and optimization signals purely from output comparisons. Specifically, SPO selects superior prompts through pairwise output comparisons evaluated by an LLM evaluator, followed by an LLM optimizer that aligns outputs with task requirements. Extensive experiments demonstrate that SPO outperforms state-of-the-art prompt optimization methods, achieving comparable or superior results with significantly lower costs (e.g., 1.1% to 5.6% of existing methods) and fewer samples (e.g., three samples). The code is available at https://github.com/FoundationAgents/SPO.

View on arXivView PDF

Code Implementations(3)

MIT

Self Supervised Prompt Optimization.

7613PythonMar 12, 20251 years agoMIT
MIT

๐ŸŒŸ The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

69,0078,809Shell, PythonJun 30, 20239 months agoMIT
agentgptllmmetagptmulti-agent
phureewat29/sspoCommunity61%
MIT

Self-Supervised Prompt Optimization in TypeScript. https://arxiv.org/pdf/2502.06855

30JavaScript, TypeScriptJun 27, 20251 years agoMIT
aillmprompt-optimizationtypescript

Similar Papers

Cite this paper

@article{xiang2025selfsupervised,
  title  = {Self-Supervised Prompt Optimization},
  author = {Jinyu Xiang and Jiayi Zhang and Zhaoyang Yu and Xinbing Liang and Fengwei Teng and Jinhao Tu and Fashen Ren and Xiangru Tang and Sirui Hong and Chenglin Wu and Yuyu Luo},
  year   = {2025},
  eprint = {2502.06855},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2502.06855v3}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2502.06855.svg)](https://codeofpaper.com/paper/2502.06855)

Discussion