AutoHint: Automatic Prompt Optimization with Hint Generation

Hong Sun, Xue Li, Yinchuan Xu, Youkow Homma, Qi Cao, Min Wu, Jian Jiao, Denis CharlesarXiv 2023 · DOI

Abstract

Prompt engineering is a critical but often manual and trial-and-error process in the deployment of Large Language Models (LLMs). While zero-shot prompts offer generalizability and few-shot prompts provide specific examples, both have limitations in capturing the nuanced reasoning required for complex tasks. This paper introduces AutoHint, a framework that automates prompt optimization by analyzing model failures, deducing semantic "hints" from these errors, and synthesizing them into enriched instructions. Our results show significant performance gains across diverse reasoning tasks, demonstrating that learned instructions can outperform or complement traditional few-shot examples.

Introduction

LLMs are highly sensitive to prompt design. Current paradigms rely on either broad instructions (zero-shot) or specific input-output pairs (few-shot). However, few-shot prompting is sensitive to example selection and ordering, and zero-shot prompts often lack the task-specific detail necessary for high accuracy. AutoHint bridges this gap by automatically extracting the "reasoning" behind correct outputs for samples where the model initially fails, effectively learning from mistakes to refine the task description.

Methodology

AutoHint follows a "residual-sampling-summarize" paradigm, analogous to Stochastic Gradient Descent (SGD) in neural network training. Instead of updating weights, AutoHint updates the natural language prompt based on "gradients" in the form of semantic hints.

The process consists of four stages:

  1. Inference & Error Identification: The initial prompt is run on a training set to identify "residual data"—samples where the model's prediction is incorrect.
  2. Hint Deduction: For each error, the LLM is prompted to deduce a "hint" explaining why the expected output is correct. This transforms raw data into interpretable reasoning.
  3. Strategic Sampling: To stay within context limits, a subset of hints is selected. Strategies include random selection, random-balanced (ensuring label diversity), and clustering (using BERT embeddings and K-Means to find representative error types).
  4. Summarization: The selected hints are synthesized into a concise, general instruction that is appended to the original prompt.
Comparison of a standard prompt and an AutoHint-enhanced prompt for an epistemic reasoning task.
The structural templates used for standard inference (a) and the hint inference process (b).

Experimental Setup

The framework was evaluated on the BIG-Bench Instruction Induction (BBII) dataset across six tasks: Epistemic Reasoning, Logical Fallacy Detection, Implicatures, Hyperbaton, Causal Judgment, and Winowhy.

Results and Discussion

AutoHint achieved substantial improvements in zero-shot accuracy. For instance, in the Hyperbaton task (ordering adjectives), accuracy increased from 66.8% to 82.4%. In Epistemic Reasoning, it rose from 82.5% to 90.5%.

Key findings include:

  • Instructions > Examples: Derived instructions often provide more robust guidance than raw examples.
  • Synergy with Few-Shot: AutoHint is orthogonal to few-shot prompting; adding generated hints to few-shot prompts provides an additional performance boost.
  • Efficiency: Optimal results were often reached with as few as 3 samples per label. Excessive hints can lead to "accuracy decay" as the prompt becomes overly complex for the LLM to assimilate.

Conclusion

AutoHint represents a significant step toward automated, interpretable prompt engineering. By focusing on failure modes and translating them into natural language instructions, it provides a scalable way to improve LLM performance. Future work will focus on more sophisticated hint integration methods and mitigating the complexity issues associated with iterative optimization.

Summary updated

BibTeX
@misc{sun2023autohint,
  author = {Hong Sun and Xue Li and Yinchuan Xu and Youkow Homma and Qi Cao and Min Wu and Jian Jiao and Denis Charles},
  title = {{AutoHint: Automatic Prompt Optimization with Hint Generation}},
  year = {2023},
  eprint = {2307.07415},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2307.07415},
}
Figure