Zero-Shot Text Classifier, Free, Server-Side, No API Key
Sort any text into your own custom labels, no training data, no signup, no model download. A distilled BART-MNLI NLI model runs on our server to score how strongly each candidate label fits the input, using the entailment-NLI method introduced by Yin, Hay & Roth (2019).
How it works
The page implements the entailment-as-zero-shot-classification recipe first published by Yin, Hay & Roth (2019). The same recipe is the default behind Hugging Face's zero-shot-classification task, and that is the API we call server-side from this page.
1. Build a hypothesis per label
Your text is treated as the premise. For each candidate label L, the tool substitutes the label into the hypothesis template, the default is This text is about {}.. With label urgent, the hypothesis becomes “This text is about urgent.” A purpose-specific template (“This support ticket is {}.”) typically raises accuracy, which is why the field is editable in the Advanced disclosure.
2. Run an NLI head
The (premise, hypothesis) pair is tokenised and passed through valhalla/distilbart-mnli-12-3, a distilled BART encoder-decoder fine-tuned on MultiNLI (Williams, Nangia & Bowman, 2018). The classification head emits three logits per pair: contradiction, neutral, and entailment. The pipeline discards neutral and applies softmax to [contradiction, entailment] to produce the entailment probability, the chance that the hypothesis is entailed by the premise.
3. Aggregate across labels
In single-label mode the per-label entailment probabilities are softmaxed across all labels, so the scores sum to 100 %. In multi-label mode each label's entailment probability is reported as-is, multiple labels can be high. Pick single-label when the categories are mutually exclusive (news topic, primary intent), multi-label when they overlap (“urgent” AND “billing-related”).
for each label L_i:
hypothesis_i = template.replace("{}", L_i)
[c, n, e] = NLI(premise = text, hypothesis = hypothesis_i)
entail_i = softmax([c, e])[1] // discard neutral
single-label: scores = softmax([entail_1, ..., entail_N])
multi-label: scores = [entail_1, ..., entail_N]4. Server-side inference & privacy
The model runs server-side on the Hugging Face Inference API. Your text and labels are POSTed to /api/tools/zero-shot, forwarded once to Hugging Face, and the response is returned to your browser. Nothing is written to disk or any database; the route uses cache: "no-store" so there is no edge cache either. Inputs are capped at 4,000 characters and 12 labels to keep latency predictable. A deterministic word-overlap baseline runs alongside the model on every request as a transparent cross-check, when both rankings pick the same top label, the confidence is high; when they disagree, the page surfaces that explicitly.
Worked examples
Frequently asked questions
Sources & references
- Yin, Hay & Roth (2019): Benchmarking Zero-shot Text Classification (arXiv)
- Hugging Face: Zero-Shot Classification task page (template and multi_label spec)
- Lewis et al. (2019): BART: Denoising Sequence-to-Sequence Pre-training (arXiv)
- Williams, Nangia & Bowman (2018): MultiNLI corpus (ACL Anthology)
- Hugging Face: valhalla/distilbart-mnli-12-3 (model card, distillation details)
- Hugging Face Inference API documentation
Model card, Inference API endpoint, and method citations were last cross-checked on 2026-05-12. The page is reviewed each time the upstream model repository is updated or a new MNLI-based NLI checkpoint becomes the recommended default.
Related tools
Comments & feedback
Spotted a bug or want an improvement? Tell us, our team reviews every comment, and good ideas get built. Comments are public and anonymous.
Found a misclassification, edge case, or want to suggest a different model?
Email me at [email protected] , most fixes ship within 24 hours.