stat.MLOct 5, 2026

Retrieval-Based In-Context Learning: A Domain Adaptation Framework

Authors: Yilun Zhu, Naihao Deng, Yingcong Li, Naichen Shi, Clayton Scott

Organizations: University of Michigan. · New Jersey Institute of Technology. · Northwestern University.

Abstract

In-context retrieval (ICR) is a retrieval-based form of in-context learning (ICL) in which demonstrations are retrieved from a source database based on similarity to the query, rather than sampled independently. In this work, we formulate ICR as a type of domain adaptation problem, where the source distribution PP of the database may differ from the target distribution QQ of the test query-label pair. We investigate the performance of ICR under a flexible class of distributional shifts that substantially extends prior work \citep{li2024fine,guo2025retrieval}, and establish theoretical guarantees that quantify the benefits and pitfalls of this learning paradigm. Our theory is verified by experiments on synthetic and language tasks.

Figures & tables

Appendix figures & tables22 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. A Theoretical Interpretation of In-Context Learning via Probabilistic Modeling

    Jun 27, 2026Zhenyu Liu, Huaze Tang, Shao-Lun HuangIn-Context LearningProbabilistic Model

  2. How Does the Pretraining Distribution Shape In-Context Learning? A Fundamental Trade-Off

    Oct 1, 2025Waïss Azizian, Ali HasanIn-Context LearningDistributional Information