SAVRN
Search Contact SAVRN

Open-weight model · Zero-shot classification

DeBERTa-v3-xsmall-mnli-fever-anli-ling-binary

by Moritz Borrett-Laurer (formerly Laurer) MoritzLaurer/DeBERTa-v3-xsmall-mnli-fever-anli-ling-binary

This model was trained on 782 357 hypothesis-premise pairs from 4 NLI datasets: MultiNLI, Fever-NLI, LingNLI and ANLI. Note that the model was trained on binary NLI to predict either "entailment" or "not-entailment".

Parameters71M
Context512
Weights938.2 MB
Licensemit
AccessOpen weights
Monthly Downloads17.8k

Runs On

What it takes to serve DeBERTa-v3-xsmall-mnli-fever-anli-ling-binary (71M parameters): the memory its weights need at each precision, and the cheapest way to rent enough data-center GPUs to hold them.

PrecisionWeightsMemory neededCheapest setupPer hourAlso fits
16-bit 0.1 GB 0.2 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00
8-bit 0.1 GB 0.1 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00
4-bit 0.0 GB 0.0 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00

Memory is the weights at that precision plus 20% for the runtime and a short context; a long context needs more. Prices are the lowest on-demand hourly rates in the SAVRN Index, read Sep 18, 2026.

Model Card

By Moritz Borrett-Laurer (formerly Laurer), published under mit, revision b80e2b321919.

This model was trained on 782 357 hypothesis-premise pairs from 4 NLI datasets: MultiNLI, Fever-NLI, LingNLI and ANLI. Note that the model was trained on binary NLI to predict either "entailment" or "not-entailment". This is specifically designed for zero-shot classification, where the difference between "neutral" and "contradiction" is irrelevant. The base model is DeBERTa-v3-xsmall from Microsoft. The v3 variant of DeBERTa substantially outperforms previous versions of the model by including a different pre-training objective, see the DeBERTa-V3 paper. For highest performance (but less speed), I recommend using…

Read Moritz Borrett-Laurer (formerly Laurer)'s full model card

Model description

This model was trained on 782 357 hypothesis-premise pairs from 4 NLI datasets: MultiNLI, Fever-NLI, LingNLI and ANLI.

Note that the model was trained on binary NLI to predict either "entailment" or "not-entailment". This is specifically designed for zero-shot classification, where the difference between "neutral" and "contradiction" is irrelevant.

The base model is DeBERTa-v3-xsmall from Microsoft. The v3 variant of DeBERTa substantially outperforms previous versions of the model by including a different pre-training objective, see the DeBERTa-V3 paper.

For highest performance (but less speed), I recommend using https://huggingface.co/MoritzLaurer/DeBERTa-v3-large-mnli-fever-anli-ling-wanli.

Intended uses & limitations

How to use the model

from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")

model_name = "MoritzLaurer/DeBERTa-v3-xsmall-mnli-fever-anli-ling-binary"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)

premise = "I first thought that I liked the movie, but upon second thought it was actually disappointing."
hypothesis = "The movie was good."

input = tokenizer(premise, hypothesis, truncation=True, return_tensors="pt")
output = model(input["input_ids"].to(device))  # device = "cuda:0" or "cpu"
prediction = torch.softmax(output["logits"][0], -1).tolist()
label_names = ["entailment", "not_entailment"]
prediction = {name: round(float(pred) * 100, 1) for pred, name in zip(prediction, label_names)}
print(prediction)

Training data

This model was trained on 782 357 hypothesis-premise pairs from 4 NLI datasets: MultiNLI, Fever-NLI, LingNLI and ANLI.

Training procedure

DeBERTa-v3-xsmall-mnli-fever-anli-ling-binary was trained using the Hugging Face trainer with the following hyperparameters.

training_args = TrainingArguments(
    num_train_epochs=5,              # total number of training epochs
    learning_rate=2e-05,
    per_device_train_batch_size=32,   # batch size per device during training
    per_device_eval_batch_size=32,    # batch size for evaluation
    warmup_ratio=0.1,                # number of warmup steps for learning rate scheduler
    weight_decay=0.06,               # strength of weight decay
    fp16=True                        # mixed precision training
)

Eval results

The model was evaluated using the binary test sets for MultiNLI, ANLI, LingNLI and the binary dev set for Fever-NLI (two classes instead of three). The metric used is accuracy.

dataset mnli-m-2c mnli-mm-2c fever-nli-2c anli-all-2c anli-r3-2c lingnli-2c
accuracy 0.925 0.922 0.892 0.676 0.665 0.888
speed (text/sec, CPU, 128 batch) 6.0 6.3 3.0 5.8 5.0 7.6
speed (text/sec, GPU Tesla P100, 128 batch) 473 487 230 390 340 586

Limitations and bias

Please consult the original DeBERTa paper and literature on different NLI datasets for potential biases.

Citation

If you use this model, please cite: Laurer, Moritz, Wouter van Atteveldt, Andreu Salleras Casas, and Kasper Welbers. 2022. ‘Less Annotating, More Classifying – Addressing the Data Scarcity Issue of Supervised Machine Learning with Deep Transfer Learning and BERT - NLI’. Preprint, June. Open Science Framework. https://osf.io/74b8k.

Ideas for cooperation or questions?

If you have questions or ideas for cooperation, contact me at m{dot}laurer{at}vu{dot}nl or LinkedIn

Debugging and issues

Note that DeBERTa-v3 was released on 06.12.21 and older versions of HF Transformers seem to have issues running the model (e.g. resulting in an issue with the tokenizer). Using Transformers>=4.13 might solve some issues.

Configuration

Architecture
DebertaV2ForSequenceClassification
Context length (tokens)
512
Layers
12
Hidden size
384
Feed-forward size
1,536
Attention heads
6
Vocabulary size
128,100
Stored precision
float32
Model type
deberta-v2

Identity and Version

Repository
MoritzLaurer/DeBERTa-v3-xsmall-mnli-fever-anli-ling-binary
Publisher
Moritz Borrett-Laurer (formerly Laurer)
Task
Zero-shot classification
Modality
Text
Library
transformers
Parameters
71M parameters
Languages
en
Revision
b80e2b3219194b8685948dedfb73d594ed088732
First published
2022-03-02
Last updated
2024-04-11

Files and Weights

12 files, 949.3 MB in total. The weights are 4 files totalling 938.2 MB in bin, onnx, safetensors.

Weights4 files · 938.2 MB
Configuration3 files · 1.3 KB
Tokenizer2 files · 8.7 MB
Documentation1 file · 4.7 KB
Other1 file · 2.5 MB
Repository1 file · 1.2 KB
Every file
FileTypeSizeSHA-256
model.safetensorsWeights283.4 MB 644a8866c06b
onnx/model.onnxWeights284.2 MB 7a0a3d4e02a3
onnx/model_quantized.onnxWeights87.2 MB 7a2d2f5608a8
pytorch_model.binWeights283.4 MB fcbbda79f878
added_tokens.jsonConfiguration18 B
config.jsonConfiguration1.1 KB
special_tokens_map.jsonConfiguration156 B
README.mdDocumentation4.7 KB
spm.modelOther2.5 MB c679fbf93643
.gitattributesRepository1.2 KB
tokenizer.jsonTokenizer8.7 MB
tokenizer_config.jsonTokenizer488 B

License and Download

License
mit
Access
Open weights, no gate
Download size
938.2 MB
Download from Moritz Borrett-Laurer (formerly Laurer)

Released by Moritz Borrett-Laurer (formerly Laurer) through its official repository on Hugging Face. Read the license.

Built From

Memory Requirements

PrecisionWeights in memory
As published938.2 MB
16-bit0.1 GB
8-bit0.1 GB
4-bit0.0 GB

Weights only, from the published parameter count; the key-value cache and runtime add to this.

Questions About DeBERTa-v3-xsmall-mnli-fever-anli-ling-binary

How much GPU memory does DeBERTa-v3-xsmall-mnli-fever-anli-ling-binary need?

About 0.2 GB at 16-bit and 0 GB at 4-bit: the weights (71M parameters) plus a working margin. A long context needs more.

What is the cheapest GPU to run DeBERTa-v3-xsmall-mnli-fever-anli-ling-binary on?

At 16-bit, 1x MI300X from $1.85 an hour; at 4-bit, 1x MI300X from $1.85 an hour, at the lowest on-demand prices the SAVRN Index lists.

Can I use DeBERTa-v3-xsmall-mnli-fever-anli-ling-binary commercially?

Yes. DeBERTa-v3-xsmall-mnli-fever-anli-ling-binary is released under MIT License. The MIT License is a short permissive license. It permits commercial use, modification and redistribution, provided the copyright notice and permission notice are included.

What is DeBERTa-v3-xsmall-mnli-fever-anli-ling-binary's context length?

512 tokens, from the maximum position embeddings in its published configuration.

Similar Models

This model was trained using SentenceTransformers Cross-Encoder class. This model is based on microsoft/deberta-v3-xsmall The model was trained on the SNLI and MultiNLI datasets. For a given sentence pair, it will output three scores corresponding to the labels: contradiction, entailment, neutral. For futher evaluation results, see SBERT.net - Pretrained Cross-Encoder. Pre-trained models can be used like this: You can use the model also directly with Transformers library (without SentenceTransformers library): This model can also be used for zero-shot-classification

Open weights apache-2.0 71M parameters 512 tokens sentence-transformers

This model was fine-tuned using the same pipeline as described in the model card for MoritzLaurer/deberta-v3-large-zeroshot-v1.1-all-33 and in this paper. The foundation model is microsoft/deberta-v3-xsmall. The model only has 22 million backbone parameters and 128 million vocabulary parameters. The backbone parameters are the main parameters active during inference, providing a significant speedup over larger models. The model is 142 MB small. This model was trained to provide a small and highly efficient zeroshot option, especially for edge devices or in-browser use-cases with transformers.js. For usage instructions and other details refer to this model card…

Open weights mit 71M parameters 512 tokens transformers

Model · Zero-shot classification

distilbert-base-uncased-mnli

Typeform

This is the uncased DistilBERT model fine-tuned on Multi-Genre Natural Language Inference (MNLI) dataset for the zero-shot classification task. This model can be used for text classification tasks. CONTENT WARNING: Readers should be aware this section contains content that is disturbing, offensive, and can propagate historical and current stereotypes. Significant research has explored bias and fairness issues with language models (see, e.g., Sheng et al. (2021) and Bender et al. (2021)). This model of DistilBERT-uncased is pretrained on the Multi-Genre Natural Language Inference (MultiNLI) corpus. It is a crowd-sourced collection of 433k sentence pairs annotated with textual entailment…

Open weights 67M parameters 512 tokens transformers

This model was trained using SentenceTransformers Cross-Encoder class. The model was trained on the SNLI and MultiNLI datasets. For a given sentence pair, it will output three scores corresponding to the labels: contradiction, entailment, neutral. For evaluation results, see SBERT.net - Pretrained Cross-Encoder. Pre-trained models can be used like this: You can use the model also directly with Transformers library (without SentenceTransformers library): This model can also be used for zero-shot-classification

Open weights apache-2.0 82M parameters 514 tokens sentence-transformers

This model was trained using SentenceTransformers Cross-Encoder class. The model was trained on the SNLI and MultiNLI datasets. For a given sentence pair, it will output three scores corresponding to the labels: contradiction, entailment, neutral. For evaluation results, see SBERT.net - Pretrained Cross-Encoder. Pre-trained models can be used like this: You can use the model also directly with Transformers library (without SentenceTransformers library): This model can also be used for zero-shot-classification

Open weights apache-2.0 82M parameters 514 tokens sentence-transformers

multilingual - zero-shot-classification - text-classification - nli - pytorch - accuracy - multinli - xnli pipelinetag: zero-shot-classification candidatelabels: "politics, economy, entertainment, environment" This multilingual model can perform natural language inference (NLI) on 100+ languages and is therefore also suitable for multilingual zero-shot classification. The underlying multilingual-MiniLM-L6 model was created by Microsoft and was distilled from XLM-RoBERTa-large (see details in the original paper and newer information in this repo). The model was then fine-tuned on the XNLI dataset, which contains hypothesis-premise pairs from 15 languages, as well as the English MNLI dataset.…

Open weights mit 107M parameters 514 tokens transformers