ultrabert-380m-dynamic-labels
A dynamic-label zero-shot text classifier: dmis-lab/UltraBERT-380M fine-tuned to judge
"This text is about ." as entailment vs contradiction across 19 datasets, so the
label set is supplied at inference time and nothing fixes a vocabulary.
Independent fine-tune; NOT affiliated with or endorsed by dmis-lab, the Jev project,
openjev, or the authors of any benchmark or model that appears below as a cited
comparison.
Same recipe as roberta-large-mnli-dynamic-labels (same template, caps protocol, and
readout), with a raw 2T-token encoder as the base and three extra mixture components:
relevance judgments (MS MARCO), tool-calling decisions (When2Call), and harmfulness
(HateCheck).
How it works
- Input: the (premise, hypothesis) pair (text, "This text is about ."), encoded
with truncation='longest_first', max 512 tokens.
trust_remote_code=Trueis REQUIRED: UltraBERT ships its own modeling/tokenizer code with the checkpoint (the files are re-uploaded with this model). - Training target: gold label -> entailment; 2 sampled wrong labels per example -> contradiction (15% of negatives drawn from other datasets' label sets, 20% of classification examples also get a "not " negation negative).
- Readout: renormalized P(entailment) per candidate label.
- single-label: softmax across the per-label log-odds (quickstart below)
- multi-label: threshold the raw P(entailment) per label
- The base model ships NO classification head; the 3-way contradiction/neutral/entailment head was created fresh and the NLI half of the mixture taught entailment from scratch.
Training data
19 datasets (caps on positive examples; negatives on top). Profile: full.
| dataset | task | positives |
|---|---|---|
| SNLI | Stanford NLI | 25000 |
| MNLI | MultiNLI | 25000 |
| WANLI | Worker-and-AI NLI | 30000 |
| ANLI | Adversarial NLI | 10000 |
| AGNEWS | news topics | 6000 |
| DBPEDIA | ontology types | 6000 |
| YAHOO | Q&A topics | 6000 |
| IMDB | movie reviews | 5000 |
| SST2 | sentiment | 5000 |
| YELP | review polarity | 5000 |
| BANKING77 | banking intents | 8000 |
| CLINC | assistant intents | 8000 |
| HWU64 | assistant intents | 5000 |
| GOEMOTIONS | emotions | 5000 |
| EMOTION | emotions | 5000 |
| MASSIVE | assistant intents | 5000 |
| MSMARCO | relevance retain/discard | 6000 |
| WHEN2CALL | tool-calling responses | 8000 |
| HATECHECK | harmfulness functional tests | 5000 |
357,797 training pairs total (positives + 2 sampled negatives each), 2,000 validation pairs. The safety component is the HateCheck test split (functional tests); the gated WildGuardMix was unavailable at training time (no access token).
Training procedure
- Base:
dmis-lab/UltraBERT-380M(377.5M fine-tuned params), full fine-tune, fp32 on Apple MPS (M2 Pro), gradient checkpointing for 16 GB RAM headroom - Effective batch 64 (batch 8 x 8 accumulation), cosine LR at 1e-5, 6% warmup, weight decay 0.01, seed 42, max sequence length 512
- Configured 3 epochs (16,773 steps); stopped at 5,500 steps = 0.984 epochs (~352,000 pairs seen): validation loss had been flat since ~0.61 epochs (0.117 at step 3,400 -> 0.116 at step 5,500), so epochs 2-3 were cut as redundant
- Wall-clock training time: ~65 h. LR at stop 7.6e-6 (cosine schedule laid out for 3 epochs, so it never fully annealed)
Training-data licenses
Model weights and this card: MIT. Base model dmis-lab/UltraBERT-380M: Apache-2.0.
The 19 training datasets carry their own licenses (Hub/GitHub terms checked 2026-10-19):
| dataset (source repo) | license |
|---|---|
| SNLI (stanfordnlp/snli) | CC BY-SA 4.0 |
| MNLI (nyu-mll/multi_nli) | CC BY 3.0 / CC BY-SA 3.0 / MIT / other (multi-part) |
| WANLI (alisawuffles/WANLI) | CC BY 4.0 |
| ANLI (facebook/anli) | CC BY-NC 4.0 (non-commercial) |
| AGNEWS (fancyzhx/ag_news) | not stated |
| DBPEDIA (fancyzhx/dbpedia_14) | CC BY-SA 3.0 |
| YAHOO (community-datasets/yahoo_answers_topics) | not stated |
| IMDB (stanfordnlp/imdb) | other |
| SST2 (stanfordnlp/sst2) | not stated |
| YELP (Yelp/yelp_review_full) | other |
| BANKING77 (legacy-datasets/banking77) | CC BY 4.0 |
| CLINC (clinc/clinc_oos) | CC BY 3.0 |
| HWU64 (FastFit/hwu_64) | not stated |
| GOEMOTIONS (google-research-datasets/go_emotions) | Apache-2.0 |
| EMOTION (dair-ai/emotion) | other |
| MASSIVE (mteb/amazon_massive_intent) | CC BY 4.0 |
| MS MARCO (microsoft/ms_marco) | non-commercial research only (Microsoft terms) |
| When2Call (nvidia/When2Call) | CC BY 4.0 |
| HateCheck (Paul/hatecheck; upstream paul-rottger/hatecheck-data) | CC BY 4.0 |
Note: ANLI is CC BY-NC 4.0 and MS MARCO is restricted to non-commercial research - review this table before commercial use of the fine-tuned weights. The weights and card are MIT; the upstream dataset terms still govern the data itself.
Evaluation
tweet_eval sentiment (3 labels) + emotion (4 labels) test rows were NOT in the training
mixture. 400 rows each, fixed seed. One temperature fitted on ag_news + sst2 + banking77
(in-mixture, calibration only). T=1.0 and the fitted T are both reported.
| dataset / readout | accuracy | macro-F1 | NLL | Brier | ECE |
|---|---|---|---|---|---|
| tweet_eval/sentiment (T=1.0) | 0.523 | 0.254 | 3.557 | 0.927 | 0.459 |
| tweet_eval/sentiment (T=2.148) | 0.523 | 0.254 | 1.738 | 0.850 | 0.395 |
| tweet_eval/emotion (T=1.0) | 0.775 | 0.709 | 0.721 | 0.349 | 0.089 |
| tweet_eval/emotion (T=2.148) | 0.775 | 0.709 | 0.691 | 0.354 | 0.110 |
| overall (T=1.0) | 0.649 | 0.581 | 2.139 | 0.638 | 0.272 |
| overall (T=2.148) | 0.649 | 0.581 | 1.215 | 0.602 | 0.211 |
The sentiment macro-F1 (0.254 at 0.523 accuracy) shows the readout collapsing toward one class on 3-way tweet sentiment; emotion wins on both axes.
Multi-label readout
go_emotions test rows (200 rows, 28 labels; in-mixture dataset, checking the thresholding readout, not unseen accuracy):
- sample-F1 at threshold 0.5: 0.4514
- best threshold 0.8 -> sample-F1 0.5208
- precision@3: 0.82
Latency
On Apple M2 Pro (mps, fp32, 377.5M):
| sweep | mean ms | p50 ms | p95 ms |
|---|---|---|---|
| batch=1, 2 labels | 27.4 | 27.0 | 28.7 |
| batch=1, 4 labels | 39.0 | 39.0 | 39.1 |
| batch=1, 10 labels | 72.0 | 71.9 | 72.6 |
| batch=1, 27 labels | 178.5 | 178.6 | 178.9 |
| batch=1, 4 labels (real label set) | 38.5 | 38.5 | 38.7 |
| batch=8, 4 labels | 266.4 | 266.5 | 266.9 |
| batch=32, 4 labels | 1142.4 | 1142.3 | 1144.0 |
S1MB - shared benchmark, measured here
hotchpotch/S1MB-english-v1 (106 subsets, 26,269 typed decisions) evaluated with the
shipped scorer: premise = rendered state + documents + instructions, candidates = the
decision's criteria, prediction = argmax renormalized P(entailment), gold = the target
distribution's mode. RAW accuracy (the published leaderboard columns are baseline-adjusted
scores, so they are kept separate below).
| decision type | n | accuracy |
|---|---|---|
| choice | 8764 | 0.395 |
| noul | 12357 | 0.442 |
| score | 5148 | 0.325 |
| overall | 26269 | 0.403 |
Subsets whose upstream dataset was in the training mixture (banking77, clinc, dbpedia,
go_emotions, hwu64, laya__ag_news, massive, snli,
synthetic_relevance__nanobeir__NanoMSMARCO): accuracy 0.523 on n=4451 of judgments; the
other subsets: accuracy 0.3791 on n=21818. Same distribution, other splits - S1MB
itself does not establish training-data non-overlap. Per-config artifacts in
eval/s1mb.json.
Same benchmark, same metric: S1MB raw accuracy
One unit everywhere: raw accuracy (percent) of the argmax prediction on the same
hotchpotch/S1MB-english-v1 benchmarks and the same public targets. Our row was
measured here with the shipped scorer; the other rows are computed from the published
per-benchmark predictions of those models in hotchpotch/s1mb-result (noul rows use
the published accuracy field of each file; tie order on their rounded probabilities can
shift a noul row by ~0-2pp).
| model | params | Choice | Noul | Score | overall |
|---|---|---|---|---|---|
| ultrabert-380m-dynamic-labels (this model) (MEASURED) | 377.5M | 39.5% | 44.2% | 32.5% | 40.4% |
| Jev 1.13 (TypeSafe AI) | - | 76.8% | 83.1% | 63.1% | 77.1% |
| OpenJev 27B (openjev) | 27B | 75.5% | 83.4% | 67.2% | 77.6% |
| Open-Jev-27B-v1.1 (ZefanCai) | 25.6B | 72.9% | 82.5% | 66.5% | 76.2% |
| Open-Jev-9B (ZefanCai) | 7.9B | 65.6% | 82.7% | 62.1% | 73.0% |
| Tev1-4B-experimental | 4.5B | 65.5% | 78.8% | 63.1% | 71.3% |
| ModernBERT-large-zeroshot-v2.0 | 396M | 36.4% | 49.9% | 16.2% | 38.8% |
| open-jev-deberta-v3-large (kotobalabs) | 304M | 39.8% | 65.8% | 19.4% | 48.0% |
| Qwen3-Reranker-4B | 4B | 44.9% | 71.2% | 16.9% | 51.8% |
| laya | 421M | 34.2% | 65.1% | 34.3% | 48.8% |
| decider-4b (Mapika) | 4B | 63.7% | 81.3% | 60.0% | 71.2% |
| chance-level baseline (uniform for Choice, majority for Noul) | - | 22.9% | 72.9% | - | - |
Source: https://huggingface.co/datasets/hotchpotch/s1mb-result (accessed 2026-10-15).
Artificial Analysis Decision Index benchmarks
The AA Decision Index (https://artificialanalysis.ai/articles/artificial-analysis-decision-index, 2026-10-13) is a weighted average of four benchmarks. This model was evaluated on the three public ones with the shipped readout; the fourth (AA-Omniscience-Decision) is a private eval set and cannot be run, and the composite index is NOT computed (the weights are unpublished). Our numbers and the roberta release's numbers are MEASURED on this machine with identical protocols (same repos, splits, fixed-seed row samples, 512-token scoring); the others are CITED from the article.
| benchmark | this model | roberta release | chance | majority | cited leaders (AA article) |
|---|---|---|---|---|---|
| HLE-MultiChoice | 22.2% (n=500) | 19.8% | 22.9% | - | Jev 1.13: 21 |
| When2Call | 44.1% (n=1000) | 33.5% | 25.0% | - | Jev 1.13: 81; Celeris-1 Decision: 84 |
| WildGuardTest | 58.2% (n=1699) | 56.9% | 50.0% | 55.6% | Jev 1.13: 94; GLiDE: 95; Decider v1.1 27B: 94 |
| AA-Omniscience-Decision | not runnable (private) | not runnable | - | - | Jev 1.13: 35 (accuracy); d1 (Liquid AI): 41 |
WildGuardTest per-label recall: this model harmful 56.8% / unharmful 59.4% (balanced); roberta release harmful 30.6% / unharmful 77.8% (predicts "safe" for most prompts). Both runs classify the dataset's own prompt-harm labels; the AA article measures response safety - same public data, different protocol.
Caveats: HLE and WildGuardTest ran on public mirrors (the official repos are
Hub-gated), so those two are approximate; When2Call is the same public MCQ split
the article uses. Per-benchmark artifacts with full protocols live in eval_aa/.
Comparison with roberta-large-mnli-dynamic-labels
Same training recipe (template, caps protocol, readout), same machine (Apple M2 Pro, MPS, fp32), same eval protocols; both rows MEASURED, not cited.
| metric | this model | roberta release |
|---|---|---|
| params | 377.5M | 355.4M |
| training data | 19 datasets / 357,797 pairs / ~1 epoch | 16 datasets / ~462,000 pairs |
| tweet_eval overall accuracy | 0.649 | 0.515 |
| tweet_eval overall macro-F1 | 0.581 | 0.480 |
| tweet_eval emotion accuracy | 0.775 | 0.590 |
| tweet_eval sentiment accuracy | 0.523 | 0.440 |
| fitted calibration temperature | 2.148 | 5.355 |
| tweet_eval overall ECE at fitted T | 0.211 | 0.110 |
| go_emotions sample-F1 @0.5 | 0.451 | 0.151 |
| go_emotions precision@3 | 0.82 | 0.55 |
| S1MB full-suite overall (n=26,269) | 0.404 | 0.343 |
| S1MB choice (n=8,764) | 0.395 | 0.313 |
| S1MB score (n=5,148) | 0.325 | 0.149 |
| S1MB noul (n=12,357) | 0.442 | 0.446 |
| S1MB subsets won (of 106) | 64 (8 ties) | 34 |
| When2Call accuracy (n=1000) | 0.441 | 0.335 |
| HLE-MultiChoice accuracy (n=500) | 0.222 (chance) | 0.198 (below chance) |
| WildGuardTest accuracy (n=1699) | 0.582 | 0.569 |
| WildGuardTest harmful recall | 0.568 | 0.306 |
| latency, batch=1, 4 labels | 38.5 ms | 38.6 ms |
| latency, batch=32, 4 labels | 1142 ms | 841 ms |
Reading: the two models tie on single-pair latency and HLE (both ~chance), and the roberta release keeps two edges: it lands slightly better calibrated on the tweet_eval sample after aggressive flattening (ECE 0.110 vs 0.211, needing fitted T 5.355 vs 2.148) and it has higher batch throughput. This model wins the rest: +13.4 points tweet_eval overall, +6.0 points S1MB raw overall (64 of 106 subsets won, 8 ties), +8.1 choice and +17.6 score on S1MB decision types, ~3x multilabel sample-F1, +10.6 points When2Call, +26.2 points harmful recall. S1MB noul is the near-tie (0.442 vs 0.446), and both models sit far below the 72.9% majority baseline there, so abstention is the shared weak spot rather than a differentiator. Per-subset shape: this model dominates large-taxonomy intent subsets (clinc 0.775 vs 0.020, hwu64 0.840 vs 0.090, massive 0.785 vs 0.200, banking77 0.810 vs 0.420, mtop 0.725 vs 0.305), while the roberta release keeps the followir relevance family (news21 0.720 vs 0.305, robust04 0.745 vs 0.345, core17 0.700 vs 0.365) and patent_similarity (0.310 vs 0.030). The two latency rows were sampled at different premise lengths between the runs (63 vs 113 chars), so the batch=32 gap is directionally robust but its magnitude is approximate.
Quickstart
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import torch
model = AutoModelForSequenceClassification.from_pretrained('akshaymalik/ultrabert-380m-dynamic-labels', trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained('akshaymalik/ultrabert-380m-dynamic-labels', trust_remote_code=True)
id2label = model.config.id2label
ENTAIL_ID = next(k for k, v in id2label.items() if str(v).upper() == 'ENTAILMENT')
CONTRA_ID = next(k for k, v in id2label.items() if str(v).upper() == 'CONTRADICTION')
def build_prompt(text, hypothesis):
return (
'Text: ' + text.strip().replace('\n', ' ') + '\n'
'Hypothesis: ' + str(hypothesis).strip() + '\n'
'Verdict:'
)
def label_to_hypothesis(label):
return 'This text is about ' + str(label).strip().rstrip('.') + '.'
labels = ['sports', 'politics', 'finance']
text = 'The senate passed the budget after a late-night session.'
probs = []
for lab in labels:
enc = tokenizer(text, label_to_hypothesis(lab), return_tensors='pt',
truncation='longest_first', max_length=512)
with torch.no_grad():
logits = model(**enc).logits[0]
p = torch.softmax(torch.stack([logits[ENTAIL_ID], logits[CONTRA_ID]]), dim=0)[0]
probs.append(float(p))
print('multi-label raw P(entail):', dict(zip(labels, probs)))
import math
z = [math.log(p / (1 - p)) for p in probs] # per-label log-odds
q = torch.softmax(torch.tensor(z), dim=0)
print('single-label (calibrated):', dict(zip(labels, q.tolist())))
Limitations
- 512-token ceiling on the (text, hypothesis) pair; longer inputs are truncated.
- Softmax over the raw P(entailment) values is flat by construction (each P is bounded in [0,1]); use the log-odds softmax for single-label probabilities or raw P plus a threshold for multi-label, as in the quickstart.
- Calibration was fitted on ag_news / sst2 / banking77; expect worse calibration off-domain. The fitted temperature (2.148) applied uniformly hurts tweet_eval/emotion ECE slightly while helping sentiment.
- The 3-way tweet_eval/sentiment macro-F1 (0.254) shows single-label collapse toward one class on short 3-way sentiment; check per-class behavior before relying on it.
- Trained on 19 public datasets with varied licenses (see the table above); ANLI is CC BY-NC 4.0 and MS MARCO is non-commercial research only, so review before commercial use. Weights and card: MIT.
- English-centric training data.
trust_remote_code=Trueloads UltraBERT's Python modeling code (uploaded unchanged from the base release alongside the weights).- The base model is a raw 2T-token encoder: all NLI behavior here was taught by this fine-tune; no claim is made about the base model's own entailment ability.
- Both this model and the roberta release land far below the majority baseline on S1MB noul (abstention) rows (0.44 vs 0.73); abstention behavior is the weakest surface of the NLI readout in both releases.
- Latency was measured on a laptop GPU (Apple M2 Pro, fp32, MPS); it is not comparable to server-hardware numbers in cited leaderboards.
- Comparison numbers for other models are CITED from published tables; our numbers are raw accuracy with the NLI-hypothesis readout, which is not the readout S1MB leaderboard models use (option-letter logits).