Zero-shot classification
Zero-shot classification: labels without training
Short answer
Zero-shot classification assigns text to categories the model was never trained on, using only the category names or descriptions you provide. It lets you classify with no labeled data. Accuracy depends mostly on how clearly the labels are described, so write each label as a short definition and evaluate on real examples before automating.
Classic classifiers learn categories from labeled examples. Zero-shot classifiers instead understand the meaning of the labels themselves, so you can introduce a new category by writing it down. The term covers several techniques, from natural-language-inference models that test "this text is about billing" as a hypothesis, to LLMs and decision models that read label descriptions directly.
Get Early Access to ClassifierHub: 2× credits in your first paid month.
Three ways to do zero-shot classification
- NLI models: score each label as a hypothesis against the text. Open source and cheap, but weaker with long descriptions and many labels.
- Chat LLMs: prompt with the labels and ask for one. Strong understanding, but text output, no reliable probabilities and higher cost.
- Decision models: send labels with descriptions and receive a probability per label in a fixed shape. Built specifically for this job.
Writing labels that work
Zero-shot accuracy is mostly label quality. Treat each label like a definition in a style guide:
- Describe what belongs and, for close neighbors, what doesn't.
- Use the vocabulary of your inputs, not internal jargon.
- Avoid overlapping labels, or split the decision into two questions.
- Provide an explicit other option.
Zero-shot vs. few-shot
Few-shot classification adds a handful of labeled examples to the prompt. It helps chat LLMs follow an unusual convention, but adds tokens to every call. With a decision model, improving the label descriptions usually gets the same effect without the per-call cost.
Evaluating before you automate
Label 100-300 real inputs yourself, run them through the classifier, and look at the confusion between labels. Most errors cluster between two labels whose descriptions overlap. Fix those descriptions, then pick the confidence threshold where automatic decisions meet your accuracy target.
curl https://classifierhub.com/v1/classify \
-H "Authorization: Bearer $CLASSIFIERHUB_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "I was charged twice for my subscription this month.",
"instructions": "Which team should handle this message?",
"options": {
"billing": "Payments, invoices, refunds, charges",
"technical": "Bugs, errors, outages",
"sales": "Buying, upgrading, pricing questions",
"other": "Anything else"
}
}'
# -> { "label": "billing", "confidence": 0.93,
# "probabilities": { "billing": 0.93, "technical": 0.03, "sales": 0.02, "other": 0.02 },
# "usage": { "credits": 1, "latency_ms": 420 } }The ClassifierHub API opens to Early Access members first.
Frequently asked questions
Related guides
Last updated . ClassifierHub is an independent product built on top of the Jev decision model, accessed through OpenRouter. It is not affiliated with or endorsed by TypeSafe or OpenRouter.