SAVRN
Search Contact SAVRN

Open-weight model · Zero-shot classification

nli-roberta-base

by Sentence Transformers - Cross-Encoders cross-encoder/nli-roberta-base

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.

Parameters125M
Context514
Weights4.9 GB
Licenseapache-2.0
AccessOpen weights
Monthly Downloads7k

Runs On

What it takes to serve nli-roberta-base (125M 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.2 GB 0.3 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.1 GB 0.1 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 Sentence Transformers - Cross-Encoders, published under apache-2.0, revision 1be0567456f0.

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

Read Sentence Transformers - Cross-Encoders's full model card

Cross-Encoder for Natural Language Inference

This model was trained using SentenceTransformers Cross-Encoder class.

Training Data

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.

Performance

For evaluation results, see SBERT.net - Pretrained Cross-Encoder.

Usage

Pre-trained models can be used like this:

from sentence_transformers import CrossEncoder
model = CrossEncoder('cross-encoder/nli-roberta-base')
scores = model.predict([('A man is eating pizza', 'A man eats something'), ('A black race car starts up in front of a crowd of people.', 'A man is driving down a lonely road.')])

#Convert scores to labels
label_mapping = ['contradiction', 'entailment', 'neutral']
labels = [label_mapping[score_max] for score_max in scores.argmax(axis=1)]

Usage with Transformers AutoModel

You can use the model also directly with Transformers library (without SentenceTransformers library):

from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch

model = AutoModelForSequenceClassification.from_pretrained('cross-encoder/nli-roberta-base')
tokenizer = AutoTokenizer.from_pretrained('cross-encoder/nli-roberta-base')

features = tokenizer(['A man is eating pizza', 'A black race car starts up in front of a crowd of people.'], ['A man eats something', 'A man is driving down a lonely road.'],  padding=True, truncation=True, return_tensors="pt")

model.eval()
with torch.no_grad():
    scores = model(**features).logits
    label_mapping = ['contradiction', 'entailment', 'neutral']
    labels = [label_mapping[score_max] for score_max in scores.argmax(dim=1)]
    print(labels)

Zero-Shot Classification

This model can also be used for zero-shot-classification:

from transformers import pipeline

classifier = pipeline("zero-shot-classification", model='cross-encoder/nli-roberta-base')

sent = "Apple just announced the newest iPhone X"
candidate_labels = ["technology", "sports", "politics"]
res = classifier(sent, candidate_labels)
print(res)

Configuration

Architecture
RobertaForSequenceClassification
Context length (tokens)
514
Layers
12
Hidden size
768
Feed-forward size
3,072
Attention heads
12
Vocabulary size
50,265
Model type
roberta

Identity and Version

Repository
cross-encoder/nli-roberta-base
Publisher
Sentence Transformers - Cross-Encoders
Task
Zero-shot classification
Modality
Text
Library
sentence-transformers
Parameters
125M parameters
Languages
en
Revision
1be0567456f0543475805e758725f151f283705a
First published
2022-03-02
Last updated
2025-04-11

Files and Weights

25 files, 4.9 GB in total. The weights are 14 files totalling 4.9 GB in bin, msgpack, onnx, safetensors.

Weights14 files · 4.9 GB
Configuration2 files · 1.7 KB
Tokenizer4 files · 4.8 MB
Documentation1 file · 2.7 KB
Other3 files · 1.1 MB
Repository1 file · 445 B
Every file
FileTypeSizeSHA-256
flax_model.msgpackWeights498.6 MB 3ad22f6bb3aa
model.safetensorsWeights498.6 MB efc90996d2ed
onnx/model.onnxWeights498.9 MB 50dbf8939f1f
onnx/model_O1.onnxWeights498.8 MB 8fa0c1aee4f3
onnx/model_O2.onnxWeights498.6 MB 54ec3f780c5e
onnx/model_O3.onnxWeights498.6 MB a9f3e5c35fe5
onnx/model_O4.onnxWeights249.5 MB 83dda61de01e
onnx/model_qint8_arm64.onnxWeights126.0 MB 8fef91c2f379
onnx/model_qint8_avx512.onnxWeights126.0 MB 8fef91c2f379
onnx/model_qint8_avx512_vnni.onnxWeights126.0 MB 8fef91c2f379
onnx/model_quint8_avx2.onnxWeights126.0 MB 0243ee7d1d5a
openvino/openvino_model.binWeights498.6 MB 3790d001dc4b
openvino/openvino_model_qint8_quantized.binWeights125.8 MB f33639cd4bf6
pytorch_model.binWeights498.7 MB 841b6e05e67f
config.jsonConfiguration702 B
special_tokens_map.jsonConfiguration1.0 KB
README.mdDocumentation2.7 KB
CESoftmaxAccuracyEvaluator_AllNLI-dev_results.csvOther337 B
openvino/openvino_model.xmlOther390.1 KB
openvino/openvino_model_qint8_quantized.xmlOther711.5 KB
.gitattributesRepository445 B
merges.txtTokenizer456.3 KB
tokenizer.jsonTokenizer3.6 MB
tokenizer_config.jsonTokenizer1.3 KB
vocab.jsonTokenizer798.3 KB

License and Download

License
apache-2.0
Access
Open weights, no gate
Download size
4.9 GB
Download from Sentence Transformers - Cross-Encoders

Released by Sentence Transformers - Cross-Encoders through its official repository on Hugging Face. Read the license.

Built From

Memory Requirements

PrecisionWeights in memory
As published4.9 GB
16-bit0.2 GB
8-bit0.1 GB
4-bit0.1 GB

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

Questions About nli-roberta-base

How much GPU memory does nli-roberta-base need?

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

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

Yes. nli-roberta-base 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 nli-roberta-base's context length?

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

Similar Models

Models in this series are designed for efficient zeroshot classification with the Hugging Face pipeline. These models can do classification without training data and run on both GPUs and CPUs. An overview of the latest zeroshot classifiers is available in my Zeroshot Classifier Collection. The main update of this zeroshot-v2.0 series of models is that several models are trained on fully commercially-friendly data for users with strict license requirements. These models can do one universal classification task: determine whether a hypothesis is "true" or "not true" given a text (entailment vs. notentailment). This task format is based on the Natural Language Inference task (NLI). The task is…

Open weights mit 125M parameters 514 tokens 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-L12 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…

Open weights mit 118M parameters 514 tokens transformers

Model · Zero-shot classification

nli-deberta-base

Sentence Transformers - Cross-Encoders

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 139M parameters 512 tokens sentence-transformers

Model · Zero-shot classification

bert-base-spanish-wwm-cased-xnli

Recognai

UPDATE, 15.10.2021: Check out our new zero-shot classifiers, much more lightweight and even outperforming this one: zero-shot SELECTRA small and zero-shot SELECTRA medium. This model is a fine-tuned version of the spanish BERT model with the Spanish portion of the XNLI dataset. You can have a look at the training script for details of the training. You can use this model with Hugging Face's zero-shot-classification pipeline

Open weights mit 110M parameters 512 tokens transformers

Model · Zero-shot classification

deberta-small-long-nli

Tasksource

DeBERTa-v3-small with context length of 1680 tokens fine-tuned on tasksource for 250k steps. I oversampled long NLI tasks (ConTRoL, doc-nli). Training data include HelpSteer v1/v2, logical reasoning tasks (FOLIO, FOL-nli, LogicNLI...), OASST, hh/rlhf, linguistics oriented NLI tasks, tasksource-dpo, fact verification tasks. This model is suitable for long context NLI or as a backbone for reward models or classifiers fine-tuning. This checkpoint has strong zero-shot validation performance on many tasks (e.g. 70% on WNLI), and can be used for: - Zero-shot entailment-based classification for arbitrary labels [ZS]. - Natural language inference [NLI] - Further fine-tuning on a new task or…

Open weights apache-2.0 142M parameters 1,680 tokens transformers

This model was trained using SentenceTransformers Cross-Encoder class. This model is based on microsoft/deberta-v3-small 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 142M parameters 512 tokens sentence-transformers