Textual Entailment — Natural Language Inference (NLI)

Machine Learning
Type
NLP sentence-pair classification task

What does it do?

Textual entailment, also known as natural language inference (NLI), is the natural-language-processing task of deciding whether one piece of text (the premise) entails a second piece of text (the hypothesis), contradicts it, or is neutral with respect to it.

Formalised by the PASCAL Recognising Textual Entailment Challenge (Dagan, Glickman & Magnini, 2006) and broadened by the MultiNLI corpus (Williams, Nangia & Bowman, 2018), it underpins question answering and fact-verification pipelines.

The intuition behind the method

Two sentences can stand in different logical relations: if you accept the first, the second may follow automatically, may clearly conflict with it, or may simply be unrelated. Textual entailment teaches a machine to make that judgement — given a premise and a hypothesis, it decides whether the hypothesis is entailed, contradicted, or neither. This three-way verdict is the building block for checking whether a candidate answer is supported by a source text or whether a claim is backed by evidence.

History

Textual entailment was framed as a shared task by the PASCAL Recognising Textual Entailment Challenge, documented by Dagan, Glickman & Magnini (2006). The MultiNLI corpus, described by Williams, Nangia & Bowman (2018), is a broad-coverage challenge corpus for sentence understanding through inference, and it is a source of labelled premise-hypothesis pairs for training and evaluating NLI models.

When to use it

Use textual entailment when each unit of your data is a premise-hypothesis text pair and the question is whether the hypothesis follows from, contradicts, or is unrelated to the premise. Typical settings are checking whether a candidate answer is supported by a source passage, or whether a claim is backed by evidence text. At least 30 pairs is the minimum sample given in the page facts; treat it only as a floor for a rough check, not as a sufficient size. With so few pairs, per-class estimates are highly uncertain, so report confidence intervals and use more pairs for each label you need to judge. Do not use it for topical similarity between sentences or for classifying single documents; a similarity score or a text classifier answers those questions more directly. If your text is in a language or domain that a pretrained NLI model does not cover, expect to need adaptation first.

Limitations and considerations

  • The task needs text organised as premise-hypothesis pairs; isolated documents cannot be judged until such pairs are constructed from them.
  • Performance depends on whether a large pretrained NLI model exists for your language and domain, since the inference judgement degrades when the model was trained on different text.
  • The meaning of each label is set by the annotation scheme of the training data, so a model's notion of neutral may not match the distinctions your application needs.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Returns a three-way verdict (entailment, contradiction, neutral), so a claim that conflicts with its source is distinguished from one the source simply does not address.
  • Gives an accept-or-reject signal that question-answering and fact-verification pipelines can use: an entailment label indicates that the model judges the source to support the candidate text, though it is not a guarantee of correctness.
  • Can be run zero-shot with a large pretrained NLI model when no task-specific labelled data is available.

Applications

  • Question answering — checking whether a candidate answer is entailed by a source passage.
  • Fact verification — providing a model judgement on whether a claim is supported or contradicted by evidence text, to be validated on labelled cases from the target domain before use.
  • Information consistency checks across documents and summaries.
  • Serving as the underlying engine for zero-shot text classification via candidate-label entailment.

How it works

How it works

1

The input is organised into premise-hypothesis pairs. Each example couples a premise text with a hypothesis text whose relationship to the premise is to be judged; in question answering and fact verification these pairs are formed from a source passage and a candidate claim or answer.

2

A large pretrained language model reads the pair and turns it into a contextual representation that captures the meaning of premise and hypothesis together. Because the task hinges on subtle logical relations, a strong pretrained model is preferred over hand-built features.

3

The model assigns one of three labels to each pair: entailment (the hypothesis follows from the premise), contradiction (the hypothesis cannot be true if the premise is), or neutral (the premise neither supports nor rules out the hypothesis). A pretrained NLI model fine-tuned on labelled premise-hypothesis data, such as the MultiNLI corpus, produces these labels, typically with a score for each label. Zero-shot use is a separate application of the same idea: the candidate label is converted into a hypothesis and the source text is kept as the premise. That procedure is described on the zero-shot-classification page.

4

Predictions are scored against labelled pairs. Accuracy is the proportion of pairs whose predicted label matches the gold label. Per-class precision is, for a given label, the proportion of pairs predicted with that label that truly carry it; per-class recall is the proportion of truly labelled pairs that the model finds. Report a confusion matrix across the three labels and check the class balance of the sample, because the classes can be unevenly distributed and overall accuracy can hide weak performance on a minority class. Inspect disagreements before deployment to see which kinds of pairs the model gets wrong. Accept a model only if its per-class performance on your own labelled pairs meets a threshold you set before testing, and report confidence intervals, since small samples give wide uncertainty.

Common pitfalls

  • Confusing entailment with surface similarity: two sentences can share most of their words yet contradict each other.
  • Applying a model pretrained for one language or domain to another without checking its judgements on a sample of your own pairs.
  • Reporting only overall accuracy when the three classes are imbalanced; inspect per-class precision and recall.
  • Running the task on fewer than 30 pairs, the minimum sample given in the page facts, which makes any evaluation unreliable.

Frequently asked questions

What is the difference between entailment, contradiction, and neutral?

Given a premise, the hypothesis is labelled entailment if accepting the premise means the hypothesis follows, contradiction if the hypothesis cannot be true when the premise is, and neutral when neither holds — the premise neither supports nor rules out the hypothesis.

How is textual entailment different from sentence similarity?

Similarity measures how alike two sentences are, which is symmetric and graded. Entailment is a directional, logical relation: a premise can entail a hypothesis without the reverse holding, and two highly similar sentences can still contradict one another.

Do I need labelled training data?

Not necessarily. With a large pretrained NLI model you can run the task zero-shot: the candidate label is converted into a hypothesis and the source text is kept as the premise. A small labelled set of premise-hypothesis pairs is still useful for evaluation and for checking whether the model suits your domain.

Why is it used for fact verification and question answering?

Both tasks reduce to checking whether a piece of text is supported by a source. Entailment provides a model judgement of exactly that kind: an entailment label suggests that a candidate claim or answer is supported by the source, and a contradiction label suggests it is not. These judgements are probabilistic and can be wrong, so validate the model on labelled examples from your own domain before relying on it to accept or reject claims.

Related methods

Sources

  1. Dagan, I., Glickman, O. & Magnini, B. (2006). The PASCAL Recognising Textual Entailment Challenge.

    Open publication reference
  2. Williams, A., Nangia, N. & Bowman, S. (2018). A Broad-Coverage Challenge Corpus for Sentence Understanding through Inference. NAACL.

    Open publication reference