In-Context Learning for Extreme Multi-Label Classification

Karel D'Oosterlinck, Omar Khattab, François Remy, Thomas Demeester, Chris Develder +1 more
1/22/2024
cs.CLcs.AI

Official code: KarelDO/xmc.dspy (457 stars, MIT, last commit 2024-02-13).

Abstract

Multi-label classification problems with thousands of classes are hard to solve with in-context learning alone, as language models (LMs) might lack prior knowledge about the precise classes or how to assign them, and it is generally infeasible to demonstrate every class in a prompt. We propose a general program, $\texttt{Infer--Retrieve--Rank}$, that defines multi-step interactions between LMs and retrievers to efficiently tackle such problems. We implement this program using the $\texttt{DSPy}$ programming model, which specifies in-context systems in a declarative manner, and use $\texttt{DSPy}$ optimizers to tune it towards specific datasets by bootstrapping only tens of few-shot examples. Our primary extreme classification program, optimized separately for each task, attains state-of-the-art results across three benchmarks (HOUSE, TECH, TECHWOLF). We apply the same program to a benchmark with vastly different characteristics and attain competitive performance as well (BioDEX). Unlike prior work, our proposed solution requires no finetuning, is easily applicable to new tasks, alleviates prompt engineering, and requires only tens of labeled examples. Our code is public at https://github.com/KarelDO/xmc.dspy.

View on arXivView PDF

Code Implementations(1)

KarelDO/xmc.dspyOfficial100%
MIT

In-Context Learning for eXtreme Multi-Label Classification (XMC) using only a handful of examples.

45725Shell, PythonJan 22, 20242 years agoMIT
information-extractionprompt-engineeringretrievalretrieval-augmented-generation

Similar Papers

Cite this paper

@article{doosterlinck2024incontext,
  title  = {In-Context Learning for Extreme Multi-Label Classification},
  author = {Karel D'Oosterlinck and Omar Khattab and François Remy and Thomas Demeester and Chris Develder and Christopher Potts},
  year   = {2024},
  eprint = {2401.12178},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2401.12178v1}
}

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

Discussion