Abstract
Optimizing prompts for black-box Large Language Models (LLMs) is a resource-intensive task often hindered by data privacy constraints. We present FedPOB and FedPOB-Pref, two federated multi-armed bandit algorithms designed for sample-efficient prompt optimization. By sharing lightweight model parameters instead of private data, multiple agents can collaboratively find optimal prompts using either direct score feedback or human preferences. Our methods demonstrate significant performance gains and communication efficiency across major benchmarks like Instruction Induction and BIG-Bench Hard.
Introduction
Large Language Models (LLMs) are highly sensitive to prompt phrasing, making prompt optimization a critical task for maximizing performance. However, real-world optimization faces three primary challenges: the black-box nature of high-performing models (e.g., GPT-4), the high cost of API queries, and the privacy constraints that prevent users from sharing proprietary prompt data. Existing federated learning approaches often rely on "white-box" access, which is inapplicable to API-based models.
To address these hurdles, we introduce FedPOB and FedPOB-Pref, federated multi-armed bandit (MAB) algorithms that enable collaborative prompt optimization without compromising data privacy.
Methodology
We frame federated prompt optimization as a Multi-Armed Bandit problem. Discrete text prompts are mapped into continuous vector embeddings using a pre-trained model (MPNet). A linear model is then trained to predict prompt performance based on these embeddings.
The framework supports two types of feedback:
- FedPOB (Score Feedback): Based on the federated Linear Upper Confidence Bound (LinUCB) algorithm, agents balance exploration and exploitation. Instead of sharing raw data, agents periodically exchange mathematical matrices (LinUCB parameters) with a central server for aggregation.
- FedPOB-Pref (Preference Feedback): Designed for scenarios where users provide pairwise preferences (A vs. B). To handle the noise inherent in human preferences, FedPOB-Pref utilizes parameter sharing combined with a dynamic regularization penalty. This ensures local models do not diverge excessively from the global consensus, stabilizing the learning process.
Experimental Evaluation
We evaluated our methods on over 50 tasks from the Instruction Induction (29 tasks) and BIG-Bench Hard (BBH) (24 tasks) benchmarks. We utilized models including GPT-3.5-turbo, GPT-4o-mini, and Qwen3-235B. To simulate realistic scenarios, prompt search spaces were generated using the Automatic Prompt Engineer (APE) method.
Results and Discussion
Our experiments confirm that collaboration significantly accelerates the discovery of high-performing prompts. As shown in the performance curves, increasing the number of agents leads to higher average rewards across both benchmarks.
Key Performance Metrics
- FedPOB Efficiency: On Instruction Induction, a 10-agent FedPOB setup achieved an average accuracy of 0.712, outperforming the federated baseline FedOne (0.645) and the standard INSTINCT (0.669) within a strict budget of 50 validation queries.
- FedPOB-Pref Communication Gains: FedPOB-Pref demonstrated massive communication efficiency. It achieved a score of 0.8482 on Instruction Induction in just 50 communication rounds, whereas the FLDB-GD baseline required 1,500 rounds to reach a lower score of 0.8244—a 30x reduction in overhead.
- Robustness: FedPOB maintained strong performance even under limited communication frequency, proving its viability for real-world networks with bandwidth constraints.
Conclusion
FedPOB and FedPOB-Pref provide a sample-efficient and privacy-preserving pathway for collaborative prompt optimization. By leveraging bandit algorithms and parameter aggregation, these methods overcome the limitations of black-box API access and noisy human feedback. Future work will explore the generation of novel discrete prompts on the fly, moving beyond selection from pre-defined pools, and investigating non-linear reward modeling for more complex reasoning tasks.
Summary updated