MultiNLI

Multi-Genre Natural Language Inference

Tests whether a model can judge if one sentence follows from another across many kinds of writing — fiction, phone calls, government reports and more.

Released Apr 2017 Metric matched test accuracy (GLUE) SOTA 92.6 · Turing NLR v5 (2022)
01

At a glance

Task
3-way sentence-pair classification
Size
393k train / 20k dev / 20k test
Metric
Accuracy, reported separately on matched (same genres as train) and mismatched (unseen genres) splits
Genres
10 — fiction, letters, 9/11 report, OUP, slate, telephone, travel, verbatim, government, face-to-face
Part of
GLUE (as MNLI-m / MNLI-mm)
A Broad-Coverage Challenge Corpus for Sentence Understanding through Inference
Williams, Nangia, Bowman · NAACL 2018
Read the paper ↗ Hugging Face ↗
02

What it tests

MultiNLI keeps the SNLI recipe (premise, hypothesis, three labels) but draws premises from ten very different kinds of text, from telephone transcripts to government reports. The point is to test whether a model's understanding transfers across writing styles rather than memorising caption-speak.

The test set is split in two. The matched half uses the same genres as training. The mismatched half uses five genres the model has never seen, so the gap between the two numbers is a direct measure of over-fitting to style.

Because it is large, varied and part of GLUE, MNLI became the default dataset for pre-training-then-fine-tuning papers from BERT onward. A GPT-1 result on MNLI is a result on exactly this data.

03

Examples

Items from the dataset (or representative items where the originals are not freely redistributable).

Telephone genre
Premise
yeah i tell you what though if you go price some of those tennis shoes i can see why now you know they're getting up in the hundred dollar range
Hypothesis
The tennis shoes have a range of prices.
Answerentailment
Fiction genre
Premise
He turned and smiled at Vrenna.
Hypothesis
He smiled at Vrenna who was walking slowly behind him with her mother.
Answerneutral
Government genre
Premise
The new rights are nice enough
Hypothesis
Everyone really likes the newest benefits
Answerneutral
04

Reported results

Scores reported on this benchmark, with the evaluation setting each one used.

SettingReportedContext
Fine-tuned82.1 (matched) / 81.4 (mismatched)Prior best 80.6 / 80.1 (GenSen / multi-task)
05

State of the art

Best known · matched test accuracy (GLUE)
92.6
✓ saturated · at or above human level
Model
Turing NLR v5 (Microsoft)
2022
Human baseline
92.0

GLUE leaderboard snapshot reproduced in the Vega paper; the leaderboard itself has been frozen since 2022. Source: arxiv.org ↗ · checked October 2026.

06

Quickstart

Load the benchmark and score a Hugging Face causal LM on it in a few lines.

1Install
shell
pip install -U datasets transformers evaluate lm-eval sacrebleu rouge-score scikit-learn
2Load the data

premise, hypothesis, label (0 entailment · 1 neutral · 2 contradiction). Test labels are hidden; use validation_matched / validation_mismatched.

python · load
from datasets import load_dataset

ds = load_dataset("nyu-mll/glue", "mnli", split="validation_matched")
print(ds)            # columns: premise, hypothesis, label (0 entailment · 1 neutral · 2 contradiction)
print(ds[0])
3Score a model

Two helpers cover every benchmark in this collection: loglik for anything multiple-choice (score each option, pick the highest) and generate for anything free-form. Swap MODEL for whatever you are evaluating.

python · helpers
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

MODEL = "gpt2"                                   # or "Qwen/Qwen2.5-1.5B", "meta-llama/Llama-3.2-1B", …
tok = AutoTokenizer.from_pretrained(MODEL); model = AutoModelForCausalLM.from_pretrained(MODEL, torch_dtype=torch.bfloat16).eval().to("cuda")

@torch.no_grad()
def loglik(context, continuation):
    """Sum of log-probs of `continuation` tokens given `context` — the standard multiple-choice scorer."""
    ids = tok(context + continuation, return_tensors="pt").input_ids.to(model.device)
    n_ctx = len(tok(context).input_ids)
    logp = model(ids).logits.log_softmax(-1)[0, :-1]
    return logp.gather(1, ids[0, 1:, None])[n_ctx - 1:].sum().item()

@torch.no_grad()
def generate(prompt, max_new_tokens=32, stop=None):
    ids = tok(prompt, return_tensors="pt").input_ids.to(model.device)
    out = model.generate(ids, max_new_tokens=max_new_tokens, do_sample=False, pad_token_id=tok.eos_token_id)
    text = tok.decode(out[0, ids.shape[1]:], skip_special_tokens=True)
    return text.split(stop)[0] if stop else text
python · evaluate
# Score each label by the log-likelihood of its verbaliser after the pair (GPT-3 style)
LABELS = ["True", "Neither", "False"]      # entailment / neutral / contradiction
def prompt(ex): return f"{ex['premise']}\nQuestion: {ex['hypothesis']} True, False, or Neither?\nAnswer:"
correct = 0
for ex in ds:
    if ex["label"] < 0: continue
    scores = [loglik(prompt(ex), " " + lab) for lab in LABELS]
    correct += int(scores.index(max(scores)) == ex["label"])
print("accuracy", correct / len(ds))
4Or use lm-evaluation-harness

Task name(s): mnli. The harness reproduces the GPT-3 prompt formats and reports the standard metric.

shell
lm_eval --model hf --model_args pretrained=gpt2,dtype=bfloat16 \
        --tasks mnli --num_fewshot 0 --batch_size auto --output_path results/
07

Pitfalls

  • Test labels are only available through the GLUE server; most papers now report dev accuracy. Say which you used.
  • Always report both matched and mismatched; a large gap means the model learned genre cues.
  • Hypothesis-only artefacts exist here too (~53% without the premise).
08

References