Notes

Natural Language Inference (NLI)

Two sentences, one question: if the first is true, does the second follow? People answer that constantly without noticing, and it turns out to be a demanding test of whether software has understood meaning rather than matched words.

The task
Natural Language Inference gives a model a premise and a hypothesis and asks for one of three labels: entailment, contradiction, or neutral. “A man inspects the uniform of a figure” paired with “the man is sleeping” is a contradiction; paired with “a person is looking at clothing” it is entailment. The standard datasets are SNLI and the multi-genre MNLI, both crowd-written, with ANLI added later because models were beating the originals without the reasoning. The usual architecture is a cross-encoder: both sentences enter one encoder together, separated by a delimiter, with a three-way classifier over the pooled output. MNLI, RTE and QNLI are the NLI entries in GLUE.

Where it shows up
An NLI model is a general-purpose “does this text support that statement” engine:

  • Zero-shot classification — write each candidate label as a hypothesis and keep the one most entailed.
  • Factual-consistency checking of a generated summary against its source document.
  • Filtering paraphrase and duplicate-question pairs, and reranking retrieved passages.

Why it matters
Surface overlap cannot settle entailment — “the plane landed safely” and “nobody was hurt” share no content words — so NLI probes negation, quantifiers and world knowledge directly. It also exposes shortcut learning plainly: models learn that a hypothesis containing “not” is likely a contradiction, score well, and fail the moment the annotation artefact is removed.

Natural Language Inference is the task of deciding whether a hypothesis sentence is entailed by, contradicts, or is merely neutral with respect to a premise sentence. Trained on corpora such as SNLI and MNLI, usually with a cross-encoder over the sentence pair, it tests meaning-level reasoning that word overlap cannot settle. It underpins zero-shot text classification, duplicate detection, and consistency checks of generated summaries against their sources.

A friend says, “the shop was shut when I got there.” You immediately know that “she bought milk” cannot be true, and that “she went home disappointed” might be. Nobody spelled it out; you worked out what follows from what.

Natural Language Inference is teaching software that same move. It is shown two sentences and has to say whether the second follows from the first, clashes with it, or is simply unrelated. It is a demanding test, because sentences that share almost no words can still mean the same thing. Getting it right is what lets a system check whether a summary actually matches the document it came from.