SAVRN
Search Contact SAVRN

Open-weight model · Zero-shot classification

scandi-nli-large

by Alexandra Institute alexandrainst/scandi-nli-large

This model is a fine-tuned version of NbAiLab/nb-bert-large for Natural Language Inference in Danish, Norwegian Bokmål and Swedish.

Parameters355M
Context512
Weights2.8 GB
Licenseapache-2.0
AccessOpen weights
Monthly Downloads20.4k

Runs On

What it takes to serve scandi-nli-large (355M 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.7 GB 0.9 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00
8-bit 0.4 GB 0.4 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00
4-bit 0.2 GB 0.2 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 Alexandra Institute, published under apache-2.0, revision 0dd119b11f28.

This model is a fine-tuned version of NbAiLab/nb-bert-large for Natural Language Inference in Danish, Norwegian Bokmål and Swedish. We have released three models for Scandinavian NLI, of different sizes: - alexandrainst/scandi-nli-large (this) A demo of the large-v2 model can be found in this Hugging Face Space - check it out! The performance and model size of each of them can be found in the Performance section below. You can use this model in your scripts as follows: We assess the models both on their aggregate Scandinavian performance, as well as their language-specific Danish, Swedish and Norwegian Bokmål performance. In all cases, we report Matthew's Correlation Coefficient (MCC)…

Read Alexandra Institute's full model card

ScandiNLI - Natural Language Inference model for Scandinavian Languages

This model is a fine-tuned version of NbAiLab/nb-bert-large for Natural Language Inference in Danish, Norwegian Bokmål and Swedish.

We have released three models for Scandinavian NLI, of different sizes:

A demo of the large-v2 model can be found in this Hugging Face Space - check it out!

The performance and model size of each of them can be found in the Performance section below.

Quick start

You can use this model in your scripts as follows:

>>> from transformers import pipeline
>>> classifier = pipeline(
...     "zero-shot-classification",
...     model="alexandrainst/scandi-nli-large",
... )
>>> classifier(
...     "Mexicansk bokser advarer Messi - 'Du skal bede til gud, om at jeg ikke finder dig'",
...     candidate_labels=['sundhed', 'politik', 'sport', 'religion'],
...     hypothesis_template="Dette eksempel handler om {}",
... )
{'sequence': "Mexicansk bokser advarer Messi - 'Du skal bede til gud, om at jeg ikke finder dig'",
 'labels': ['sport', 'religion', 'politik', 'sundhed'],
 'scores': [0.6134647727012634,
  0.30309760570526123,
  0.05021871626377106,
  0.03321893885731697]}

Performance

We assess the models both on their aggregate Scandinavian performance, as well as their language-specific Danish, Swedish and Norwegian Bokmål performance.

In all cases, we report Matthew's Correlation Coefficient (MCC), macro-average F1-score as well as accuracy.

Scandinavian Evaluation

The Scandinavian scores are the average of the Danish, Swedish and Norwegian scores, which can be found in the sections below.

Model MCC Macro-F1 Accuracy Number of Parameters
alexandrainst/scandi-nli-large-v2 75.42% 75.41% 84.95% 354M
alexandrainst/scandi-nli-large (this) 73.70% 74.44% 83.91% 354M
MoritzLaurer/mDeBERTa-v3-base-xnli-multilingual-nli-2mil7 69.01% 71.99% 80.66% 279M
alexandrainst/scandi-nli-base 67.42% 71.54% 80.09% 178M
joeddav/xlm-roberta-large-xnli 64.17% 70.80% 77.29% 560M
MoritzLaurer/mDeBERTa-v3-base-mnli-xnli 63.94% 70.41% 77.23% 279M
NbAiLab/nb-bert-base-mnli 61.71% 68.36% 76.08% 178M
alexandrainst/scandi-nli-small 56.02% 65.30% 73.56% 22M

Danish Evaluation

We use a test split of the DanFEVER dataset to evaluate the Danish performance of the models.

The test split is generated using this gist.

Model MCC Macro-F1 Accuracy Number of Parameters
alexandrainst/scandi-nli-large-v2 75.65% 59.23% 87.89% 354M
alexandrainst/scandi-nli-large (this) 73.80% 58.41% 86.98% 354M
MoritzLaurer/mDeBERTa-v3-base-xnli-multilingual-nli-2mil7 68.37% 57.10% 83.25% 279M
alexandrainst/scandi-nli-base 62.44% 55.00% 80.42% 178M
NbAiLab/nb-bert-base-mnli 56.92% 53.25% 76.39% 178M
MoritzLaurer/mDeBERTa-v3-base-mnli-xnli 52.79% 52.00% 72.35% 279M
joeddav/xlm-roberta-large-xnli 49.18% 50.31% 69.73% 560M
alexandrainst/scandi-nli-small 47.28% 48.88% 73.46% 22M

Swedish Evaluation

We use the test split of the machine translated version of the MultiNLI dataset to evaluate the Swedish performance of the models.

We acknowledge that not evaluating on a gold standard dataset is not ideal, but unfortunately we are not aware of any NLI datasets in Swedish.

Model MCC Macro-F1 Accuracy Number of Parameters
alexandrainst/scandi-nli-large-v2 79.02% 85.99% 85.99% 354M
alexandrainst/scandi-nli-large (this) 76.69% 84.47% 84.38% 354M
joeddav/xlm-roberta-large-xnli 75.35% 83.42% 83.55% 560M
MoritzLaurer/mDeBERTa-v3-base-mnli-xnli 73.84% 82.46% 82.58% 279M
MoritzLaurer/mDeBERTa-v3-base-xnli-multilingual-nli-2mil7 73.32% 82.15% 82.08% 279M
alexandrainst/scandi-nli-base 72.29% 81.37% 81.51% 178M
NbAiLab/nb-bert-base-mnli 64.69% 76.40% 76.47% 178M
alexandrainst/scandi-nli-small 62.35% 74.79% 74.93% 22M

Norwegian Evaluation

We use the test split of the machine translated version of the MultiNLI dataset to evaluate the Norwegian performance of the models.

We acknowledge that not evaluating on a gold standard dataset is not ideal, but unfortunately we are not aware of any NLI datasets in Norwegian.

Model MCC Macro-F1 Accuracy Number of Parameters
alexandrainst/scandi-nli-large-v2 71.59% 81.00% 80.96% 354M
alexandrainst/scandi-nli-large (this) 70.61% 80.43% 80.36% 354M
joeddav/xlm-roberta-large-xnli 67.99% 78.68% 78.60% 560M
alexandrainst/scandi-nli-base 67.53% 78.24% 78.33% 178M
MoritzLaurer/mDeBERTa-v3-base-xnli-multilingual-nli-2mil7 65.33% 76.73% 76.65% 279M
MoritzLaurer/mDeBERTa-v3-base-mnli-xnli 65.18% 76.76% 76.77% 279M
NbAiLab/nb-bert-base-mnli 63.51% 75.42% 75.39% 178M
alexandrainst/scandi-nli-small 58.42% 72.22% 72.30% 22M

Training procedure

It has been fine-tuned on a dataset composed of DanFEVER as well as machine translated versions of MultiNLI and CommitmentBank into all three languages, and machine translated versions of FEVER and Adversarial NLI into Swedish.

The training split of DanFEVER is generated using this gist.

The three languages are sampled equally during training, and they're validated on validation splits of DanFEVER and machine translated versions of MultiNLI for Swedish and Norwegian Bokmål, sampled equally.

Check out the Github repository for the code used to train the ScandiNLI models, and the full training logs can be found in this Weights and Biases report.

Training hyperparameters

The following hyperparameters were used during training: - learning_rate: 2e-05 - train_batch_size: 2 - eval_batch_size: 2 - seed: 4242 - gradient_accumulation_steps: 16 - total_train_batch_size: 32 - optimizer: Adam with betas=(0.9, 0.999) and epsilon=1e-08 - lr_scheduler_type: linear - lr_scheduler_warmup_steps: 500 - max_steps: 50,000

Configuration

Architecture
BertForSequenceClassification
Context length (tokens)
512
Layers
24
Hidden size
1,024
Feed-forward size
4,096
Attention heads
16
Vocabulary size
50,000
Stored precision
float32
Model type
bert

Identity and Version

Repository
alexandrainst/scandi-nli-large
Publisher
Alexandra Institute
Task
Zero-shot classification
Modality
Text
Library
transformers
Parameters
355M parameters
Languages
da, no, nb, sv
Revision
0dd119b11f28ce7cf780429ea4ca86e5c0faa7f9
First published
2022-11-28
Last updated
2025-04-25

Files and Weights

9 files, 2.8 GB in total. The weights are 2 files totalling 2.8 GB in bin, safetensors.

Weights2 files · 2.8 GB
Configuration2 files · 1.1 KB
Tokenizer3 files · 1.6 MB
Documentation1 file · 10.4 KB
Repository1 file · 1.5 KB
Every file
FileTypeSizeSHA-256
model.safetensorsWeights1.4 GB cb8450b9d181
pytorch_model.binWeights1.4 GB 0b1d0cc9bac9
config.jsonConfiguration933 B
special_tokens_map.jsonConfiguration125 B
README.mdDocumentation10.4 KB
.gitattributesRepository1.5 KB
tokenizer.jsonTokenizer1.2 MB
tokenizer_config.jsonTokenizer405 B
vocab.txtTokenizer395.1 KB

License and Download

License
apache-2.0
Access
Open weights, no gate
Download size
2.8 GB
Download from Alexandra Institute

Released by Alexandra Institute through its official repository on Hugging Face. Read the license.

Built From

  • Derived from NbAiLab/nb-bert-large
  • Trained on (disclosed) KBLab/overlim
  • Trained on (disclosed) MoritzLaurer/multilingual-NLI-26lang-2mil7
  • Trained on (disclosed) strombergnlp/danfever

Memory Requirements

PrecisionWeights in memory
As published2.8 GB
16-bit0.7 GB
8-bit0.4 GB
4-bit0.2 GB

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

Questions About scandi-nli-large

How much GPU memory does scandi-nli-large need?

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

What is the cheapest GPU to run scandi-nli-large 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 scandi-nli-large commercially?

Yes. scandi-nli-large is released under Apache License 2.0. The Apache License 2.0 is a permissive open-source license. It permits commercial use, modification and redistribution. It requires keeping the license and copyright notices and any NOTICE file, stating significant changes, and it includes an express patent grant from contributors.

What is scandi-nli-large's context length?

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

Similar Models

Model · Zero-shot classification

ModernBERT-large-nli

Tasksource

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.…

Open weights apache-2.0 396M parameters 2,048 tokens transformers

Model · Zero-shot classification

finecat-nli-l

Lee Miller

This model is a fine-tune of the excellent tasksource/ModernBERT-large-nli, trained on the dleemiller/FineCat-NLI dataset—a compilation of several high-quality NLI data sources with quality screening and reduction of easy samples in the training split. The training also incorporates logit distillation from MoritzLaurer/DeBERTa-v3-large-mnli-fever-anli-ling-wanli, a top-performing NLI model, particularly on ANLI benchmarks. \begin{equation} \mathcal{L} = \alpha \cdot \mathcal{L}{\text{CE}}(z^{(s)}, y) + \beta \cdot \mathcal{L}{\text{MSE}}(z^{(s)}, z^{(t)}) \end{equation} where \\(z^{(s)}\\) and \\(z^{(t)}\\) are the student and teacher logits, \\(y\\) are the ground truth labels, and…

Open weights 396M parameters 2,048 tokens sentence-transformers

Model · Zero-shot classification

gliner-guard-omni

HiveTraceLab

One encoder model that replaces your entire guardrail stack: safety classification, PII detection, adversarial attack detection, intent and tone analysis — all in a single forward classification, NER and more · no LLM required Install dependencies Classify Harmful messages and Detect PII via single forward pass GLiNER Guard Omni fine-tunes fastino/gliner2-multi-v1 on our guardrail taxonomy while preserving its multilingual zero-shot generalization. You get GLiNER Guard's safety understanding on top of the base model's ability to handle labels and domains beyond the training set — so you can define custom policies with nothing but natural language descriptions. For specific usecases you can…

Open weights apache-2.0 307M parameters gliner2

Model · Zero-shot classification

bart-large-mnli-yahoo-answers

Joe Davison

This model takes facebook/bart-large-mnli and fine-tunes it on Yahoo Answers topic classification. It can be used to predict whether a topic label can be assigned to a given sequence, whether or not the label has been seen before. You can play with an interactive demo of this zero-shot technique with this model, as well as the non-finetuned facebook/bart-large-mnli, here. This model was fine-tuned on topic classification and will perform best at zero-shot topic classification. Use hypothesistemplate="This text is about {}." as this is the template used during fine-tuning. For settings other than topic classification, you can use any model pre-trained on MNLI such as facebook/bart-large-mnli…

Open weights apache-2.0 407M parameters 1,024 tokens transformers

Model · Zero-shot classification

bart-large-mnli

AI at Meta

This is the checkpoint for bart-large after being trained on the MultiNLI (MNLI) dataset. - The bart-large model page - BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension Yin et al. proposed a method for using pre-trained NLI models as a ready-made zero-shot sequence classifiers. The method works by posing the sequence to be classified as the NLI premise and to construct a hypothesis from each candidate label. For example, if we want to evaluate whether a sequence belongs to the class "politics", we could construct a hypothesis of This text is about politics.. The probabilities for entailment and contradiction are then converted…

Open weights mit 407M parameters 1,024 tokens transformers

This multilingual model can perform natural language inference (NLI) on 100 languages and is therefore also suitable for multilingual zero-shot classification. The underlying mDeBERTa-v3-base model was pre-trained by Microsoft on the CC100 multilingual dataset with 100 languages. The model was then fine-tuned on the XNLI dataset and on the multilingual-NLI-26lang-2mil7 dataset. Both datasets contain more than 2.7 million hypothesis-premise pairs in 27 languages spoken by more than 4 billion people. As of December 2021, mDeBERTa-v3-base is the best performing multilingual base-sized transformer model introduced by Microsoft in this paper. This model was trained on the…

Open weights mit 279M parameters 512 tokens transformers