Basics ยท RoPE & Hypothesis Framing ยท 150.87 MB WASM q8 ยท Apache-2.0

Inside ModernBERT RoPE & Hypothesis-Template Framing

Zero-shot classification converts every label into a sentence via hypothesis_template, then reads the model's entailment logits. Below, measure both how phrasing changes the winner on the exact same text and how ModernBERT's RoPE attention avoids the 512-token cutoff on long premises.

1. On-device model

Initialise ModernBERT-Base NLI above to run the framing & length labs.

2. Hypothesis-Template Sensitivity Lab

The same passage and candidate labels are scored across four different hypothesis_template wrappers using onnx-community/ModernBERT-base-nli-ONNX. Watch how framing shifts entailment margin and can flip the top-ranked label.

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

3. Long-Context NLI Length Audit (256 โ†’ 512 โ†’ 1,024+ tokens)

A decisive policy rule is placed at the tail of an expanding preamble. Each rung runs twice: once with full ModernBERT RoPE attention and once with a classic max_length: 512 truncation simulating a BERT-family cutoff.

Token length audit comparing Full ModernBERT RoPE vs 512-token truncation
Target rung Exact pair tokens Full RoPE winner & score 512-tok clip winner & score Full latency Clip blind? NaN
Run the Length Audit above to measure latency vs accuracy.

4. Inspect sensitivity & chart helpers

Show the code ยท modernbert-nli-core.mjs โ€” summarizeTemplateSensitivity()
Show the code ยท modernbert-nli.js โ€” drawLengthAuditCanvas()