Share your thoughts, 1 month free Claude Pro on usSee more
WorkDL logo mark

Revisiting Demonstration Selection Strategies in In-Context Learning

About

Large language models (LLMs) have shown an impressive ability to perform a wide range of tasks using in-context learning (ICL), where a few examples are used to describe a task to the model. However, the performance of ICL varies significantly with the choice of demonstrations, and it is still unclear why this happens or what factors will influence its choice. In this work, we first revisit the factors contributing to this variance from both data and model aspects, and find that the choice of demonstration is both data- and model-dependent. We further proposed a data- and model-dependent demonstration selection method, \textbf{TopK + ConE}, based on the assumption that \textit{the performance of a demonstration positively correlates with its contribution to the model's understanding of the test samples}, resulting in a simple and effective recipe for ICL. Empirically, our method yields consistent improvements in both language understanding and generation tasks with different model scales. Further analyses confirm that, besides the generality and stability under different circumstances, our method provides a unified explanation for the effectiveness of previous methods. Code will be released.

Keqin Peng, Liang Ding, Yancheng Yuan, Xuebo Liu, Min Zhang, Yuanxin Ouyang, Dacheng Tao• 2024

Related benchmarks

TaskDatasetResultRank
Readmission predictionMIMIC IV
AUC-ROC0.5167
70
Mortality PredictionMIMIC-III
AUROC64.69
46
Readmission Prediction (RA)MIMIC-IV (test)
ROC AUC0.4535
33
Length-of-Stay PredictionMIMIC-III
Macro ROC AUC57.84
28
Mortality PredictionMIMIC-III (test)
AUROC64.28
14
Length of Stay (LOS) predictionMIMIC-III (test)
Macro ROC AUC56.3
14
Medical ReasoningMedQA
EM59.17
12
Medical ReasoningCMB clin
BLEU-129.04
12
Medical ReasoningCMB
Exact Match (EM)80.41
12
Alzheimer's Disease detectionCanary (test)
Acc73.3
5
Showing 10 of 12 rows

Other info

Follow for update