Efficient Prompting via Dynamic In-Context Learning

05/18/2023
by   Wangchunshu Zhou, et al.
0

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 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.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
06/10/2020

MC-BERT: Efficient Language Pre-Training via a Meta Controller

Pre-trained contextual representations (e.g., BERT) have become the foun...
research
04/03/2022

DST: Dynamic Substitute Training for Data-free Black-box Attack

With the wide applications of deep neural network models in various comp...
research
05/22/2023

Iterative Forward Tuning Boosts In-context Learning in Language Models

Large language models (LLMs) have exhibited an emergent in-context learn...
research
07/05/2023

Scaling In-Context Demonstrations with Structured Attention

The recent surge of large language models (LLMs) highlights their abilit...
research
09/19/2023

In-Context Learning for Text Classification with Many Labels

In-context learning (ICL) using large language models for tasks with man...
research
12/03/2022

What is Not in the Context? Evaluation of Few-shot Learners with Informative Demonstrations

Large language models demonstrate an emergent ability to learn a new tas...
research
02/16/2023

Learning a Meta-Controller for Dynamic Grasping

Grasping moving objects is a challenging task that combines multiple sub...

Please sign up or login with your details

Forgot password? Click here to reset