Auto-Instruct: Automatic Instruction Generation and Ranking for Black-Box Language Models

Zhihan Zhang, Shuohang Wang, Wenhao Yu, Yichong Xu, Dan Iter, Qingkai Zeng, Yang Liu, Chenguang Zhu, Meng Jiang

Introduction

The performance of black-box large language models (LLMs), such as GPT-4, is highly sensitive to the specific phrasing of instructions. While prompt engineering has emerged as a common practice, it remains a laborious and subjective trial-and-error process. Existing automated methods often require access to internal gradients (parametric optimization) or extensive validation datasets, which are typically unavailable in "true few-shot" scenarios where only a handful of examples are provided.

Auto-Instruct addresses these challenges by introducing a novel "generate-then-rank" framework. It automatically generates diverse candidate instructions and employs a trained scoring model to select the optimal prompt for a given task, significantly boosting LLM performance on unseen tasks without requiring task-specific tuning or additional validation data.

The Auto-Instruct Framework

The Auto-Instruct pipeline consists of three primary phases: Instruction Generation, Instruction Ranking, and Downstream Inference.

Overview of the Auto-Instruct pipeline, illustrating the generation, ranking, and inference stages.
  1. Instruction Generation: To ensure a broad candidate pool, the framework utilizes various meta-prompts to generate 22 diverse instruction styles per task. These styles include one-sentence summaries, detailed paragraphs, step-by-step guides, and instructions that explain provided examples.
  2. Instruction Ranking: This core component uses a scoring model based on FLAN-T5-Large. The ranker is trained on 575 tasks from the Super Natural Instructions (SuperNI) dataset. It learns to predict the performance of candidate instructions by minimizing the KL-divergence between predicted scores and actual performance distributions (list-wise loss).
  3. Downstream Inference: For a new test example, the ranker selects the top-rated instruction from the candidate pool. This instruction is concatenated with the input and sent to the LLM for final inference.

Experimental Setup

The framework was evaluated using the following datasets:

  • Training: 575 tasks from Super Natural Instructions (SuperNI), covering a vast range of NLP applications.
  • Evaluation (Out-of-Domain): 91 tasks from SuperNI (with no category overlap with the training set) and 27 tasks from Big Bench Hard (BBH), representing complex reasoning and logic problems.
  • Models: OpenAI’s text-davinci-003 served as the primary LLM for generation and inference, with additional experiments on ChatGPT, GPT-4, and LLaMA-2-7B.

Results and Analysis

Auto-Instruct demonstrates significant improvements over both human-written instructions and existing automated baselines. The system quantifies the "instability" of prompts, finding a median standard deviation of 3.1 to 4.2 points in ROUGE-L across different instructions for the same task.

Comparison of Auto-Instruct against various baselines across SuperNI and BBH datasets in few-shot and zero-shot settings.

Key findings include:

  • Superior Performance: On the SuperNI benchmark, Auto-Instruct achieved a 64.35 ROUGE-L score, significantly higher than human-written seed instructions (60.94) and the previous state-of-the-art, iPrompt (57.08).
  • Zero-Shot Success: The framework improved performance by approximately 3% over human instructions in zero-shot settings, proving the ranker's effectiveness even without few-shot examples.
  • Cross-Model Generalization: A ranker trained on data from one model (e.g., text-davinci-003) remains effective for entirely different models like GPT-4 or LLaMA-2, suggesting universal patterns in what makes an instruction "understandable" to LLMs.
  • Granular Optimization: Unlike static methods, Auto-Instruct can select different instructions for different examples within the same task, providing a more granular level of optimization.

Conclusion and Future Work

Auto-Instruct provides a robust solution for automating prompt engineering for black-box LLMs. While currently limited to English and involving non-trivial API costs for generation, it highlights the potential of dedicated ranking models in instruction induction. Future research may explore multi-lingual support, cost-reduction strategies, and deeper integration with chain-of-thought reasoning.

Summary updated

BibTeX
@inproceedings{zhang2023auto,
  author = {Zhihan Zhang and Shuohang Wang and Wenhao Yu and Yichong Xu and Dan Iter and Qingkai Zeng and Yang Liu and Chenguang Zhu and Meng Jiang},
  title = {{Auto-Instruct: Automatic Instruction Generation and Ranking for Black-Box Language Models}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  doi = {10.18653/v1/2023.findings-emnlp.659},
}
Figure