Learning to Rank for In-Context Example Retrieval

Yuwen Ji, Luo-Dan Zhang, Ambyera Han, Haoran Que, Lei Shi +2 more
1/1/2025

No official code found. Best implementation: 2022neo/SeDPO_NIPS25 (21 stars).

Abstract

Recent advances in retrieval-based in-context learning (ICL) train the retriever using a classification objective, which categorizes in-context examples (ICEs) into the most useful and the rest based on absolute scores. However, during inference, ICEs are retrieved by score ranking rather than classification — The classification training objective deviates from this test scenario.

Show full abstract

Hence, in this paper, we propose a novel algorithm that trains a retrieval model by ranking formulation, where the preference rankings between ICEs are given by comparing the likelihood of the LLM generating the correct answer conditioned on each exemplar. By learning to rank, we motivate the retriever to automatically learn diverse rationales why specific examples are more useful for ICL decisions. This addresses the issue that classification models poorly capture broader utility. Experimental results demonstrate the top-1 performance of our proposal across 9 NLP tasks, with ablation studies and case studies further validating the effectiveness of our design. The code can be found in: https://github.com/2022neo/SeDPO_NIPS25

DOISemantic Scholar

Code Implementations(1)

Official code for 'Learning to Rank for In-Context Example Retrieval'

210

Similar Papers

Cite this paper

@article{ji2025learning,
  title  = {Learning to Rank for In-Context Example Retrieval},
  author = {Yuwen Ji and Luo-Dan Zhang and Ambyera Han and Haoran Que and Lei Shi and Wang Chao and Yue Zhang},
  year   = {2025},
  doi    = {10.52202/085713-4732},
  url    = {https://doi.org/10.52202/085713-4732},
  journal = {Neural Information Processing Systems}
}

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/e8ad2adb0b610d639b1e8cd6ab06b8580d420caf.svg)](https://codeofpaper.com/paper/e8ad2adb0b610d639b1e8cd6ab06b8580d420caf)

Discussion