onepass-zsc-base

Zero-shot text classifier: any text + any list of labels -> calibrated probabilities in one forward pass. The text and one NLI hypothesis per label ("This text is about {label}.") are packed into a single sequence with a block attention mask (each hypothesis sees the text and itself) and shared relative positions, so the text is encoded once and every label is scored by the NLI entailment head in the same forward pass. Backbone: MoritzLaurer/deberta-v3-base-zeroshot-v2.0-c.

Usage

# code: github.com/Jitheswar/onepass-zsc  (pip install torch transformers safetensors huggingface_hub)
from huggingface_hub import snapshot_download
from onepass import ZeroShotClassifier
path = snapshot_download("Jitheswar/onepass-zsc-base")
clf = ZeroShotClassifier.load(path)          # uses CUDA fp16 when available
clf("The battery died after two days.", ["positive", "negative", "neutral"])
clf("Server is down and I was charged twice", ["billing", "outage", "feature request"], multi_label=True)

Held-out zero-shot results

None of these datasets were used in training. Accuracy uses raw scores; ECE uses the shipped temperature, fitted on a separate dev set of 8 other unseen datasets.

dataset #labels accuracy starting checkpoint (1 pass/label) ECE
20newsgroups 20 0.540 0.550 0.097
banking77 77 0.567 0.513 0.159
bbc_news 5 0.900 0.887 0.040
climate 2 0.583 0.530 0.247
cr 2 0.920 0.920 0.090
emotion 6 0.467 0.430 0.228
enron_spam 2 0.497 0.507 0.357
fin_topic 20 0.533 0.477 0.104
hate_offensive 3 0.600 0.663 0.150
massive_scenario 18 0.627 0.537 0.049
rotten_tomatoes 2 0.840 0.800 0.060
sms_spam 2 0.883 0.890 0.041
sst2 2 0.913 0.880 0.117
mean 0.682 0.660 0.134

Calibration (calibration.json, fitted on the dev set only): single-label temperature and uniform-mixing that depend on the number of labels; multi-label sigmoid Platt scaling. Baseline ECE on the same benchmark: 0.150.

Downloads last month
11
Safetensors
Model size
0.2B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support