← All models

natural-language inference · text · WASM · ~91 MB

Textual entailment (NLI)

The built zero-shot classifiers use an NLI model to pin a label on a text. This demo exposes the reasoning itself: give it a premise and a hypothesis, and it decides whether the hypothesis follows from, contradicts, or is neutral to the premise. It's the atomic step behind fact-checking and RAG grounding — does this evidence support the claim? Runs entirely on your device.

At a glance

Modelnli-deberta-v3-xsmall — a cross-encoder NLI model (deberta-v3-xsmall)
Tasktext-classification over a sentence PAIR (natural-language inference)
Runtimetransformers.js — tokenized as a pair (tokenizer(premise, { text_pair: hypothesis })), run low-level (the pipeline ignores the pair)
Inputa premise sentence + a hypothesis sentence
Outputa probability over entailment / neutral / contradiction (softmax of the logits)
Quantizationq8 (model_quantized.onnx) — runs on the plain WASM backend, no WebGPU needed
Download~91 MB, cached after first load (auto-inits on return)
LicenseApache-2.0 (base cross-encoder/nli-deberta-v3-xsmall, a fine-tune of Apache-2.0 deberta-v3-xsmall)
Web APIsWebAssembly, Web Workers — all Baseline widely available

Compare two statements

Entailment vs classification

A zero-shot classifier runs an NLI model with a fixed hypothesis template ("This example is {label}") to score labels. Here the hypothesis is a free sentence, so you see the raw three-way relationship — the same signal used to check whether a retrieved passage supports a generated answer, or whether two statements contradict. It's a cross-encoder: premise and hypothesis are read together, so subtle disagreements are caught. Everything runs on your device.