← All models

text-classification · text · WASM · ~1.27 GB

Stance detection — for or against the claim?

Sentiment asks "is this positive?"; stance asks "positive toward what?". Given a claim and a piece of text, this XLM-RoBERTa fact-checking classifier decides whether the text supports or refutes that specific claim — the same sentence flips stance when you change the claim. It's a dedicated stance head (not sentiment, not zero-shot NLI). Set a claim, type some text, and watch the stance meter, all on-device.

At a glance

ModelFactiverse/factiverse_stance_detection_ort_quantized
Task / pipelinetext-classification (single-label, target-conditioned)
LabelsSUPPORTS vs REFUTES; softmax (the two scores sum to 1). Near-50/50 = no clear stance.
ArchitectureXLM-RoBERTa (multilingual) fine-tuned for fact-checking stance (Factiverse)
Input formatclaim </s></s> text — claim and text joined by the XLM-R separator
Quantizationq8 (8-bit) ONNX (ONNX at repo root — loaded with subfolder: "")
BackendWebAssembly (runs anywhere; no WebGPU needed)
Download~1.27 GB, cached after first load — a heavy one-time download; desktop recommended
LicenseUnspecified upstream — research/demo use; base XLM-RoBERTa is MIT
Web APIsWebAssembly, Web Workers — all Baseline widely available

Run it

Set a claim, then type or paste a piece of text. The stance re-computes automatically (debounced) a moment after you stop typing. The meter slides toward supports (right) or refutes (left).

See inside — target-conditioning + two probabilities

Two numbers, SUPPORTS and REFUTES, that sum to 1 — the model's raw softmax. The interesting part is the conditioning on the claim: the model reads claim </s></s> text as one sequence, so the same text can support one claim and refute another. The button below runs the current text against both the current claim and its negation, so you can watch the stance flip. When the two bars sit near 50/50, the text doesn't take a clear side toward that claim — we label that unclear (the model has no separate neutral class).

Why it matters

Stance is the missing axis in text analytics: it's not "is this positive" but "which side of this question is it on". Running it on-device means you can map an argument, triage evidence, or check a source privately, with no round-trip.

Use cases

Basics

Set a claim, score a text live for supports/refutes, and watch the same text flip stance when the claim changes.

Practical

Map a debate: drop a claim and a pile of arguments, and auto-sort them into a for / against / unclear board.

Wild

Probe the hard cases — sarcasm, implicit stance, off-topic text — and see where a stance model gets fooled.

Multi-model

Contrast stance with sentiment: show how "supports a claim" and "positive tone" are genuinely different axes.

How the API works

Join the claim and the text with the XLM-R separator and classify the single sequence:

import { pipeline } from "@huggingface/transformers";

const classify = await pipeline(
  "text-classification",
  "Factiverse/factiverse_stance_detection_ort_quantized",
  { dtype: "q8", subfolder: "" }, // ONNX lives at the repo root
); // downloads + caches ~1.27 GB once

const claim = "Remote work improves productivity.";
const text = "Studies show remote employees finish more tasks.";
const out = await classify(claim + " </s></s> " + text, { top_k: 2 });
// → [{ label: "SUPPORTS", score: 0.99 }, { label: "REFUTES", score: 0.01 }]

Note: this checkpoint's text_pair path returns a degenerate constant, so we build the claim </s></s> text string ourselves — the verified formulation. It runs in a Web Worker so the UI never janks.

References