设计有效的提示对于引导大语言模型(LLM)生成期望响应至关重要。自动化提示工程旨在通过简化自然语言提示的设计、改进与优化,减少对人工工作的依赖。本文提出一种用于自动化提示工程的最优学习框架,旨在序贯识别有效的提示特征,同时高效分配有限的评估预算。我们引入一种基于特征的提示表示方法,显著扩展了搜索空间。该框架采用贝叶斯回归利用相似提示之间的相关性,从而加速学习过程。为在庞大的提示特征空间中高效探索以获得高质量提示,我们采用前瞻性的 Knowledge-Gradient(KG,知识梯度)策略进行序贯最优学习。KG 策略通过求解混合整数二阶锥优化问题得到高效计算,因此具备可扩展性,并能够处理仅通过约束刻画的提示。实验在指令归纳任务上评估表明,我们的方法显著优于一系列基准策略。结果凸显了在评估预算有限时,使用 KG 策略进行提示学习的优势。本框架为在提示评估成本高昂的更广泛应用中部署自动化提示工程提供了解决方案。
英文摘要:
Designing effective prompts is essential to guiding large language models (LLMs) toward desired responses. Automated prompt engineering aims to reduce reliance on manual effort by streamlining the design, refinement, and optimization of natural language prompts. This paper proposes an optimal learning framework for automated prompt engineering, designed to sequentially identify effective prompt features while efficiently allocating a limited evaluation budget. We introduce a feature-based method to express prompts, which significantly broadens the search space. Bayesian regression is employed to utilize correlations among similar prompts, accelerating the learning process. To efficiently explore the large space of prompt features for a high quality prompt, we adopt the forward-looking Knowledge-Gradient (KG) policy for sequential optimal learning. The KG policy is computed efficiently by solving mixed-integer second-order cone optimization problems, making it scalable and capable of accommodating prompts characterized only through constraints. We demonstrate that our method significantly outperforms a set of benchmark strategies assessed on instruction induction tasks. The results highlight the advantages of using the KG policy for prompt learning given a limited evaluation budget. Our framework provides a solution to deploying automated prompt engineering in a wider range applications where prompt evaluation is costly.
Using LLMs for Automated Privacy Policy Analysis: Prompt Engineering, Fine-Tuning and Explainability
School of Cyber Science and Engineering, Shanghai Jiao Tong University(上海交通大学网络安全科学与工程学院);Institute of Cyber Security for Society (iCSS), University of Kent(肯特大学社会网络安全研究所)
Evaluating LLMs on Sequential API Call Through Automated Test Generation
The University of Tokyo(东京大学);Macau University of Science and Technology(澳门科技大学);Shandong University(山东大学);Hong Kong University of Science and Technology(香港科技大学);Institute of Software, Chinese Academy of Sciences(中国科学院软件研究所);University of Alberta(阿尔伯塔大学)