Our new X account is live! Follow @wizwand_team for updates
WorkDL logo mark

$Se^2$: Sequential Example Selection for In-Context Learning

About

The remarkable capability of large language models (LLMs) for in-context learning (ICL) needs to be activated by demonstration examples. Prior work has extensively explored the selection of examples for ICL, predominantly following the "select then organize" paradigm, such approaches often neglect the internal relationships between examples and exist an inconsistency between the training and inference. In this paper, we formulate the problem as a $Se$quential $Se$lection problem and introduce $Se^2$, a sequential-aware method that leverages the LLM's feedback on varying context, aiding in capturing inter-relationships and sequential information among examples, significantly enriching the contextuality and relevance of ICL prompts. Meanwhile, we utilize beam search to seek and construct example sequences, enhancing both quality and diversity. Extensive experiments across 23 NLP tasks from 8 distinct categories illustrate that $Se^2$ markedly surpasses competitive baselines and achieves 42\% relative improvement over random selection. Further in-depth analysis shows the effectiveness of proposed strategies, highlighting $Se^2$'s exceptional stability and adaptability across various scenarios. Code available at https://github.com/microsoft/LMOps.

Haoyu Liu, Jianfeng Liu, Shaohan Huang, Yuefeng Zhan, Hao Sun, Weiwei Deng, Furu Wei, Qi Zhang• 2024

Related benchmarks

TaskDatasetResultRank
Commonsense ReasoningHellaSwag
Accuracy54.6
1460
Natural Language InferenceRTE
Accuracy56
367
Question AnsweringOBQA
Accuracy50
276
Question AnsweringARC-E
Accuracy63.3
242
Natural Language InferenceSNLI
Accuracy78.4
174
Question AnsweringARC-C
Accuracy33.3
166
Common Sense ReasoningCOPA
Accuracy76
138
Sentiment AnalysisSST-5
Accuracy52.7
47
Natural Language InferenceQNLI
Accuracy80.2
42
SummarizationGigaword
ROUGE-L25.8
38
Showing 10 of 22 rows

Other info

Code

Follow for update