ExpertPrompting: Instructing Large Language Models to be Distinguished Experts

Benfeng Xu, An Yang, Junyang Lin, Quan Wang, Chang Zhou, Yongdong Zhang, Zhendong Mao

TL;DR

ExpertPrompting is an automated prompting strategy that uses in-context learning to synthesize detailed, customized expert personas for any given instruction, significantly boosting the quality of LLM responses. By training a LLaMA-7B model on data generated with this method, the authors created ExpertLLaMA, an open-source assistant that outperforms existing open-source models and achieves 96% of ChatGPT's capability.

What Problem Does This Paper Address?

While instruction-aligned Large Language Models (LLMs) are incredibly powerful, the quality of their responses is highly sensitive to how a prompt is written. A simple instruction might yield a generic, unhelpful answer, whereas a carefully crafted prompt can unlock a comprehensive, high-quality response.

Existing methods to improve outputs—like Chain-of-Thought or reflection loops—are often complex and tailored only to reasoning-heavy tasks. On the other hand, manually curated prompt libraries are rigid and don't scale well across diverse domains. The authors address this gap by asking: How can we automatically and dynamically scale high-quality, domain-specific prompts for any generalized instruction?

Methods

The authors introduce ExpertPrompting, a simple, two-step augmented prompting framework that requires no complex iterative reasoning loops:

  1. Expert Identity Generation: For any incoming instruction, the system uses In-Context Learning (ICL) with a few manual exemplars ($k=3$) to automatically generate a detailed, tailored description of an expert persona best suited to answer that specific prompt.
  2. Expert Answer Generation: The generated expert identity is prepended to the original instruction, and the LLM (in this case, gpt-3.5-turbo) is asked to answer conditioned on this expert background.
Figure 1: ExpertPrompting framework.

During generation, LLMs occasionally include conversational filler like "As a physicist specializing in...". The authors implement a simple post-processing step to recognize and remove these patterns, keeping only the direct answer.

Using this strategy, they augmented the 52k Alpaca instruction dataset and used the resulting high-quality answers to fine-tune an open-source LLaMA-7B base model, creating ExpertLLaMA.

Datasets

  • Training Data: The authors utilized the popular 52k Alpaca dataset, a diverse collection of instructions originally generated via Self-Instruct. They replaced the vanilla answers with their newly generated ExpertPrompting answers.
  • Evaluation Data:
  • A random sample of 500 instances from the 52k dataset was used for direct data-quality head-to-head comparisons.
  • Vicuna80: An unseen test set synthesized by GPT-4 containing 80 questions across various categories (math, coding, roleplay, counterfactual, common-sense) to evaluate overall chat assistant capabilities.

Key Insights and Ideas

  • Latent Expertise Elicitation: LLMs inherently possess deep, domain-specific knowledge that remains untapped when given standard instructions. Providing a rich, detailed persona description acts as a key to unlock this latent capability.
  • Implicit Thoroughness: Without explicitly asking the model to write a longer response or setting word limits, ExpertPrompting naturally led to more comprehensive answers. The average answer length increased from ~108 words (vanilla) to ~138 words (expert).
  • Data Quality > Model Size: Fine-tuning a smaller, open-source model (LLaMA-7B) on high-quality, expert-prompted data allows it to outperform larger models (like LLaMA-13B variants) trained on standard instruction datasets.

Key Results

The authors evaluated both the raw data quality and the final trained model using a GPT-4-based automatic evaluation metric:

  • Data Quality Win Rate: In a direct comparison of 500 instructions, GPT-4 preferred the ExpertPrompting answers 48.5% of the time, compared to a 23.0% preference for vanilla answers.
Figure 3: Comparison of answer quality (ExpertPrompt- ing VS Vanilla Prompting). Evaluated by GPT4.
  • Model Performance: On the Vicuna80 benchmark, ExpertLLaMA (7B) achieved 96% of the capability of the original ChatGPT. It comfortably beat other open-source competitors, including Vicuna-13B (94%) and LLaMA-GPT4-7B (92%), despite the latter being trained on data from the more powerful GPT-4 model.
Figure 4: Comparison of popular chat assistants. Scores are aligned to ChatGPT as 100%.

Limitations and Future Work

  • Evaluation Dependency: The claim that ExpertLLaMA achieves 96% of ChatGPT's performance relies heavily on GPT-4 automatic evaluation, which the authors acknowledge requires more rigorous, absolute validation.
  • Data Scale: The model was only trained on the 52k Alpaca dataset. The authors note that expanding the scale and diversity of the instruction set beyond 52k is a primary direction for future work to further improve ExpertLLaMA.
  • Persona Artifacts: The reliance on heuristic post-processing to remove persona-prefix text (e.g., "As an expert...") suggests that the model sometimes struggles to cleanly separate its adopted identity from the actual answer body.

Summary updated

BibTeX
@misc{xu2023expertprompting,
  author = {Benfeng Xu and An Yang and Junyang Lin and Quan Wang and Chang Zhou and Yongdong Zhang and Zhendong Mao},
  title = {{ExpertPrompting: Instructing Large Language Models to be Distinguished Experts}},
  year = {2023},
  eprint = {2305.14688},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2305.14688},
}
Figure