Compositional Exemplars for In-context Learning

Jiacheng Ye, Zhiyong Wu, Jiangtao Feng, Tao Yu, Lingpeng Kong
2/11/2023
cs.CLcs.AIcs.LG

Official code: HKUNLP/icl-ceil (104 stars, Apache-2.0, last commit 2023-03-15).

Abstract

Large pretrained language models (LMs) have shown impressive In-Context Learning (ICL) ability, where the model learns to do an unseen task via a prompt consisting of input-output examples as the demonstration, without any parameter updates. The performance of ICL is highly dominated by the quality of the selected in-context examples. However, previous selection methods are mostly based on simple heuristics, leading to sub-optimal performance. In this work, we formulate in-context example selection as a subset selection problem. We propose CEIL (Compositional Exemplars for In-context Learning), which is instantiated by Determinantal Point Processes (DPPs) to model the interaction between the given input and in-context examples, and optimized through a carefully-designed contrastive learning objective to obtain preference from LMs. We validate CEIL on 12 classification and generation datasets from 7 distinct NLP tasks, including sentiment analysis, paraphrase detection, natural language inference, commonsense reasoning, open-domain question answering, code generation, and semantic parsing. Extensive experiments demonstrate not only the state-of-the-art performance but also the transferability and compositionality of CEIL, shedding new light on effective and efficient in-context learning. Our code is released at https://github.com/HKUNLP/icl-ceil.

View on arXivView PDF

Code Implementations(1)

HKUNLP/icl-ceilOfficial100%
Apache-2.0

[ICML 2023] Code for our paper “Compositional Exemplars for In-context Learning”.

10411Shell, PythonFeb 14, 20233 years agoApache-2.0
compositionalitydeterminantal-point-processesin-context-learninglarge-language-modelsmetric-learning+1 more

Similar Papers

Cite this paper

@article{ye2023compositional,
  title  = {Compositional Exemplars for In-context Learning},
  author = {Jiacheng Ye and Zhiyong Wu and Jiangtao Feng and Tao Yu and Lingpeng Kong},
  year   = {2023},
  eprint = {2302.05698},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2302.05698v3},
  journal = {ICML 2023 2023}
}

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

Discussion