Skip to main content
QUICK REVIEW

[Paper Review] In-Context Learning for Extreme Multi-Label Classification

Karel D’Oosterlinck, Omar Khattab|arXiv (Cornell University)|Jan 22, 2024
Text and Document Classification TechnologiesComputer Science5 citations
TL;DR

The paper proposes Infer--Retrieve--Rank, a modular in-context learning program that combines a frozen retriever with two in-context LM modules to tackle extreme multi-label classification without fine-tuning, achieving state-of-the-art results on several benchmarks. Optimization uses DSPy to bootstrap prompts with only tens of labeled examples.

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, $ exttt{Infer--Retrieve--Rank}$, that defines multi-step interactions between LMs and retrievers to efficiently tackle such problems. We implement this program using the $ exttt{DSPy}$ programming model, which specifies in-context systems in a declarative manner, and use $ exttt{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.

Motivation & Objective

  • Address the challenge of extreme multi-label classification (XMC) with thousands of classes when using in-context learning alone.
  • Propose a modular pipeline (Infer--Retrieve--Rank) that leverages frozen components and minimal supervision to reach strong performance.
  • Automate prompt bootstrapping and optimization via the DSPy programming model to adapt to diverse datasets without fine-tuning.
  • Demonstrate effectiveness across multiple XMC benchmarks (HOUSE, TECH, TECHWOLF, BioDEX) and show cost-efficient deployment.

Proposed method

  • Introduce Infer--Retrieve--Rank (IReRa), a three-step program: Infer (LM predicts relevant label queries from the input), Retrieve (a frozen retriever ranks labels by query similarity), Rank (LM reranks the retrieved labels).
  • Implement the program using the DSPy framework to declaratively specify modules and optimize them per task with bootstrapped few-shot prompts.
  • Use a zero-shot teacher LM to bootstrap few-shot prompts for the two LM components, with optimization relying on about 50 labeled validation examples and around 20 teacher + 1,500 student LM calls per task.
  • Instantiate Infer with Llama-2-7b-chat (student) and GPT-3.5 (teacher); Rank with GPT-4; Retrieve with a frozen all-mpnet-base-v2/BioLORD-like retriever.
  • Provide seed-prompts per dataset that define the in-context behavior for each module (Infer/Rank) and minimal zero-shot prompts, with DSPy handling bootstrapping and selection of labels.
  • Evaluate RP@5 and RP@10 metrics across four datasets and compare against prior baselines and finetuned systems.
Figure 1: We propose Infer-Retrieve-Rank , an efficient in-context learning program for multi-label classification with an extreme amount of classes ( $\geq$ 10,000). Given an input, a first in-context learning module predicts queries which route to a frozen retriever. The retrieved documents are re
Figure 1: We propose Infer-Retrieve-Rank , an efficient in-context learning program for multi-label classification with an extreme amount of classes ( $\geq$ 10,000). Given an input, a first in-context learning module predicts queries which route to a frozen retriever. The retrieved documents are re

Experimental results

Research questions

  • RQ1Can a modular in-context learning pipeline achieve competitive or state-of-the-art XMC performance without fine-tuning?
  • RQ2How much labeled data and how many LM calls are needed to bootstrap a performant IReRa program per task?
  • RQ3What is the impact of each module (Infer, Retrieve, Rank) and their optimizations on XMC performance?
  • RQ4How does the approach generalize across tasks with different characteristics (biomedical vs. ESCO job skills)?

Key findings

  • IReRa attains state-of-the-art RP@5 and RP@10 on HOUSE, TECH, and TECHWOLF datasets with no fine-tuning and around 50 labeled validation examples.
  • On BioDEX, IReRa shows meaningful traction but is not strictly superior to the best finetuned system; adding a Rank module or further optimizing Infer improves results.
  • The best program, Infer--Retrieve--Rank, uses one frozen retriever and two LM modules, with costs around 20 teacher calls and 1,500 student calls per task for bootstrapping, and about one LM call per module per new input.
  • Optimization steps (Infer, Retrieve, Rank) each contribute to performance gains; even the simpler Infer--Retrieve setup yields competitive results with a single LM and a frozen retriever.
  • Compared to finetuned systems, IReRa offers lower data requirements and avoids extensive prompt engineering, while remaining adaptable to new datasets via minimal seed prompts and DSPy-driven optimization.

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.