Use Your INSTINCT: INSTruction optimization for LLMs usIng Neural bandits Coupled with Transformers

Xiaoqiang Lin, Zhaoxuan Wu, Zhongxiang Dai, Wenyang Hu, Yao Shu, See-Kiong Ng, Patrick Jaillet, Bryan Kian Hsiang LowICML 2024

TL;DR

INSTINCT is a novel framework that automates the "black art" of prompt engineering for Large Language Models (LLMs). By treating instruction optimization as a neural bandit problem and leveraging the internal hidden representations of open-source models, it consistently finds better instructions for black-box models like ChatGPT than previous state-of-the-art methods.

What Problem Does This Paper Address?

Large Language Models (LLMs) are incredibly sensitive to the instructions (prompts) they receive. A slight change in wording can lead to a massive swing in performance. Currently, finding the "perfect" prompt usually involves tedious, manual trial-and-error.

While researchers have tried to automate this using Bayesian Optimization (BO), they hit a wall: standard BO uses Gaussian Processes (GPs) as a "surrogate" to guess how a new prompt might perform. Unfortunately, GPs struggle with the high-dimensional, non-linear complexity of human language. They lack the "expressive power" to understand why one sentence works better than another. Furthermore, many existing methods are "local," meaning they tweak a good prompt but fail to explore the broader space of possible instructions effectively.

Methods

The authors propose INSTINCT (INSTruction optimization usIng Neural bandits Coupled with Transformers). The core idea is to replace the simple GP surrogate with a powerful Neural Network (NN) and "couple" it with the internal knowledge of a white-box LLM.

The INSTINCT algorithm workflow: (1) Train an MLP on history, (2) Select the next soft prompt using NeuralUCB, (3) Generate a discrete instruction via a white-box LLM, (4) Evaluate on a black-box LLM, (5) Calculate the score, and (6) Extract hidden representations to update the history.

The process works in a continuous loop:

  1. Neural Surrogate: Instead of a GP, INSTINCT uses a Multi-Layer Perceptron (MLP) to predict prompt performance.
  2. Transformer Coupling: Crucially, the MLP doesn't just look at the prompt text. It takes the hidden representations (the internal vector state) from a "white-box" model (like Vicuna-13B) as input. This allows the optimizer to work in a semantically meaningful space.
  3. NeuralUCB: It uses a principled "Upper Confidence Bound" (UCB) strategy to balance exploitation (trying prompts predicted to be good) and exploration (trying uncertain prompts to learn more about the space).
  4. Soft-to-Hard Prompting: It optimizes "soft prompts" (continuous vectors), which the white-box model then translates into human-readable "hard" instructions for the black-box model (e.g., ChatGPT).

Datasets

The researchers evaluated INSTINCT across a wide range of challenging benchmarks:

  • Instruction Induction: 30 diverse datasets (e.g., antonyms, cause and effect, word sorting) where the goal is to find a prompt that describes a task given input-output examples.
  • Arithmetic Reasoning: GSM8K, AQUARAT, and SVAMP, specifically focusing on improving zero-shot Chain-of-Thought (CoT) prompts.
  • Text Summarization: The SAMSum dataset.

Key Insights and Ideas

  • Hidden Representations are the "Secret Sauce": The authors found that standard distance metrics (like L2 distance between prompt vectors) are poor indicators of performance because very different vectors can result in the same instruction. However, the hidden representations from a transformer naturally group semantically similar prompts together. This makes the optimization "map" much smoother and easier to navigate.
  • Expressivity Wins: Neural networks are simply better than Gaussian Processes at modeling the "rugged" landscape of how instructions affect LLM accuracy.
  • Principled Exploration Matters: Unlike heuristic search methods that might get stuck in a local "good enough" spot, the bandit-based UCB approach systematically explores the entire domain of possible instructions. This is particularly effective in early iterations, allowing the model to achieve high accuracy much faster.

Key Results

INSTINCT consistently outperformed major baselines like APE, InstructZero, and EvoPrompt.

The performance profile curve shows that INSTINCT (purple) consistently stays above other methods, meaning it reaches higher performance levels across more tasks.
  • Better Ranks: In instruction induction, INSTINCT achieved the highest accuracy in 11 out of 20 challenging tasks and maintained the best average rank (2.1) across all methods.
  • Superior CoT: For arithmetic reasoning, it discovered zero-shot CoT prompts that beat the famous "Let's think step by step." For example, on the SVAMP dataset, it reached 0.81 accuracy, significantly higher than the standard prompt's 0.7625.
  • Efficiency: By pre-computing hidden representations, the authors achieved a 2.6x to 3.5x speedup in wall-clock time compared to naive implementations.

Limitations and Future Work

While powerful, INSTINCT has a few constraints:

  • Numeric Scoring: It requires a clear numeric score (like accuracy or ROUGE) to optimize, which might be hard to define for open-ended creative writing.
  • Validation Set: Like most optimization methods, it needs a representative validation set to guide the search.
  • Future Directions: The authors suggest exploring multi-objective optimization—for instance, maximizing performance while simultaneously minimizing the "harmfulness" or bias of the generated instructions. They also see potential in combining INSTINCT with ChatGPT-based rephrasing to further polish the final instructions.

Summary updated

BibTeX
@inproceedings{lin2024use,
  author = {Xiaoqiang Lin and Zhaoxuan Wu and Zhongxiang Dai and Wenyang Hu and Yao Shu and See-Kiong Ng and Patrick Jaillet and Bryan Kian Hsiang Low},
  title = {{Use Your INSTINCT: INSTruction optimization for LLMs usIng Neural bandits Coupled with Transformers}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=RLENZ8pNnn},
}
Figure