use case · basics · softmax vs sigmoid + hypothesis template lab · q8 WASM · 172.44 MB
Inside DeBERTa-v3 Zero-Shot
Understand the two knobs that control every zero-shot NLI classifier:
Single-Label Softmax vs Multi-Label Independent Sigmoid, and how changing
the wording of hypothesis_template shifts real on-device probabilities.
1 · DeBERTa-v3-Small NLI Worker (172.44 MB q8 WASM)
2 · Shared Premise & Candidate Labels
Prepare DeBERTa-v3-Small NLI above to run both live calibration experiments.
3 · Experiment A: Single-Label Softmax vs Multi-Label Independent Sigmoid
In multi_label: false, Transformers.js takes softmax across the entailment
logits of all candidate labels so probabilities compete and sum to 100%.
In multi_label: true, each label runs an independent 2-way softmax of
[entailment, contradiction] so multiple true topics can score above 90% simultaneously.
| Label | Single (Softmax) | Multi (Sigmoid) | Shift (Multi − Single) | Raw Entail / Contra |
|---|---|---|---|---|
| Run Experiment A to compare single-label vs multi-label calibration. | ||||
4 · Experiment B: Hypothesis Template Sensitivity Lab
Zero-shot models do not see abstract class IDs — they score English sentences. Edit the
three templates below (each must contain {}) and compare how phrasing alters
probabilities and top-1 rankings on the exact same text.
| Label | Template 1 | Template 2 | Template 3 | Spread (Δp) |
|---|---|---|---|---|
| Run Experiment B to measure real hypothesis-template probability shifts. | ||||