CoolFace
Modelpublic

tasksource/ModernBERT-large-nli

sourceHugging Faceapache-2.0updated 2y agoView on Hugging Face
13likes19kdownloads
Model Card

Model Card for Model ID

This model is ModernBERT multi-task fine-tuned on tasksource NLI tasks, including MNLI, ANLI, SICK, WANLI, doc-nli, LingNLI, FOLIO, FOL-NLI, LogicNLI, Label-NLI and all datasets in the below table). This is the equivalent of an "instruct" version. The model was trained for 200k steps on an Nvidia A30 GPU.

It is very good at reasoning tasks (better than llama 3.1 8B Instruct on ANLI and FOLIO), long context reasoning, sentiment analysis and zero-shot classification with new labels.

The following table shows model test accuracy. These are the scores for the same single transformer with different classification heads on top. Further gains can be obtained by fine-tuning on a single-task, e.g. SST, but it this checkpoint is great for zero-shot classification and natural language inference (contradiction/entailment/neutral classification).

test_nametest_accuracy
glue/mnli0.89
glue/qnli0.96
glue/rte0.91
glue/wnli0.64
glue/mrpc0.81
glue/qqp0.87
glue/cola0.87
glue/sst20.96
super_glue/boolq0.66
super_glue/cb0.86
super_glue/multirc0.9
super_glue/wic0.71
super_glue/axg1
anli/a10.72
anli/a20.54
anli/a30.55
sick/label0.91
sick/entailment_AB0.93
snli0.94
scitail/snli_format0.95
hans1
WANLI0.77
recast/recast_ner0.85
recast/recast_sentiment0.97
recast/recast_verbnet0.89
recast/recast_megaveridicality0.87
recast/recast_verbcorner0.87
recast/recastkgrelations0.9
recast/recast_factuality0.95
recast/recast_puns0.98
probabilitywordsnli/reasoning_1hop1
probabilitywordsnli/usnli0.79
probabilitywordsnli/reasoning_2hop0.98
nan-nli0.85
nli_fever0.78
breaking_nli0.99
conj_nli0.72
fracas0.79
dialogue_nli0.94
mpe0.75
dnc0.91
recast_white/fnplus0.76
recast_white/sprl0.9
recast_white/dpr0.84
addonerte0.94
paws/labeled_final0.96
pragmeval/pdtb0.56
lex_glue/scotus0.58
lex_glue/ledgar0.85
dynasent/dynabench.dynasent.r1.all/r10.83
dynasent/dynabench.dynasent.r2.all/r20.76
cycic_classification0.96
lingnli0.91
monotonicity-entailment0.97
scinli0.88
naturallogic0.93
dynahate0.86
syntactic-augmentation-nli0.94
autotnli0.92
defeasible-nli/atomic0.83
defeasible-nli/snli0.8
help-nli0.96
nli-veridicality-transitivity0.99
lonli0.99
dadc-limit-nli0.79
folio0.71
tomi-nli0.54
puzzte0.59
temporal-nli0.93
counterfactually-augmented-snli0.81
cnli0.9
boolq-natural-perturbations0.72
equate0.65
logiqa-2.0-nli0.58
mindgames0.96
ConTRoL-nli0.66
logical-fallacy0.38
cladder0.89
conceptrules_v21
zero-shot-label-nli0.79
scone1
monli1
SpaceNLI1
propsegment/nli0.92
FLD.v2/default0.91
FLD.v2/star0.78
SDOH-NLI0.99
scifact_entailment0.87
feasibilityQA0.79
AdjectiveScaleProbe-nli1
resnli1
semanticfragmentsnli1
datasettrainnli0.95
nlgraph0.97
ruletaker0.99
PARARULE-Plus1
logical-entailment0.93
nope0.56
LogicNLI0.91
contract-nli/contractnli_a/seg0.88
contract-nli/contractnli_b/full0.84
nli4ct_semeval20240.72
biosift-nli0.92
SIGA-nli0.57
FOL-nli0.79
doc-nli0.81
mctest-nli0.92
natural-language-satisfiability0.92
idioms-nli0.83
lifecycle-entailment0.79
MSciNLI0.84
hover-3way/nli0.92
seahorsesummarizationevaluation0.81
missing-item-prediction/contrastive0.88
Pol_NLI0.93
synthetic-retrieval-NLI/count0.72
synthetic-retrieval-NLI/position0.9
synthetic-retrieval-NLI/binary0.92
babi_nli0.98

Usage

[ZS] Zero-shot classification pipeline

python
from transformers import pipeline
classifier = pipeline("zero-shot-classification",model="tasksource/ModernBERT-large-nli")

text = "one day I will see the world"
candidate_labels = ['travel', 'cooking', 'dancing']
classifier(text, candidate_labels)

NLI training data of this model includes label-nli, a NLI dataset specially constructed to improve this kind of zero-shot classification.

[NLI] Natural language inference pipeline

python
from transformers import pipeline
pipe = pipeline("text-classification",model="tasksource/ModernBERT-large-nli")
pipe([dict(text='there is a cat',
  text_pair='there is a black cat')]) #list of (premise,hypothesis)

Backbone for further fune-tuning

This checkpoint has stronger reasoning and fine-grained abilities than the base version and can be used for further fine-tuning.

Citation

@inproceedings{sileo-2024-tasksource,
    title = "tasksource: A Large Collection of {NLP} tasks with a Structured Dataset Preprocessing Framework",
    author = "Sileo, Damien",
    booktitle = "Proceedings of the 2024 Joint International Conference on Computational Linguistics, Language Resources and Evaluation (LREC-COLING 2024)",
    month = may,
    year = "2024",
    address = "Torino, Italia",
    publisher = "ELRA and ICCL",
    url = "https://aclanthology.org/2024.lrec-main.1361",
    pages = "15655--15684",
}