cs.CLApr 13, 2026

Toward Robust In-Context Learning: Leveraging Out-of-distribution Proxies for Target Inaccessible Demonstration Retrieval

Authors: Hao Xu, Rite Bo, Fausto Giunchiglia, Yingji Li, Rui Song

Organizations: College of Computer Science and Technology, Jilin University, China · Department of Information Engineering and Computer Science, University of Trento, Italy

Abstract

Although studies have demonstrated that Large Language Models (LLMs) can perform well on Out-of-Distribution (OOD) tasks, their advantage tends to diminish as the distribution shift becomes more severe. Consequently, researchers aim to retrieve distributionally similar and informative demonstrations from the available source domain to boost the inference capabilities of LLMs. However, in practical scenarios where the target domain is inaccessible, evaluating the unknown distribution is challenging, which indirectly impacts the quality of the selected demonstrations. To address this problem, we propose DOPA, a demonstration search framework that incorporates an OOD proxy to approximate the inaccessible target domain and guide the retrieval process. Building on proxy-based evaluation, DOPA further introduces a Mahalanobis distance-based global diversity constraint to ensure sufficient diversity among the retrieved demonstrations. Experimental results on multiple LLMs and tasks demonstrate that DOPA effectively enhances robustness in OOD settings\footnote{https://github.com/bort64/ood\_code}.

Figures & tables

Appendix figures & tables5 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. SCOPE: Sequential Conformal Probing for Reliable OOD Rejection in LLM Services

    Jun 19, 2026Zhuoyun Li, Boxuan Wang, Changshun Wu +2Conformal PredictionOOD Detection

  2. Farther the Shift, Sparser the Representation: Analyzing OOD Mechanisms in LLMs

    Mar 3, 2026Mingyu Jin, Yutong Yin, Jingcheng Niu +7OOD GeneralizationRepresentation Geometry in Language Models