A prompt is a sequence of symbol or tokens, selected from a vocabulary according to some rule, which is prepended/concatenated to a textual query. A key problem is how to select the sequence of tokens: in this paper we formulate it as a combinatorial optimization problem. The high dimensionality of the token space com-pounded by the length of the prompt sequence requires a very efficient solution. In this paper we propose a Bayesian optimization method, executed in a continuous em-bedding of the combinatorial space. In this paper we focus on hard prompt tuning (HPT) which directly searches for discrete tokens to be added to the text input with-out requiring access to the large language model (LLM) and can be used also when LLM is available only as a black-box. This is critically important if LLMs are made available in the Model as a Service (MaaS) manner as in GPT-4. The current manu-script is focused on the optimization of discrete prompts for classification tasks. The discrete prompts give rise to difficult combinatorial optimization problem which easily become intractable given the dimension of the token space in realistic applications. The optimization method considered in this paper is Bayesian optimization (BO) which has become the dominant approach in black-box optimization for its sample efficiency along with its modular structure and versatility. In this paper we use BoTorch, a library for Bayesian optimization research built on top of pyTorch. Albeit preliminary and obtained using a 'vanilla' version of BO, the experiments on RoB-ERTa on six benchmarks, show a good performance across a variety of tasks and enable an analysis of the tradeoff between size of the search space, accuracy and wall clock time.
翻译:提示(prompt)是根据特定规则从词汇表中选择的符号或令牌序列,它被前置或拼接至文本查询之前。如何选择令牌序列是一个关键问题:本文将其形式化为组合优化问题。令牌空间的高维性以及提示序列的长度需要非常高效的解决方案。本文提出了一种在组合空间连续嵌入中执行的贝叶斯优化方法。我们专注于硬提示调优(HPT),该方法直接搜索可添加到文本输入中的离散令牌,无需访问大型语言模型(LLM),且在LLM仅作为黑盒可用时也能使用。当LLM以GPT-4的模型即服务(MaaS)方式提供时,这一点至关重要。当前手稿专注于优化用于分类任务的离散提示。离散提示会引发棘手的组合优化问题,在现实应用中由于令牌空间的维度而极易变得难以处理。本文考虑的优化方法是贝叶斯优化(BO),该方法因其样本效率、模块化结构和多功能性而成为黑盒优化的主流方法。我们使用BoTorch——一个基于pyTorch的贝叶斯优化研究库。尽管实验基于"原始"版本的BO且结果初步,但在六个基准上的RoBERTa实验表明,该方法在各类任务中表现良好,并能分析搜索空间规模、准确性和实际运行时间之间的权衡。