arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2305.11170cs.CLcs.AIcs.LG
收藏

通过动态上下文学习实现高效提示

Efficient Prompting via Dynamic In-Context Learning

ETH Zürich(苏黎世联邦理工学院)

Wangchunshu Zhou, Yuchen Eleanor Jiang, Ryan Cotterell, Mrinmaya Sachan

AI总结:

提出DynaICL方案,通过训练元控制器根据输入复杂度和计算预算动态分配上下文示例数量,在保持性能的同时节省高达46%的token预算,并能泛化到未见模型与任务。

摘要:

构建AI应用的主要方式正从训练专用模型转向提示通用模型。提示通用模型的一种常见做法(通常被称为上下文学习)是在提示中附加几个示例(演示),以帮助模型更好地理解任务。虽然有效,但上下文学习可能效率低下,因为它会使输入提示变得长得多,消耗上下文窗口中的宝贵空间并导致更大的计算成本。在本文中,我们提出了DynaICL,这是一种使用黑盒通用模型进行高效提示的方案,它根据输入复杂度和计算预算动态分配上下文示例。为了实现这一点,我们训练了一个元控制器,它基于特定输入的性能-效率权衡,预测适合通用模型进行良好预测的上下文示例数量。然后,我们根据元控制器的预测和给定的计算预算,动态分配输入的演示数量。实验结果表明,在计算资源或所需性能受限的两种实际设置中,动态示例分配有助于实现更好的性能-效率权衡。具体而言,与为每个输入分配相同数量上下文示例的常见做法相比,DynaICL节省了高达46%的token预算。我们还发现,在特定骨干模型和任务上训练的元控制器可以成功泛化到未见过的模型和任务。

英文摘要:

The primary way of building AI applications is shifting from training specialist models to prompting generalist models. A common practice for prompting generalist models, often referred to as in-context learning, is to append a few examples (demonstrations) to the prompt to help the model better understand the task. While effective, in-context learning can be inefficient because it makes the input prompt much longer, consuming valuable space in the context window and leading to larger computational costs. In this paper, we propose DynaICL, a recipe for efficient prompting with black-box generalist models that dynamically allocate in-context examples according to the input complexity and the computational budget. To achieve this, we train a meta controller that predicts the number of in-context examples suitable for the generalist model to make a good prediction based on the performance-efficiency trade-off for a specific input. We then dynamically allocate the number of demonstrations for an input according to predictions from the meta controller and the given computation budget. Experimental results show that dynamic example allocation helps achieve a better performance-efficiency trade-off in two practical settings where computational resources or the required performance is constrained. Specifically, DynaICL saves up to 46% token budget compared to the common practice that allocates the same number of in-context examples to each input. We also find that a meta controller trained on a certain backbone model and tasks can successfully generalize to unseen models and tasks.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑