BatchPrompt:用更少成本完成更多任务
BatchPrompt: Accomplish more with less
AI总结:
针对大模型单样本提示效率低、批量提示性能下降的问题,提出BPE批量排列集成与SEAS自反思早停技术,在多个NLP任务上以极少的调用和token成本达到甚至超过单样本提示性能。
摘要:
随着大语言模型(LLM)的token限制不断提升,长上下文输入成为可能,单数据样本提示可能不再是高效的方式。一种提升效率的直接策略是在token限制范围内(例如gpt-3.5-turbo为8k;GPT-4为32k)对数据进行批处理,我们将其称为BatchPrompt。针对批处理数据的提示,我们有两项初步观察结果:第一,我们发现与单数据提示相比,在更长上下文中使用批处理数据进行提示不可避免地会导致性能下降。第二,由于解码器上下文的相应变化,语言模型的性能与批处理数据的位置和顺序显著相关。为了兼顾效率并克服性能损失,我们提出了批量排列与集成(Batch Permutation and Ensembling, BPE)方法,以及一种新颖的自反思引导早停(Self-reflection-guided EArly Stopping, SEAS)技术。我们的综合实验评估表明,BPE能在一系列主流NLP任务上大幅提升BatchPrompt的性能,包括问答任务(Boolq)、文本蕴含任务(RTE)和重复问题识别任务(QQP)。这些性能甚至与单数据提示(SinglePrompt)相当或更优,同时BatchPrompt所需的LLM调用次数和输入token数要少得多(SinglePrompt与批量大小为32的BatchPrompt相比:后者仅使用前者9%-16%的LLM调用次数;Boolq准确率从90.6%提升至90.9%,token用量为前者的27.4%;QQP准确率从87.2%提升至88.4%,token用量为前者的18.6%;RTE准确率从91.5%变为91.1%,token用量为前者的30.8%)。据我们所知,这是首个从技术层面提升大语言模型提示效率的工作。我们希望这种简单却有效的方法能为大语言模型的未来研究提供启发。代码将公开发布。
英文摘要:
As the ever-increasing token limits of large language models (LLMs) have enabled long context as input, prompting with single data samples might no longer an efficient way. A straightforward strategy improving efficiency is to batch data within the token limit (e.g., 8k for gpt-3.5-turbo; 32k for GPT-4), which we call BatchPrompt. We have two initial observations for prompting with batched data. First, we find that prompting with batched data in longer contexts will inevitably lead to worse performance, compared to single-data prompting. Second, the performance of the language model is significantly correlated with the positions and order of the batched data, due to the corresponding change in decoder context. To retain efficiency and overcome performance loss, we propose Batch Permutation and Ensembling (BPE), and a novel Self-reflection-guided EArly Stopping (SEAS) technique. Our comprehensive experimental evaluation demonstrates that BPE can boost the performance of BatchPrompt with a striking margin on a range of popular NLP tasks, including question answering (Boolq), textual entailment (RTE), and duplicate questions identification (QQP). These performances are even competitive with/higher than single-data prompting(SinglePrompt), while BatchPrompt requires much fewer LLM calls and input tokens (For SinglePrompt v.s. BatchPrompt with batch size 32, using just 9%-16% the number of LLM calls, Boolq accuracy 90.6% to 90.9% with 27.4% tokens, QQP accuracy 87.2% to 88.4% with 18.6% tokens, RTE accuracy 91.5% to 91.1% with 30.8% tokens). To the best of our knowledge, this is the first work to technically improve prompting efficiency of large language models. We hope our simple yet effective approach will shed light on the future research of large language models. The code will be released.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。