mlsanityData to 7 Oct 2026

Efficient Prompting via Dynamic In-Context Learning

arXiv 2305.11170 ↗First posted 18 May 2023cs.CL cs.AI cs.LGcited by 18

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

  1. 2020Language Models are Few-Shot Learnerscited by 32,199
  2. 2022Training language models to follow instructions with human feedbackcited by 15,712
  3. 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
  4. 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
  5. 2015Distilling the Knowledge in a Neural Networkcited by 10,076
  6. 2023BLIP-2: Bootstrapping Language-Image Pre-training with Frozen Image Encoders and Large Language Modelscited by 6,069
  7. 2019BERTScore: Evaluating Text Generation with BERTcited by 5,462
  8. 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,304
  9. 2017On Calibration of Modern Neural Networkscited by 4,860
  10. 2018Think you have Solved Question Answering? Try ARC, the AI2 Reasoning Challengecited by 4,710
  11. 2019DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lightercited by 4,243
  12. 2021Finetuned Language Models Are Zero-Shot Learnerscited by 3,747
33 more
  1. 2022OPT: Open Pre-trained Transformer Language Modelscited by 3,464
  2. 2017TriviaQA: A Large Scale Distantly Supervised Challenge Dataset for Reading Comprehensioncited by 2,895
  3. 2019PIQA: Reasoning about Physical Commonsense in Natural Languagecited by 2,818
  4. 2015Character-level Convolutional Networks for Text Classificationcited by 2,293
  5. 2015Deep Compression: Compressing Deep Neural Networks with Pruning, Trained Quantization and Huffman Codingcited by 2,291
  6. 2021Learning to Prompt for Vision-Language Modelscited by 2,269
  7. 2018Can a Suit of Armor Conduct Electricity? A New Dataset for Open Book Question Answeringcited by 2,114
  8. 2018CommonsenseQA: A Question Answering Challenge Targeting Commonsense Knowledgecited by 1,793
  9. 2022Language Models (Mostly) Know What They Knowcited by 1,783
  10. 2014FitNets: Hints for Thin Deep Netscited by 1,619
  11. 2021Multitask Prompted Training Enables Zero-Shot Task Generalizationcited by 1,462
  12. 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,413
  13. 2018Adafactor: Adaptive Learning Rates with Sublinear Memory Costcited by 896
  14. 2019Are Sixteen Heads Really Better than One?cited by 803
  15. 2023The Flan Collection: Designing Data and Methods for Effective Instruction Tuningcited by 734
  16. 2020It's Not Just Size That Matters: Small Language Models Are Also Few-Shot Learnerscited by 668
  17. 2017BranchyNet: Fast Inference via Early Exiting from Deep Neural Networkscited by 591
  18. 2016Adaptive Computation Time for Recurrent Neural Networkscited by 479
  19. 2021Dynamic Neural Networks: A Surveycited by 405
  20. 2023Learning to Compress Prompts with Gist Tokenscited by 379
  21. 2019Q-BERT: Hessian Based Ultra Low Precision Quantization of BERTcited by 355
  22. 2020BERT Loses Patience: Fast and Robust Inference with Early Exitcited by 267
  23. 2018The Natural Language Decathlon: Multitask Learning as Question Answeringcited by 235
  24. 2020The Right Tool for the Job: Matching Model and Instance Complexitiescited by 125
  25. 2022Ground-Truth Labels Matter: A Deeper Look into Input-Label Demonstrationscited by 116
  26. 2020BERT-of-Theseus: Compressing BERT by Progressive Module Replacingcited by 112
  27. 2022Structured Prompting: Scaling In-Context Learning to 1,000 Examplescited by 81
  28. 2021A Survey on Green Deep Learningcited by 52
  29. 2020CascadeBERT: Accelerating Inference of Pre-trained Language Models via Calibrated Complete Models Cascadecited by 47
  30. 2022Model Cascading: Towards Jointly Improving Efficiency and Accuracy of NLP Systemscited by 43
  31. 2022Glance and Focus Networks for Dynamic Visual Recognitioncited by 41
  32. 2023In-Context Learning with Many Demonstration Examplescited by 39
  33. 2022AdapLeR: Speeding up Inference by Adaptive Length Reductioncited by 19

Built on by

Cited by year

Citing papers per year: 2023: 4; 2024: 8; 2025: 6.

18 papers.

Sort:

By area:

  1. 2023LoraHub: Efficient Cross-Task Generalization via Dynamic LoRA Compositioncited by 359
  2. 2024A Survey on Efficient Inference for Large Language Modelscited by 197
  3. 2024Survey on Large Language Model-Enhanced Reinforcement Learning: Concept, Taxonomy, and Methodscited by 114
  4. 2024Efficient Prompting Methods for Large Language Models: A Surveycited by 46
  5. 2025A Survey of Multimodal Retrieval-Augmented Generationcited by 37
  6. 2025Efficient Agents: Building Effective Agents While Reducing Costcited by 32
  7. 2023CodeCoT: Tackling Code Syntax Errors in CoT Reasoning for Code Generationcited by 29
  8. 2024An LLM-Tool Compiler for Fused Parallel Function Callingcited by 14
  9. 2024InCoRo: In-Context Learning for Robotics Control with Feedback Loopscited by 9
  10. 2024Style-Compress: An LLM-Based Prompt Compression Framework Considering Task-Specific Stylescited by 9
  11. 2023SmartTrim: Adaptive Tokens and Attention Pruning for Efficient Vision-Language Modelscited by 7
  12. 2024A Survey of Transformer-based Language Models with Focus on Efficiencycited by 6
6 more
  1. 2023Modular Transformers: Compressing Transformers into Modularized Layers for Flexible Efficient Inferencecited by 4
  2. 2024Hierarchical Prompting Taxonomy: A Universal Evaluation Framework for Large Language Models Aligned with Human Cognitive Principlescited by 4
  3. 2025Dynamic Context-Aware Prompt Recommendation for Domain-Specific AI Applicationscited by 2
  4. 2025Adaptive and Resource-efficient Agentic AI Systems for Mobile and Embedded Devices: A Surveycited by 2
  5. 2025Reliability of Large Language Model Generated Clinical Reasoning in Assisted Reproductive Technology: Blinded Comparative Evaluation Studycited by 1
  6. 2025RADAR: Accelerate Large Language Model Inference With RL-Based Dynamic Draft Treescited by 0