Basics ยท Hypothesis Crafting & Calibration ยท 95.9 MB WASM q8 ยท MIT

Hypothesis Template Crafting & Multi-Label vs Single-Label Calibration

Every label becomes a natural-language claim via hypothesis_template. Measure how template wording shifts 2-class entailment logits, and compare forced-sum single-label softmax against independent 2-class P(entailment) calibration.

1. On-device model

Initialise DeBERTa-v3-XSmall Zero-Shot above to run the template crafting & calibration labs.

2. Hypothesis Template Crafting Lab

Score the identical passage and labels across four editable hypothesis_template patterns using MoritzLaurer/deberta-v3-xsmall-zeroshot-v1.1-all-33. Watch how framing alters entailment margin and can flip the top label.

Consensusโ€“
Rank flip?โ€“
Top-1 spreadโ€“
Total latencyโ€“
NaN countโ€“
Hypothesis template comparison showing top label, score, entailment logit, and runner-up
Template Top-1 label Top-1 score Entailment logit Runner-up Latency
Run the 4-template comparison above.

3. Multi-Label vs Single-Label Calibration Lab

In single-label mode, Transformers.js takes the raw entailment logit for every label and runs softmax() across labels โ€” forcing probabilities to sum to 100% even on out-of-scope text. In multi-label mode, each label is evaluated independently via 2-class softmax([not_entailment, entailment])[1].

Single sumโ€“
Multi sumโ€“
Labels ≥ 50% (multi)โ€“
Latencyโ€“
NaN countโ€“
Calibration comparison table between single-label softmax and multi-label 2-class entailment probability
Label Single-label softmax Multi-label P(entail) ฮ” (Multi โˆ’ Single) 2-class logit margin
Run Calibration Comparison above.

4. Inspect sensitivity, calibration & canvas helpers

Show the code ยท deberta-zs-core.mjs โ€” summarizeTemplateSensitivity()
Show the code ยท worker.js โ€” runCalibrationComparison()
Show the code ยท deberta-zs.js โ€” drawCalibrationCanvas()