zero-shot-classification Β· text Β· WASM Β· ~70 MB
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.
| Model | Xenova/nli-deberta-v3-xsmall |
|---|---|
| Task / pipeline | zero-shot-classification (via natural-language inference) |
| How it works | each label becomes a hypothesis "This example is {label}."; the model's entailment probability is the label's score |
| Architecture | DeBERTa-v3 xsmall fine-tuned on NLI (MNLI / SNLI-style entailment data) |
| Modes | single-label (labels compete, softmax) or multi-label (each scored independently) |
| Quantization | q8 (8-bit) ONNX |
| Backend | WebAssembly (runs anywhere; no WebGPU needed) |
| Download | ~70 MB, cached after first load |
| License | MIT |
| Web APIs | WebAssembly, Web Workers β all Baseline widely available |
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.
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.
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.
Type text, invent labels, and watch the model score each one β no training.
Intent routing / ticket triage: sort an inbox into custom business categories.
Multi-label mood & topic tagging: apply many overlapping tags at once.
Whisper-style dictation β zero-shot intent routing, or embeddings + zero-shot tags.
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.