use case · multi-model · DistilBERT-NER (65.77 MB · Apache-2.0) → DeBERTa-v3-xsmall NLI (87.25 MB · MIT)

Entity Extraction → Contextual Zero-Shot Role, Sentiment & Topic Tagger

Stage 1 (onnx-community/distilbert-NER-ONNX) finds every PER, ORG, LOC and MISC entity in tens of milliseconds. Stage 2 (Xenova/nli-deberta-v3-xsmall) then reads each entity's own sentence and tests entity-specific hypotheses such as “In this sentence, Marie Curie is a scientist.” — turning a flat list of names into who-is-what, how they are portrayed, and what each sentence is about. Both models run in separate Web Workers on your device.

1 · Two independent on-device models (~153 MB combined)

Stage 1 · DistilBERT-NER

onnx-community/distilbert-NER-ONNX · token-classification · WASM q8 · 65.77 MB · Apache-2.0

Stage 2 · DeBERTa-v3-xsmall NLI

Xenova/nli-deberta-v3-xsmall · zero-shot-classification · WASM q8 · 87.25 MB · MIT

2 · Text & pipeline controls

Stage 2 questions per entity:

Stage 1 entities–
Stage 1 latency–
Stage 2 NLI calls–
Stage 2 total–
NaN check–

3 · Stage 1 — entities found

Stage 1 output will appear here.

4 · Stage 2 — what each entity is, and how it is portrayed

Per-entity Stage 2 zero-shot role, sentiment and sentence topic with scores
Type Entity Role (top hypothesis) Tone toward entity Sentence topic Context sentence
Run the full pipeline to classify entities.
How Stage 2 works: for each entity the NLI model scores its sentence (premise) against one hypothesis per candidate label — In this sentence, {entity} is {label}. and The sentence is {positive|negative|neutral} about {entity}. — and softmaxes the entailment logits across labels. Topics use This sentence is about {label}. once per sentence. Label sets are type-specific (people get occupations, organizations get institution kinds). Scores are relative among the offered labels, not calibrated probabilities.
Show the code — ner-core.mjs: buildStage2Jobs() (entity-conditioned NLI hypotheses)
Show the code — nli-worker.js: classify() (zero-shot pipeline with hypothesis_template)