Skip to main content
QUICK REVIEW

[Paper Review] Unified Demonstration Retriever for In-Context Learning

Xiaonan Li, Kai Lv|arXiv (Cornell University)|May 7, 2023
Topic ModelingComputer Science3 citations
TL;DR

This paper proposes Unified Demonstration Retriever (UDR), a single multi-task model that retrieves high-quality demonstrations for in-context learning across diverse NLP tasks. By unifying task-specific signals into a list-wise ranking framework and using iterative mining with LLM feedback, UDR outperforms baselines on 30+ tasks spanning 13 families, demonstrating strong generalization across model sizes, datasets, and few-shot settings.

ABSTRACT

In-context learning is a new learning paradigm where a language model conditions on a few input-output pairs (demonstrations) and a test input, and directly outputs the prediction. It has been shown highly dependent on the provided demonstrations and thus promotes the research of demonstration retrieval: given a test input, relevant examples are retrieved from the training set to serve as informative demonstrations for in-context learning. While previous works focus on training task-specific retrievers for several tasks separately, these methods are often hard to transfer and scale on various tasks, and separately trained retrievers incur a lot of parameter storage and deployment cost. In this paper, we propose Unified Demonstration Retriever ( extbf{UDR}), a single model to retrieve demonstrations for a wide range of tasks. To train UDR, we cast various tasks' training signals into a unified list-wise ranking formulation by language model's feedback. Then we propose a multi-task list-wise ranking training framework, with an iterative mining strategy to find high-quality candidates, which can help UDR fully incorporate various tasks' signals. Experiments on 30+ tasks across 13 task families and multiple data domains show that UDR significantly outperforms baselines. Further analyses show the effectiveness of each proposed component and UDR's strong ability in various scenarios including different LMs (1.3B - 175B), unseen datasets, varying demonstration quantities, etc.

Motivation & Objective

  • Address the scalability and deployment cost of task-specific demonstration retrievers used in in-context learning.
  • Enable a single model to generalize across diverse NLP tasks without retraining or task-specific signal engineering.
  • Improve demonstration retrieval quality by unifying diverse task signals into a shared list-wise ranking objective.
  • Reduce reliance on heuristic or manually designed retrieval signals by leveraging language model feedback.
  • Develop a scalable, transferable framework that supports zero-shot and few-shot generalization across models and datasets.

Proposed method

  • Unify diverse task-specific training signals into a single list-wise ranking formulation using language model feedback as the supervision signal.
  • Design a multi-task list-wise ranking training framework where the retriever learns to rank candidate demonstrations for multiple tasks simultaneously.
  • Implement an iterative mining strategy: use the current retriever to identify high-quality positive and hard negative examples from the full training set.
  • Train the retriever end-to-end using contrastive learning on ranked lists, improving alignment between test inputs and relevant demonstrations.
  • Leverage pre-trained language models to generate feedback signals for ranking, enabling zero-shot transfer to unseen tasks.
  • Use a unified architecture to support diverse tasks including text classification, summarization, code comment generation, and text simplification.

Experimental results

Research questions

  • RQ1Can a single unified retriever generalize across diverse NLP tasks without task-specific fine-tuning?
  • RQ2How does list-wise ranking with LLM feedback improve demonstration retrieval over binary ranking or heuristic methods?
  • RQ3To what extent can UDR generalize to unseen datasets and large language models of varying sizes (1.3B–175B parameters)?
  • RQ4How effective is the iterative mining strategy in identifying high-quality positive and hard negative examples for training?
  • RQ5Does UDR outperform task-specific and off-the-shelf baselines in few-shot in-context learning across multiple domains?

Key findings

  • UDR achieves significant performance gains over strong baselines, including EPR and BM25, across 30+ tasks spanning 13 task families.
  • UDR generalizes effectively to unseen datasets, demonstrating strong zero-shot transfer capability without retraining.
  • The model maintains strong performance across a wide range of LMs, from 1.3B to 175B parameters, indicating robustness to model scale.
  • The iterative mining strategy significantly improves retrieval quality by identifying high-utility positive and hard negative examples.
  • Ablation studies confirm that both the unified list-wise ranking objective and the iterative mining component are essential for UDR’s performance.
  • UDR outperforms task-specific retrievers in few-shot settings, especially when the number of demonstrations is limited.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.