fill-mask · text · WASM q8 · ~452.56 MB (449.0 MB ONNX) · Apache-2.0

ModernBERT-Large — 8,192-Token RoPE Fill-Mask Encoder

ModernBERT-Large scales Answer.AI + LightOn's modernized bidirectional encoder to 28 layers, 1,024 hidden width, and 395.9M parameters with rotary position embeddings (RoPE), GeGLU feed-forwards, and alternating 128-token local / every-3rd-layer global attention over an 8,192-token context. Enter [MASK] or <|mask|> anywhere and inspect raw 50,368-vocab logits locally in a Web Worker.

At a glance

Model (ONNX) onnx-community/ModernBERT-large-ONNX (upstream: answerdotai/ModernBERT-large)
Task / architecture fill-mask · ModernBertForMaskedLM (28 layers · 1,024 hidden · 16 heads · 2,624 GeGLU FFN · 395,881,664 params)
Context & attention 8,192 tokens (max_position_embeddings: 8192) · 10 global layers (θ=160,000, every 3rd layer) + 18 local 128-tok sliding-window layers (θ=10,000)
Tokenizer & mask token Byte-level BPE (50,368 vocab) · [MASK] (token id 50284; UI auto-normalizes <|mask|>) · [CLS] 50281 · [SEP] 50282
Quantization & size q8 (onnx/model_quantized.onnx / model_int8.onnx · 448,957,636 B · ~452.56 MB total incl. 3.58 MB tokenizer.json + configs)
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 8K-Context Fill-Mask Studio

Initialise ModernBERT-Large above to predict [MASK] completions locally in your browser.

Backend / dtype–
Latency–
Tokens / 8,192–
Top-1 entropy–
Top-k mass–
NaN count–

See inside — 28-layer RoPE schedule & byte-level BPE tokens

Every third layer in ModernBertForMaskedLM (layers 1, 4, 7, 10, 13, 16, 19, 22, 25, 28) computes full global attention (RoPE θ=160,000), while the other 18 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.

Global / local layers10 global / 18 local
Attn cost saved vs dense–
Context vs BERT-512–
Logits tensor–

Indigo = Global full-context layer (10 layers, every 3rd) · Green = 128-token local sliding window (18 layers).

Encoded BPE token strip

Run inference above to inspect encoded BPE tokens and [MASK] positions.

Why it matters

Classic 2018 encoders stop at 512 tokens and struggle with source code or multi-paragraph audit trails. ModernBERT-Large brings 395.9M bidirectional parameters across 28 layers and an 8,192-token RoPE window straight into the browser — enabling document-wide cloze recovery, PII transcript reconstruction, and Base-vs-Large KL calibration with zero server round-trips.

Use-case ladder

Inspect the worker, normalization & RoPE math

Show the code · worker.js — runSinglePass() (exact logits + 8,192-tok telemetry)
Show the code · modernbert-large-core.mjs — getArchitectureTelemetry()
Show the code · modernbert-large-core.mjs — normalizeClozeInput()

References