Help preserve open and free AI for humanity's future

← All models

MoritzLaurer_mDeBERTa-v3-base-mnli-xnli

MoritzLaurer · View on Hugging Face ↗

Multilingual NLI classifier (mDeBERTa v3 on XNLI/MNLI) for entailment and zero-shot classification.

✓ verified · rehash-vs-hf-metadata at 2026-08-24T11:05:50Z

mit1.06 GB (1,135,990,327 bytes)transformerspytorchonnxsafetensorsdeberta-v2text-classificationzero-shot-classificationnlimultilingualendpoints_compatible15 languages (en, ar, bg …)paper: 2111.09543paper: 1809.05053paper: 1911.02116

Get this model

Download MoritzLaurer_mDeBERTa-v3-base-mnli-xnli.torrent

Recommended — the .torrent carries the webseed url-list, so your client can fall back to plain HTTPS if the swarm is thin. See/verify for the full download + verification walkthrough.

Model card

The complete upstream card, rendered from this payload's README.md — the same hash-verified bytes the torrent distributes. Images and off-site links are removed; the original card on Hugging Face carries them.


language:

  • multilingual
  • en
  • ar
  • bg
  • de
  • el
  • es
  • fr
  • hi
  • ru
  • sw
  • th
  • tr
  • ur
  • vi
  • zh license: mit tags:
  • zero-shot-classification
  • text-classification
  • nli
  • pytorch metrics:
  • accuracy datasets:
  • multi_nli
  • xnli pipeline_tag: zero-shot-classification widget:
  • text: "Angela Merkel ist eine Politikerin in Deutschland und Vorsitzende der CDU" candidate_labels: "politics, economy, entertainment, environment"

Multilingual mDeBERTa-v3-base-mnli-xnli

Model description

This multilingual model can perform natural language inference (NLI) on 100 languages and is therefore also suitable for multilingual zero-shot classification. The underlying model was pre-trained by Microsoft on the CC100 multilingual dataset. It was then fine-tuned on the XNLI dataset, which contains hypothesis-premise pairs from 15 languages, as well as the English MNLI dataset. As of December 2021, mDeBERTa-base is the best performing multilingual base-sized transformer model, introduced by Microsoft in this paper.

If you are looking for a smaller, faster (but less performant) model, you can try multilingual-MiniLMv2-L6-mnli-xnli.

How to use the model

Simple zero-shot classification pipeline

from transformers import pipeline
classifier = pipeline("zero-shot-classification", model="MoritzLaurer/mDeBERTa-v3-base-mnli-xnli")

sequence_to_classify = "Angela Merkel ist eine Politikerin in Deutschland und Vorsitzende der CDU"
candidate_labels = ["politics", "economy", "entertainment", "environment"]
output = classifier(sequence_to_classify, candidate_labels, multi_label=False)
print(output)

NLI use-case

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

model_name = "MoritzLaurer/mDeBERTa-v3-base-mnli-xnli"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)

premise = "Angela Merkel ist eine Politikerin in Deutschland und Vorsitzende der CDU"
hypothesis = "Emmanuel Macron is the President of France"

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", "neutral", "contradiction"]
prediction = {name: round(float(pred) * 100, 1) for pred, name in zip(prediction, label_names)}
print(prediction)

Training data

This model was trained on the XNLI development dataset and the MNLI train dataset. The XNLI development set consists of 2490 professionally translated texts from English to 14 other languages (37350 texts in total) (see this paper). Note that the XNLI contains a training set of 15 machine translated versions of the MNLI dataset for 15 languages, but due to quality issues with these machine translations, this model was only trained on the professional translations from the XNLI development set and the original English MNLI training set (392 702 texts). Not using machine translated texts can avoid overfitting the model to the 15 languages; avoids catastrophic forgetting of the other 85 languages mDeBERTa was pre-trained on; and significantly reduces training costs.

Training procedure

mDeBERTa-v3-base-mnli-xnli was trained using the Hugging Face trainer with the following hyperparameters.

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

Eval results

The model was evaluated on the XNLI test set on 15 languages (5010 texts per language, 75150 in total). Note that multilingual NLI models are capable of classifying NLI texts without receiving NLI training data in the specific language (cross-lingual transfer). This means that the model is also able of doing NLI on the other 85 languages mDeBERTa was training on, but performance is most likely lower than for those languages available in XNLI.

Also note that if other multilingual models on the model hub claim performance of around 90% on languages other than English, the authors have most likely made a mistake during testing since non of the latest papers shows a multilingual average performance of more than a few points above 80% on XNLI (see here or here).

average ar bg de el en es fr hi ru sw th tr ur vi zh
0.808 0.802 0.829 0.825 0.826 0.883 0.845 0.834 0.771 0.813 0.748 0.793 0.807 0.740 0.795 0.8116

Limitations and bias

Please consult the original DeBERTa-V3 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 in late 2021 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 or higher might solve some issues. Note that mDeBERTa currently does not support FP16, see here: https://github.com/microsoft/DeBERTa/issues/77

Magnet link (secondary — no webseeds)

Opens the swarm directly, but carries no webseed url-list. Prefer the.torrent download above — HTTP fallback seeds ride inside it.

magnet:?xt=urn:btih:afea9875a9428af644f6b19262aa726c229d4dae&dn=MoritzLaurer_mDeBERTa-v3-base-mnli-xnli

Open magnet in torrent client · infohash afea9875a9428af644f6b19262aa726c229d4dae

Files & hashes

PathSizeMethodHash
README.md6.4 KB (6,514 B)sha1-git-blob79c1d900c4aa86ad9263c6eb90577608831d5468
added_tokens.json23 B (23 B)sha1-git-blobd8d263667449f525ae294e10a31b032d4b7eaf1b
config.json1.0 KB (1,066 B)sha1-git-blob25b875998a15441ca06ee6d96b4cae362514549d
model.safetensors531.8 MB (557,652,046 B)sha256-lfs65af59b1ff4450b09ecbf13ca35c840dbf038b26ff8e10e5ea89ca724828ed1e
pytorch_model.bin531.9 MB (557,692,715 B)sha256-lfs345f880b8390c64336cb9fd2907544fc02418bc4e97a74d5952b26b82bfb6f74
special_tokens_map.json286 B (286 B)sha1-git-blob2c9cb07c8fdeeb5ac3ceafb170592e990b204dcd
spm.model4.1 MB (4,305,025 B)sha256-lfs13c8d666d62a7bc4ac8f040aab68e942c861f93303156cc28f5c7e885d86d6e3
tokenizer.json15.6 MB (16,331,396 B)sha256-lfs3aca3ce69a0a35aeb144a52c4f1d41c4246b8785f8f398315cc8fb6b24057810
tokenizer_config.json1.2 KB (1,256 B)sha1-git-blob173d68ceeb1e02125bda27f0867401b1deaad258

Provenance

Upstream repositoryMoritzLaurer/mDeBERTa-v3-base-mnli-xnli
Revision (pinned)8adb042d524ecd5c26d3e3ba0e3fbcf7e2d0864c
Fetched at2026-08-24T11:05:11Z
License at fetchmit
Snapshot toolhuggingface · seedbank 0.1.0

Trackers

Webseeds