Learning to Search Effective Example Sequences for In-Context Learning

Xiang Gao, Ankita Sinha, Kamalika Das
3/11/2025
cs.CL

No confident code implementation found for this paper.

Abstract

Large language models (LLMs) demonstrate impressive few-shot learning capabilities, but their performance varies widely based on the sequence of in-context examples. Key factors influencing this include the sequence's length, composition, and arrangement, as well as its relation to the specific query. Existing methods often tackle these factors in isolation, overlooking their interdependencies. Moreover, the extensive search space for selecting optimal sequences complicates the development of a holistic approach. In this work, we introduce Beam Search-based Example Sequence Constructor (BESC), a novel method for learning to construct optimal example sequences. BESC addresses all key factors involved in sequence selection by considering them jointly during inference, while incrementally building the sequence. This design enables the use of beam search to significantly reduce the complexity of the search space. Experiments across various datasets and language models show notable improvements in performance.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{gao2025learning,
  title  = {Learning to Search Effective Example Sequences for In-Context Learning},
  author = {Xiang Gao and Ankita Sinha and Kamalika Das},
  year   = {2025},
  eprint = {2503.08030},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2503.08030v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2503.08030.svg)](https://codeofpaper.com/paper/2503.08030)

Discussion