Skip to main content
QUICK REVIEW

[论文解读] Efficient Prompting via Dynamic In-Context Learning

Wangchunshu Zhou, Yuchen Eleanor Jiang|arXiv (Cornell University)|May 18, 2023
Machine Learning and Data ClassificationComputer Science被引用 3
一句话总结

本文提出 DynaICL,一种动态上下文学习框架,通过使用元控制器预测特定任务的上下文示例数量,优化了黑箱通用模型的提示工程效率。通过根据输入复杂度和计算预算动态分配演示样本,DynaICL 在多种任务和未见模型上将标记使用量减少高达 46%,同时改善了性能与效率之间的权衡。

ABSTRACT

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.

研究动机与目标

  • 为解决在模型参数不可访问的情况下,固定上下文学习在提示通用模型时的计算低效问题。
  • 通过根据复杂度和预算动态调整每个输入的上下文示例数量,改善提示中的性能-效率权衡。
  • 开发一个元控制器,使其在无需访问模型参数的情况下,能够泛化至未见模型和任务。
  • 在计算资源或性能目标受限的实际场景中,实现高效的提示工程。

提出的方法

  • 使用较小的预训练模型(如 FLAN-T5)在 FLAN 数据集的子集上训练元控制器,以预测每个输入的最优上下文示例数量。
  • 采用两阶段训练框架,结合监督学习与一种新颖的数据合成算法,以及强化学习与性能-效率权衡奖励。
  • 在推理阶段,根据元控制器的预测结果和全局标记/计算预算,动态分配每个输入的上下文示例。
  • 对预测的示例数量在不同输入间进行归一化和调整,以确保总标记使用量保持在给定预算范围内。
  • 将该框架应用于类似 ChatGPT 的大语言模型,利用元控制器指导提示构建,而无需修改通用模型。
  • 通过利用其在主干模型和任务间的泛化能力,将元控制器泛化至未见模型和任务。

实验结果

研究问题

  • RQ1动态分配上下文示例能否改善提示黑箱通用模型时的性能-效率权衡?
  • RQ2在一种模型和任务上训练的元控制器,其在未见模型和任务上的泛化能力如何?
  • RQ3动态示例分配在保持或提升性能的同时,能在多大程度上减少标记消耗?
  • RQ4当为简单输入使用过多示例时,上下文学习的性能是否会下降?
  • RQ5在分类任务上训练的元控制器,能否有效指导生成任务的示例分配?

主要发现

  • 与对所有输入采用均匀的上下文示例分配相比,DynaICL 将标记预算减少了高达 46%。
  • 在计算预算受限的情况下,该框架在平均绝对性能上实现了 2.6% 的提升。
  • 元控制器能有效泛化至未见模型和任务,即使仅在分类数据集上进行训练。
  • 动态分配可防止因使用固定且过多的示例而导致简单输入性能下降。
  • 在 FLAN-T5 上训练的元控制器可泛化至其他大语言模型,包括训练期间未见过的模型。
  • 该方法在计算资源受限和性能受限的场景中均表现出有效性。

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。