Multi-model · ModernBERT-Large (452.56 MB q8) vs ModernBERT-Base (154.68 MB q8) · Apache-2.0

ModernBERT-Large (395M, 28L) vs ModernBERT-Base (149M, 22L) — KL Divergence & Agreement

Run Stage 1 (onnx-community/ModernBERT-large-ONNX, 28 layers, 1,024 hidden) and Stage 2 (onnx-community/ModernBERT-base-ONNX via sibling ../../modernbert-base/worker.js, 22 layers, 768 hidden) side by side on identical masked prompts. Measure real KL divergence, Jensen-Shannon divergence, and top-1 cloze agreement across hard code, science, and long-context reasoning prompts.

1. Two independent on-device models (~607.24 MB total)

Stage 1 · ModernBERT-Large (395M, 28L · 452.56 MB)

Uses ../worker.js — WASM q8 28-layer RoPE masked LM (10 global / 18 local layers).

Stage 2 · ModernBERT-Base (149M, 22L · 154.68 MB)

Reuses ../../modernbert-base/worker.js — WASM q8 22-layer RoPE masked LM (8 global / 14 local layers).

2. Head-to-head cloze distribution & KL divergence

Initialise both stages above to compare ModernBERT-Large vs ModernBERT-Base distributions.

Large top-1–
Base top-1–
Top-1 agreement–
KL(Large ‖ Base)–
JS Divergence–
Latency (L / B)–
NaN (L / B)–
Union of top candidate words scored identically by ModernBERT-Large and ModernBERT-Base with probability deltas and log-odds
Candidate token Large prob (logit) Base prob (logit) Δ Prob (L − B) Log2-odds (L vs B)
Run the Large vs Base comparison above to inspect KL divergence and candidate agreement.

Inspect sibling worker peer client & KL divergence math

Show the code · modernbert-large.js — ModernBertBasePeerClient (reusing ../../modernbert-base/worker.js)
Show the code · modernbert-large-core.mjs — compareModelDistributions()

References