Particle Swarm Optimization for Automating Prompt Optimization in Large Language Models on Text Classification and Generation Tasks
Abstract
Large Language Models (LLMs) have demonstrated remarkable abilities in responding to natural language instructions, but their performance depends on prompts, with high-quality prompts requiring human expertise and effort. Current prompt optimization techniques include continuous prompt-based and discrete prompt-based methods. The former requires access to LLMs' parameters which is time-consuming and the latter might lead to suboptimal results due to confined search space. To address the above limitations, we propose PSOPrompt, which retains exploratin capabilities of continuous prompts without altering LLMs' parameters. Noting the continuous nature of embeddings and the success of PSO for continuous optimization problems, it is used as the optimization method, with each embedding treated as an individual. To integrate continuous prompts with discrete prompts, embedding inversion is employed and a new encoding strategy is conceived. In the evolution process, it is discovered that incorporating expert knowledge into the initialization contributes to better outcomes. Experimental results demonstrate that PSOPrompt matches or outperforms existing approaches.
BibTeX
@inproceedings{li2025particle,
author = {Linsen Li and Bin Wang and Bing Xue and Mengjie Zhang},
title = {{Particle Swarm Optimization for Automating Prompt Optimization in Large Language Models on Text Classification and Generation Tasks}},
booktitle = {Proceedings of the Genetic and Evolutionary Computation Conference Companion},
year = {2025},
doi = {10.1145/3712255.3726598},
}Ask Althea to put this paper to the test.
Loading related content...