Efficient Prompting via Dynamic In-Context Learning
Not on the map. Why?
Abstract (arXiv)
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.
Key facts. Cited by 18 papers in the map (data through 7 Oct 2026). Builds on 45 of its 62 references that are in the map. First posted on arXiv 18 May 2023.
Builds on
45 of 62 references.
References · 45
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2022Training language models to follow instructions with human feedbackcited by 15,712
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
- 2015Distilling the Knowledge in a Neural Networkcited by 10,076
- 2023BLIP-2: Bootstrapping Language-Image Pre-training with Frozen Image Encoders and Large Language Modelscited by 6,069
- 2019BERTScore: Evaluating Text Generation with BERTcited by 5,462
- 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,304
- 2017On Calibration of Modern Neural Networkscited by 4,860
- 2018Think you have Solved Question Answering? Try ARC, the AI2 Reasoning Challengecited by 4,710
- 2019DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lightercited by 4,243
- 2021Finetuned Language Models Are Zero-Shot Learnerscited by 3,747
33 more
- 2022OPT: Open Pre-trained Transformer Language Modelscited by 3,464
- 2017TriviaQA: A Large Scale Distantly Supervised Challenge Dataset for Reading Comprehensioncited by 2,895
- 2019PIQA: Reasoning about Physical Commonsense in Natural Languagecited by 2,818
- 2015Character-level Convolutional Networks for Text Classificationcited by 2,293
- 2015Deep Compression: Compressing Deep Neural Networks with Pruning, Trained Quantization and Huffman Codingcited by 2,291
- 2021Learning to Prompt for Vision-Language Modelscited by 2,269
- 2018Can a Suit of Armor Conduct Electricity? A New Dataset for Open Book Question Answeringcited by 2,114
- 2018CommonsenseQA: A Question Answering Challenge Targeting Commonsense Knowledgecited by 1,793
- 2022Language Models (Mostly) Know What They Knowcited by 1,783
- 2014FitNets: Hints for Thin Deep Netscited by 1,619
- 2021Multitask Prompted Training Enables Zero-Shot Task Generalizationcited by 1,462
- 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,413
- 2018Adafactor: Adaptive Learning Rates with Sublinear Memory Costcited by 896
- 2019Are Sixteen Heads Really Better than One?cited by 803
- 2023The Flan Collection: Designing Data and Methods for Effective Instruction Tuningcited by 734
- 2020It's Not Just Size That Matters: Small Language Models Are Also Few-Shot Learnerscited by 668
- 2017BranchyNet: Fast Inference via Early Exiting from Deep Neural Networkscited by 591
- 2016Adaptive Computation Time for Recurrent Neural Networkscited by 479
- 2021Dynamic Neural Networks: A Surveycited by 405
- 2023Learning to Compress Prompts with Gist Tokenscited by 379
- 2019Q-BERT: Hessian Based Ultra Low Precision Quantization of BERTcited by 355
- 2020BERT Loses Patience: Fast and Robust Inference with Early Exitcited by 267
- 2018The Natural Language Decathlon: Multitask Learning as Question Answeringcited by 235
- 2020The Right Tool for the Job: Matching Model and Instance Complexitiescited by 125
- 2022Ground-Truth Labels Matter: A Deeper Look into Input-Label Demonstrationscited by 116
- 2020BERT-of-Theseus: Compressing BERT by Progressive Module Replacingcited by 112
- 2022Structured Prompting: Scaling In-Context Learning to 1,000 Examplescited by 81
- 2021A Survey on Green Deep Learningcited by 52
- 2020CascadeBERT: Accelerating Inference of Pre-trained Language Models via Calibrated Complete Models Cascadecited by 47
- 2022Model Cascading: Towards Jointly Improving Efficiency and Accuracy of NLP Systemscited by 43
- 2022Glance and Focus Networks for Dynamic Visual Recognitioncited by 41
- 2023In-Context Learning with Many Demonstration Examplescited by 39
- 2022AdapLeR: Speeding up Inference by Adaptive Length Reductioncited by 19
Built on by
Citing papers per year: 2023: 4; 2024: 8; 2025: 6.
18 papers.
Sort:
By area:
- 2023LoraHub: Efficient Cross-Task Generalization via Dynamic LoRA Compositioncited by 359
- 2024A Survey on Efficient Inference for Large Language Modelscited by 197
- 2024Survey on Large Language Model-Enhanced Reinforcement Learning: Concept, Taxonomy, and Methodscited by 114
- 2024Efficient Prompting Methods for Large Language Models: A Surveycited by 46
- 2025A Survey of Multimodal Retrieval-Augmented Generationcited by 37
- 2025Efficient Agents: Building Effective Agents While Reducing Costcited by 32
- 2023CodeCoT: Tackling Code Syntax Errors in CoT Reasoning for Code Generationcited by 29
- 2024An LLM-Tool Compiler for Fused Parallel Function Callingcited by 14
- 2024InCoRo: In-Context Learning for Robotics Control with Feedback Loopscited by 9
- 2024Style-Compress: An LLM-Based Prompt Compression Framework Considering Task-Specific Stylescited by 9
- 2023SmartTrim: Adaptive Tokens and Attention Pruning for Efficient Vision-Language Modelscited by 7
- 2024A Survey of Transformer-based Language Models with Focus on Efficiencycited by 6
6 more
- 2023Modular Transformers: Compressing Transformers into Modularized Layers for Flexible Efficient Inferencecited by 4
- 2024Hierarchical Prompting Taxonomy: A Universal Evaluation Framework for Large Language Models Aligned with Human Cognitive Principlescited by 4
- 2025Dynamic Context-Aware Prompt Recommendation for Domain-Specific AI Applicationscited by 2
- 2025Adaptive and Resource-efficient Agentic AI Systems for Mobile and Embedded Devices: A Surveycited by 2
- 2025Reliability of Large Language Model Generated Clinical Reasoning in Assisted Reproductive Technology: Blinded Comparative Evaluation Studycited by 1
- 2025RADAR: Accelerate Large Language Model Inference With RL-Based Dynamic Draft Treescited by 0
- 2025RADAR: Accelerate Large Language Model Inference With RL-Based Dynamic Draft Trees16 Dec 2025
- 2025Reliability of Large Language Model Generated Clinical Reasoning in Assisted Reproductive Technology: Blinded Comparative Evaluation Study17 Oct 2025
- 2025Adaptive and Resource-efficient Agentic AI Systems for Mobile and Embedded Devices: A Survey30 Sep 2025
- 2025Efficient Agents: Building Effective Agents While Reducing Cost24 Jul 2025
- 2025Dynamic Context-Aware Prompt Recommendation for Domain-Specific AI Applications25 Jun 2025
- 2025A Survey of Multimodal Retrieval-Augmented Generation26 Mar 2025
- 2024Style-Compress: An LLM-Based Prompt Compression Framework Considering Task-Specific Styles17 Oct 2024
- 2024Hierarchical Prompting Taxonomy: A Universal Evaluation Framework for Large Language Models Aligned with Human Cognitive Principles18 Jun 2024
- 2024A Survey of Transformer-based Language Models with Focus on Efficiency15 May 2024
- 2024An LLM-Tool Compiler for Fused Parallel Function Calling7 May 2024
- 2024A Survey on Efficient Inference for Large Language Models22 Apr 2024
- 2024Efficient Prompting Methods for Large Language Models: A Survey1 Apr 2024
6 more
- 2024Survey on Large Language Model-Enhanced Reinforcement Learning: Concept, Taxonomy, and Methods30 Mar 2024
- 2024InCoRo: In-Context Learning for Robotics Control with Feedback Loops7 Feb 2024
- 2023CodeCoT: Tackling Code Syntax Errors in CoT Reasoning for Code Generation17 Aug 2023
- 2023LoraHub: Efficient Cross-Task Generalization via Dynamic LoRA Composition25 Jul 2023
- 2023Modular Transformers: Compressing Transformers into Modularized Layers for Flexible Efficient Inference4 Jun 2023
- 2023SmartTrim: Adaptive Tokens and Attention Pruning for Efficient Vision-Language Models24 May 2023
- 2023CodeCoT: Tackling Code Syntax Errors in CoT Reasoning for Code Generationcited by 29
- 2024An LLM-Tool Compiler for Fused Parallel Function Callingcited by 14
- 2024InCoRo: In-Context Learning for Robotics Control with Feedback Loopscited by 9
- 2025Adaptive and Resource-efficient Agentic AI Systems for Mobile and Embedded Devices: A Surveycited by 2
- 2025Reliability of Large Language Model Generated Clinical Reasoning in Assisted Reproductive Technology: Blinded Comparative Evaluation Studycited by 1
- 2025Reliability of Large Language Model Generated Clinical Reasoning in Assisted Reproductive Technology: Blinded Comparative Evaluation Study17 Oct 2025
- 2025Adaptive and Resource-efficient Agentic AI Systems for Mobile and Embedded Devices: A Survey30 Sep 2025
- 2024An LLM-Tool Compiler for Fused Parallel Function Calling7 May 2024
- 2024InCoRo: In-Context Learning for Robotics Control with Feedback Loops7 Feb 2024
- 2023CodeCoT: Tackling Code Syntax Errors in CoT Reasoning for Code Generation17 Aug 2023
- 2025A Survey of Multimodal Retrieval-Augmented Generationcited by 37
- 2025A Survey of Multimodal Retrieval-Augmented Generation26 Mar 2025
- 2023LoraHub: Efficient Cross-Task Generalization via Dynamic LoRA Compositioncited by 359
- 2024Survey on Large Language Model-Enhanced Reinforcement Learning: Concept, Taxonomy, and Methodscited by 114
- 2024Efficient Prompting Methods for Large Language Models: A Surveycited by 46
- 2024A Survey of Transformer-based Language Models with Focus on Efficiencycited by 6
- 2023Modular Transformers: Compressing Transformers into Modularized Layers for Flexible Efficient Inferencecited by 4
- 2024Hierarchical Prompting Taxonomy: A Universal Evaluation Framework for Large Language Models Aligned with Human Cognitive Principlescited by 4
- 2025Dynamic Context-Aware Prompt Recommendation for Domain-Specific AI Applicationscited by 2
- 2025Dynamic Context-Aware Prompt Recommendation for Domain-Specific AI Applications25 Jun 2025
- 2024Hierarchical Prompting Taxonomy: A Universal Evaluation Framework for Large Language Models Aligned with Human Cognitive Principles18 Jun 2024
- 2024A Survey of Transformer-based Language Models with Focus on Efficiency15 May 2024
- 2024Efficient Prompting Methods for Large Language Models: A Survey1 Apr 2024
- 2024Survey on Large Language Model-Enhanced Reinforcement Learning: Concept, Taxonomy, and Methods30 Mar 2024
- 2023LoraHub: Efficient Cross-Task Generalization via Dynamic LoRA Composition25 Jul 2023
- 2023Modular Transformers: Compressing Transformers into Modularized Layers for Flexible Efficient Inference4 Jun 2023