token-classification · multilingual text (10 languages) · CPU WASM q8 · 135.36 MB · AFL-3.0

Multilingual DistilBERT-NER — 10-Language Entity & Script Lab

A cased multilingual DistilBERT fine-tuned across 10 high-resource languages — Arabic (RTL), German, English, Spanish, French, Italian, Latvian, Dutch, Portuguese and Chinese (CJK) — extracting people, organizations and locations completely on-device in a Web Worker, with full WordPiece and 9-way softmax transparency.

At a glance

Pipeline tasktoken-classification
ArchitectureDistilBERT multilingual cased · 119,547 vocab · ~135M params
Artifact & quantmodel_quantized.onnx · q8 · 135.36 MB
BackendCPU WASM (Web Worker)
Labels (config.id2label)9 BIO slots · trained PER ORG LOC (+ unused DATE)
10 HRL Languagesar · de · en · es · fr · it · lv · nl · pt · zh
LicenseAFL-3.0 (Academic Free License 3.0)
RuntimeTransformers.js 3.7.5
Web APIsWorkers · WebAssembly · Cache Storage

Run it — 10-language live entity & script tagger

Pick any of the 10 training languages (including Arabic RTL and Chinese CJK), edit the text, or load a local .txt / .md file:

Language tabs run automatically once the model is ready; manual edits run when you press Tag entities.

Show entity types:

Pipeline latency–
Entities shown–
WordPieces / units–
Detected script · dir–
Sub-token disagreements–
Softmax ↔ pipeline parity–
NaN check–
Backend · dtypeWASM · q8
PER · Person ORG · Organization LOC · Location
Initialise the model above to tag entities live across all 10 languages.

Merged entities

Merged entity spans with type, surface text, confidence, character span and WordPiece count
# Type Entity Confidence Char span Units · pieces
Run the tagger to list entities.

See inside — multilingual WordPiece BIO tags & 9-way softmax

Every token below comes from the live token-classification pipeline (with ignore_labels: [] so O tokens stay visible) paired with a forward pass exposing all 9 logits from config.id2label (O, B-/I-DATE, B-/I-PER, B-/I-ORG, B-/I-LOC). Notice how Arabic conjunctions like و (and) attach to the next word (و + ##جن + ##يف) while Chinese characters emit one unprefixed WordPiece per character.

Per-WordPiece BIO predictions with score, character span and top-3 alternatives
Index WordPiece BIO label Score Char span Top-3 of 9 labels
No tokens yet.

Why it matters — 10-language coverage in one 135 MB checkpoint

Honest limits: the shared classification head defines B-DATE / I-DATE in slots 1–2 of config.id2label, but the 10 aggregated HRL datasets only annotate PER, ORG and LOC — dates are tagged O. Like English DistilBERT-NER, the cased mBERT vocabulary relies on capitalisation in Latin scripts, and attached Arabic prefixes (e.g. وجنيف) can cause subword disagreements between first and average.

Use-case ladder

Basics

Run the same event in 6 languages side-by-side to measure WordPiece fertility across Latin, Arabic RTL and Chinese CJK.

Open Basics →

Practical

Process mixed-language briefings or uploaded .txt/.md/.csv/.json files with language tags and CSV / CoNLL / JSON exports.

Open Practical →

Wild

Code-switching (EN+ZH, EN+AR, FR+DE) + diacritic-stripping stress lab, 2-pass collision-free co-occurrence graph and selective redaction.

Open Wild →

Multi-model

Stage 1 extracts entities across scripts; Stage 2 (paraphrase-multilingual-MiniLM-L12-v2) clusters cross-lingual mentions of the same entity.

Open Multi-model →

How the API works

import { TRANSFORMERS_URL } from "/lib/webai.js"; // shared Transformers.js 3.7.5 pin
const { pipeline } = await import(TRANSFORMERS_URL);

const ner = await pipeline("token-classification", "Xenova/distilbert-base-multilingual-cased-ner-hrl", {
  device: "wasm",
  dtype: "q8", // onnx/model_quantized.onnx, 135.36 MB
});
const tokens = await ner("التقى أنطونيو غوتيريش بممثلين عن الأمم المتحدة في باريس.", { ignore_labels: [] });
// → [{ entity: "B-PER", score: 0.999, index: 4, word: "أن" }, …, { entity: "B-LOC", word: "باريس" }]
// mner-core.mjs aligns Latin, accented, Arabic RTL and CJK tokens to exact offsets and merges BIO spans.
Show the code — worker.js: runOne() (pipeline call, 9-way softmax parity, script-aware chunking)
Show the code — mner-core.mjs: alignTokensToText() (Latin, Arabic tashkeel & CJK offset recovery)
Show the code — mner-core.mjs: bioMerge() (CJK non-spacing boundary preservation)

References