[Paper Review] Efficient Prompting via Dynamic In-Context Learning
This paper proposes DynaICL, a dynamic in-context learning framework that optimizes prompting efficiency for black-box generalist models by using a meta controller to predict task-specific in-context example counts. By dynamically allocating demonstrations based on input complexity and computational budget, DynaICL reduces token usage by up to 46% while improving performance-efficiency trade-offs across diverse tasks and unseen models.
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.
Motivation & Objective
- To address the computational inefficiency of fixed in-context learning in prompting generalist models, especially when model parameters are inaccessible.
- To improve the performance-efficiency trade-off in prompting by adapting the number of in-context examples per input based on complexity and budget.
- To develop a meta controller that generalizes across unseen models and tasks without requiring access to model parameters.
- To enable efficient prompting in real-world scenarios where computational resources or performance targets are constrained.
Proposed method
- Train a meta controller using a smaller pre-trained model (e.g., FLAN-T5) on a subset of FLAN datasets to predict optimal in-context example counts for each input.
- Use a two-stage training framework combining supervised learning with a novel data synthesis algorithm and reinforcement learning with performance-efficiency trade-off rewards.
- At inference, dynamically allocate in-context examples per input based on meta controller predictions and a global token/computation budget.
- Normalize and adjust the predicted example counts across inputs to ensure the total token usage stays within the given budget.
- Apply the framework to LLMs like ChatGPT, using the meta controller to guide prompt construction without modifying the generalist model.
- Generalize the meta controller to unseen models and tasks by leveraging its ability to generalize across backbone models and tasks.
Experimental results
Research questions
- RQ1Can dynamic allocation of in-context examples improve the performance-efficiency trade-off in prompting black-box generalist models?
- RQ2How well can a meta controller trained on one model and task generalize to unseen models and tasks?
- RQ3To what extent can dynamic example allocation reduce token consumption while maintaining or improving performance?
- RQ4Does the performance of in-context learning degrade when too many examples are used for simple inputs?
- RQ5Can a meta controller trained on classification tasks effectively guide example allocation for generative tasks?
Key findings
- DynaICL reduces the token budget by up to 46% compared to uniform in-context example allocation across all inputs.
- The framework achieves an averaged absolute performance improvement of 2.6% within a constrained computational budget.
- The meta controller generalizes effectively to unseen models and tasks, even when trained only on classification datasets.
- Dynamic allocation prevents performance degradation on simple inputs that occurs when fixed, excessive examples are used.
- The meta controller trained on FLAN-T5 generalizes to other LLMs, including those not seen during training.
- The approach is effective in both computational resource-constrained and performance-constrained settings.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.