← All models

zero-shot-classification Β· text Β· WASM Β· ~70 MB

DeBERTa-v3 zero-shot β€” label text with categories you invent

Normal classifiers only know the labels they were trained on. This one takes your labels, made up on the spot, and scores how well each fits the text β€” no training, no fixed categories. It works by asking a natural-language-inference model "does this text imply 'This example is {your label}'?" and reading off the entailment. Type text and some labels below, then look inside at the raw entailment logits doing the deciding. Nothing leaves your device.

At a glance

ModelXenova/nli-deberta-v3-xsmall
Task / pipelinezero-shot-classification (via natural-language inference)
How it workseach label becomes a hypothesis "This example is {label}."; the model's entailment probability is the label's score
ArchitectureDeBERTa-v3 xsmall fine-tuned on NLI (MNLI / SNLI-style entailment data)
Modessingle-label (labels compete, softmax) or multi-label (each scored independently)
Quantizationq8 (8-bit) ONNX
BackendWebAssembly (runs anywhere; no WebGPU needed)
Download~70 MB, cached after first load
LicenseMIT
Web APIsWebAssembly, Web Workers β€” all Baseline widely available

Run it

Type some text and your candidate labels (comma-separated). Each label is scored independently against the text; the winner is the one the model most entails.

See inside β€” the entailment logits per hypothesis

For every label the model runs one NLI pass and outputs three numbers: how much the text contradicts, is neutral toward, or entails the hypothesis "This example is {label}." The label's score is that entailment slice. Below is the real 3-way distribution for each label β€” the labels that win are simply the ones the model most entails.

Classify some text above to inspect the entailment logits.

Why it matters

Zero-shot classification means you never have to collect a labelled dataset or train a model to sort text β€” you just describe the buckets you want in plain words and change them whenever you like. That's the difference between a two-week ML project and a one-line config. And at 70 MB it runs in a tab, so you can triage, route, and tag text on-device with nothing leaving the browser.

Use cases

Basics

Type text, invent labels, and watch the model score each one β€” no training.

Practical

Intent routing / ticket triage: sort an inbox into custom business categories.

Wild

Multi-label mood & topic tagging: apply many overlapping tags at once.

Multi-model

Whisper-style dictation β†’ zero-shot intent routing, or embeddings + zero-shot tags.

How the API works

You pass the text and your labels; the pipeline builds a hypothesis per label and ranks them:

import { pipeline } from "@huggingface/transformers";

const classifier = await pipeline(
  "zero-shot-classification",
  "Xenova/nli-deberta-v3-xsmall",
); // downloads + caches ~70 MB once

const out = await classifier(
  "My package is three days late with no update.",
  ["shipping delay", "billing problem", "product feedback"],
  { multi_label: false }, // labels compete via softmax; true = independent scores
);
// β†’ { labels: ["shipping delay", …], scores: [0.94, …] }  (sorted)

"See inside" reuses the same loaded model (classifier.model + classifier.tokenizer) to run each (text, hypothesis) pair itself and read the raw contradiction / neutral / entailment logits. All of it runs in a Web Worker so classifying never janks the page.

References