Black-Box Prompt Optimization: Aligning Large Language Models without Model Training

Jiale Cheng, Xiao Liu, Kehan Zheng, Pei Ke, Hongning Wang, Yuxiao Dong, Jie Tang, Minlie Huang

Abstract

Aligning Large Language Models (LLMs) with human intent typically requires computationally expensive fine-tuning techniques like Reinforcement Learning from Human Feedback (RLHF) or Direct Preference Optimization (DPO). These methods are often impractical for massive models and impossible for closed-source "black-box" APIs. This paper introduces Black-Box Prompt Optimization (BPO), a method that aligns models by automatically rewriting user prompts to better match an LLM’s internal "understanding" without altering model weights. By utilizing a 7B-parameter model as a prompt optimizer, BPO achieves significant performance gains across a wide range of open-source and proprietary models, demonstrating that input-level alignment is a viable and efficient alternative to traditional model training.

Introduction

The "alignment problem" remains a central challenge in AI research: ensuring that LLM outputs consistently match human preferences and intentions. While RLHF and DPO have become standard solutions, they face significant hurdles regarding computational efficiency and accessibility for proprietary models like GPT-4 or Claude. Furthermore, a fundamental "alignment gap" exists between how humans phrase intentions—often ambiguous or disorganized—and how LLMs most effectively process instructions.

BPO framework and performance overview across various LLMs.

The authors of this study propose that instead of modifying the model to fit the human, we can modify the input to fit the model. BPO acts as a "prompt translator," bridging the gap between human-style prompts and model-optimized instructions.

Methodology

The BPO framework involves a three-stage pipeline designed to create an automated prompt optimizer:

  1. Feedback Data Collection: The researchers utilized existing preference datasets (e.g., OASST1, HH-RLHF) containing prompts paired with "good" and "bad" responses.
  2. Optimized Prompt Construction: A powerful LLM (ChatGPT) served as a "critic" to analyze the paired responses. The critic identified the specific qualities that made the "good" response superior and then rewrote the original prompt to explicitly demand those qualities (e.g., requesting step-by-step reasoning or a specific tone).
  3. Prompt Optimizer Training: Using 14,000 pairs of (Original Prompt $\rightarrow$ Optimized Prompt), the team fine-tuned a Llama-2-7b-chat model.
The three-stage alignment process of Black-Box Prompt Optimization.

At inference time, a user's raw prompt is first processed by the BPO model. The resulting refined prompt is then passed to the target "black-box" LLM.

Experimental Setup and Datasets

The BPO optimizer was trained on 14k samples curated from four major sources: OASST1 (crowd-sourced dialogues), HH-RLHF (Anthropic’s safety dataset), Chatbot Arena (real-world interactions), and Alpaca-GPT4 (synthetic instructions). Evaluation was conducted across four diverse benchmarks: Dolly Eval, Vicuna Eval, Self-Instruct Eval, and a dedicated BPO-test Eval.

Key Results and Insights

Quantitative evaluations, performed by GPT-4 and Claude-v1.3, showed substantial improvements across the board:

  • Proprietary Models: GPT-3.5-Turbo saw a 22% increase in win rate, while GPT-4 achieved a 10% increase, demonstrating that even state-of-the-art models benefit from optimized inputs.
  • Open-Source Models: Vicuna-7b and Llama-2-13b-chat experienced win rate jumps of 18-22%.
  • Orthogonality to Training: BPO is not merely a replacement for RLHF but a supplement. Models already aligned via PPO or DPO (like Vicuna-13b) still saw significant performance boosts when BPO was applied.
  • Efficiency and Interpretability: A 13B model using BPO often outperformed a 70B model using raw prompts, suggesting that "prompting debt" significantly impacts perceived model capability. Unlike weight updates, BPO refinements are human-readable, offering transparency into how the model is being guided.

Discussion and Limitations

While BPO offers a powerful, model-agnostic alignment tool, it has certain limitations. In summarization tasks, the optimizer occasionally attempts to "optimize" the source text rather than just the instruction. It also faces challenges in complex mathematical reasoning, likely due to a lack of specialized math-preference data in the training set. Furthermore, this study focused on single-turn interactions; extending BPO to multi-turn dialogues remains a future research direction.

In conclusion, Black-Box Prompt Optimization provides a scalable, interpretable, and highly effective method for aligning LLMs. By shifting the focus from model training to input optimization, BPO enables alignment for any model, regardless of its size or accessibility.

Summary updated

BibTeX
@inproceedings{cheng2024black,
  author = {Jiale Cheng and Xiao Liu and Kehan Zheng and Pei Ke and Hongning Wang and Yuxiao Dong and Jie Tang and Minlie Huang},
  title = {{Black-Box Prompt Optimization: Aligning Large Language Models without Model Training}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2024},
  doi = {10.18653/v1/2024.acl-long.176},
}
Figure