At a glance
| Model (ONNX) | onnx-community/ModernBERT-base-ONNX (upstream: answerdotai/ModernBERT-base) |
|---|---|
| Task / architecture |
fill-mask · ModernBertForMaskedLM (22 layers · 768
hidden · 12 heads · 1,152 GeGLU FFN · ~149M params)
|
| Context & attention |
8,192 tokens (max_position_embeddings: 8192) · 8 global
layers (θ=160,000) + 14 local 128-tok sliding-window layers (θ=10,000)
|
| Tokenizer & mask token |
Byte-level BPE (50,368 vocab) · [MASK] (token id
50284) · [CLS] 50281 ·
[SEP] 50282
|
| Quantization & size |
q8 (onnx/model_quantized.onnx · 151,074,492 B · ~154.68
MB total incl. tokenizer/config)
|
| Runtime & backend |
Shared @huggingface/transformers@3.7.5 on WebAssembly (wasm)
in a dedicated module Web Worker
|
| License | Apache-2.0 |
| Web APIs | WebAssembly, Web Workers, Cache Storage, File & Clipboard APIs |
Run it — Interactive Masked-LM Lab
Initialise ModernBERT-Base above to predict [MASK] completions locally in your browser.
See inside — 22-layer RoPE schedule & byte-level BPE tokens
Every third layer in ModernBertForMaskedLM (layers 1, 4, 7, 10, 13, 16, 19,
22) computes full global attention (RoPE θ=160,000), while the other 14 layers attend over
a 128-token local sliding window (RoPE θ=10,000). Word-initial BPE tokens retain a
Ġ marker in the 50,368-entry vocabulary.
Indigo = Global full-context layer (every 3rd layer) · Green = 128-token local sliding window.
Encoded BPE token strip
Why it matters
Classic 2018 encoders cap context at 512 tokens and fail silently past page one. ModernBERT-Base scales bidirectional masked language modeling to 8,192 tokens with code-aware 2T-token pretraining — unlocking document-wide cloze, syntax repair, and zero-server inspection right in the browser.
- Long-document cloze & completion — resolve blanks conditioned on facts located thousands of tokens earlier.
- Code & technical copyediting — trained on source code + technical corpora so operators, keywords, and domain nouns rank accurately.
- Exact logit auditing — inspect raw pre-softmax scores, Shannon entropy, and counterfactual minimal pairs without API billing.
Use-case ladder
Basics · 8,192-Tok Retention & Top-K Calibration
Plot Full ModernBERT RoPE vs a 512-token BERT truncation cutoff and calibrate multi-mask entropy across top-k depths.
Practical · Batch Copyediting & Cloze Triage
Drag-drop `.txt`, `.md`, `.csv`, or `.json` files, run cancellable FIFO batch cloze, and export formula-safe CSV, JSON, and Markdown.
Wild · 6 Empirical Stress Probes
Test >700-tok needle retrieval, TypeScript syntax, negation flip sensitivity, coupled multi-mask, ML jargon, and counterfactual bias log-odds.
Multi-model · Cloze + NLI Semantic Verification
Chain ModernBERT-Base candidate proposals into DeBERTa-v3 Zero-Shot NLI to verify factual & intent compatibility.