Dynamic $k$-shot In-Context Learning
Its authors withdrew this paper, so there is no full text to read or summarize.
Abstract
In-context learning (ICL) allows large language models (LLMs) to learn new tasks from demonstrations and to predict unseen inputs without parameter updates. Existing studies typically fix the number of demonstrations as a static hyperparameter (e.g., 5 or 10), overlooking the variability across models and inputs. We empirically find that the same query text may yield different outcomes depending on the number of demonstrations used. Motivated by this observation, we propose Dynamic-$k$ In-Context Learning (D-$k$-ICL), a novel method that adaptively determines the most suitable number of demonstrations for each query text. The core component is a performance predictor—a neural network that jointly encodes the query text and candidate in-contexts (constructed with varying demonstration counts) to estimate expected inference quality. At inference time, we retrieve the top-$k$ semantically similar demonstrations and progressively vary $k$ to generate candidate in-contexts. The predictor then selects the candidate most likely to yield the best output, thereby dynamically adapting both the number and composition of demonstrations. Across three LLMs and eight datasets, D-$k$-ICL achieves considerable results, with up to 77.8\% accuracy, 0.641 MSE, 0.271 ROUGE-1, and 0.295 BLEU. Furthermore, even when trained under few-shot, weakly supervised, or self-supervised settings, the predictor remains effective. Finally, D-$k$-ICL consistently improves performance on commercial LLMs such as GPT-4o, demonstrating its robustness and broad applicability.
BibTeX
@misc{wang2026dynamic,
author = {Wenqiang Wang and Yan XIAO and Xiaojun Jia and Yangshijie Zhang and Peng Chen and Bin Zeng and Xiaochun Cao},
title = {{Dynamic $k$-shot In-Context Learning}},
year = {2026},
url = {https://openreview.net/forum?id=6XdT4NuIMz},
howpublished = {OpenReview},
note = {Submitted to ICLR 2026},
}Ask Althea to put this paper to the test.
Loading related content...