BBTv2: Pure Black-Box Optimization Can Be Comparable to Gradient Descent for Few-Shot Learning

Tianxiang Sun, Zhengfu He, Hong Qian, Xuanjing Huang, Xipeng QiuarXiv 2022

Introduction

As Large Language Models (LLMs) scale to billions of parameters, the computational cost of traditional fine-tuning via gradient descent has become prohibitive. Moreover, many state-of-the-art models are now delivered as "Language-Model-as-a-Service" (LMaaS), where users only have access to inference APIs, making internal gradients inaccessible. While previous "Black-Box Tuning" (BBT) methods optimized small prompts at the input layer, they often struggled with complex reasoning tasks and slow convergence.

BBTv2 addresses these challenges by introducing a purely gradient-free optimization method that achieves performance comparable to state-of-the-art gradient-based methods like LoRA and full fine-tuning, using only forward passes.

Methods

BBTv2 evolves the original BBT framework through three primary innovations:

  1. Deep Prompting: Unlike standard BBT which only modifies the input layer, BBTv2 prepends continuous prompt tokens to the hidden states of every model layer. This increases the tunable parameter space from approximately 500 to 1.2 million, significantly boosting expressive power.
  2. Divide-and-Conquer (DC) Optimization: To manage the high-dimensional optimization of 1.2M parameters without gradients, BBTv2 exploits the residual connection architecture of modern transformers. This allows the problem to be decomposed into smaller, layer-wise sub-problems, optimized alternately using the Covariance Matrix Adaptation Evolution Strategy (CMA-ES).
  3. Model-Aware Random Projection: High-dimensional prompts are projected into a low-dimensional subspace. BBTv2 uses a normal distribution scaled to match the standard deviation of the model's internal embeddings, ensuring synthetic prompts align with the model's pre-trained data distribution for faster convergence.
Architectural comparison between the original BBT (input-level) and BBTv2 (deep prompting).

Experimental Evaluation

The researchers evaluated BBTv2 across diverse benchmarks:

  • English Tasks: SST-2, Yelp P., AG’s News, DBPedia, SNLI, RTE, and MRPC.
  • Chinese Tasks: ChnSent and LCQMC.
  • Backbones: RoBERTa, BERT, GPT-2, BART, T5, and the 11B parameter CPM-2.

Key Results and Insights

BBTv2 demonstrates that input-level prompts are often too shallow for complex reasoning. By injecting prompts at every layer, the black-box optimizer gains sufficient control to steer the model effectively.

  • Performance Parity: On RoBERTa-large, BBTv2 achieved an average score of 79.01 across seven tasks, nearly matching full model tuning (78.88) and outperforming gradient-based methods like Adapters (76.31) and BitFit (74.76).
  • Parameter Efficiency: These results were achieved with only 12K tunable parameters, a fraction of the 355M required for full fine-tuning.
  • Scalability: On the 11B parameter CPM-2 model, BBTv2 outperformed full model tuning on Chinese sentiment and question-matching tasks.
  • Versatility: BBTv2 successfully handled "hard" tasks like SNLI (57.27%), where the original BBT failed (46.58%).
Average performance vs. tunable parameters, highlighting BBTv2's efficiency compared to other methods.

Limitations and Future Work

While highly effective in few-shot settings (e.g., 16 examples per class), BBTv2's derivative-free optimizer currently struggles with the noise inherent in large-scale datasets. Additionally, the method requires approximately 8,000 API calls to converge and introduces new hyperparameters for layer-wise scaling. Future research will focus on derivative-free optimizers capable of handling noisier objective functions to extend BBTv2 to full-data scenarios.

Summary updated

BibTeX
@misc{sun2022bbtv,
  author = {Tianxiang Sun and Zhengfu He and Hong Qian and Xuanjing Huang and Xipeng Qiu},
  title = {{BBTv2: Pure Black-Box Optimization Can Be Comparable to Gradient Descent for Few-Shot Learning}},
  year = {2022},
  url = {https://openreview.net/forum?id=sg3GKaLm0I},
}
Figure