Skip to main content
QUICK REVIEW

[Paper Review] Building Efficient Universal Classifiers with Natural Language Inference

Moritz Laurer, Wouter van Atteveldt|arXiv (Cornell University)|Dec 29, 2023
Topic ModelingComputer Science10 citations
TL;DR

The paper shows how Natural Language Inference (NLI) can serve as a universal, efficient classification task and provides a practical pipeline and a trained universal classifier trained on 33 datasets with 389 classes, improving zeroshot performance by 9.4% over NLI-only models.

ABSTRACT

Generative Large Language Models (LLMs) have become the mainstream choice for fewshot and zeroshot learning thanks to the universality of text generation. Many users, however, do not need the broad capabilities of generative LLMs when they only want to automate a classification task. Smaller BERT-like models can also learn universal tasks, which allow them to do any text classification task without requiring fine-tuning (zeroshot classification) or to learn new tasks with only a few examples (fewshot), while being significantly more efficient than generative LLMs. This paper (1) explains how Natural Language Inference (NLI) can be used as a universal classification task that follows similar principles as instruction fine-tuning of generative LLMs, (2) provides a step-by-step guide with reusable Jupyter notebooks for building a universal classifier, and (3) shares the resulting universal classifier that is trained on 33 datasets with 389 diverse classes. Parts of the code we share has been used to train our older zeroshot classifiers that have been downloaded more than 55 million times via the Hugging Face Hub as of December 2023. Our new classifier improves zeroshot performance by 9.4%.

Motivation & Objective

  • Demonstrate that NLI can serve as a universal classification task for zero- and few-shot learning.
  • Provide a practical, reproducible pipeline to build a universal classifier combining NLI with non-NLI data.
  • Release a universal classifier trained on diverse datasets and offer guidance for adapting it to new tasks and domains.

Proposed method

  • Harmonize five NLI datasets with 28 non-NLI datasets into a single binary entailment format.
  • Convert non-NLI classes into hypothesis statements and pair texts with all class hypotheses for evaluation.
  • Fine-tune encoder-only transformers (DeBERTaV3) on the concatenated hypothesis–premise data with a binary entailment objective.
  • Evaluate models using balanced accuracy across 28 held-out tasks and in-domain tasks.
  • Provide notebooks and tooling to train, evaluate, and adapt universal classifiers; release deberta-v3-zeroshot-v1.1-all-33 as the recommended model.
Figure 1: Illustration of universal classification with BERT-NLI based on Laurer et al., 2023a
Figure 1: Illustration of universal classification with BERT-NLI based on Laurer et al., 2023a

Experimental results

Research questions

  • RQ1Can NLI be used as a universal task to perform zeroshot classification across diverse tasks without task-specific fine-tuning?
  • RQ2Does mixing NLI data with non-NLI classification data improve zeroshot and few-shot generalization compared to NLI data alone?
  • RQ3What is the trade-off in computational cost when using NLI for multiclass classification, and how does it scale with the number of classes?

Key findings

  • A mixed training set of NLI and non-NLI data yields higher zeroshot performance than NLI-only training, with an average improvement of 9.4%.
  • The universal classifier trained on 33 datasets and 389 classes shows broader task coverage and better generalization, including held-out datasets.
  • The model deberta-v3-zeroshot-v1.1-all-33 is recommended for downstream zeroshot classification tasks.
  • Training on roughly 9 million hypothesis–premise pairs per run takes several hours on a modern GPU, with multiple runs required for held-out evaluation.
  • There are some negative transfer cases where the mixed-task model underperforms on certain datasets compared to the NLI-only model, but overall gains are robust.
Figure 3: Mean performance across 28 classification tasks.
Figure 3: Mean performance across 28 classification tasks.

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.