use case · basics · token-classification · WASM q8 · 65.77 MB · Apache-2.0

Inside DistilBERT-NER: Cased vs Lowercase Fragility & WordPiece BIO Merging

DistilBERT-NER was fine-tuned from the cased distilbert-base-cased checkpoint on CoNLL-2003 Reuters news, where names are capitalised. Run the same sentence four ways and watch what capitalisation is worth — then open up the WordPiece stream to see how B-/I- tags on ## pieces become whole entities.

1 · Case-fragility lab

Fragility scorecard (vs the cased run)

Entity recall of each casing variant compared to the cased reference run
Casing Entities Same text + type Type flips Missed Spurious Recall vs cased
Run the comparison to fill the scorecard.
What you are seeing: the cased tokenizer keeps capital letters, so Paris is one known vocabulary entry while paris splits into par ##is and PARIS into PA ##RI ##S. CoNLL-2003 taught the model that capitalised tokens in news are usually names, so lowercase text typically loses nearly every entity and ALL CAPS produces fragmented, low-confidence guesses. For lowercase sources (chat, transcripts) restore case first or use an uncased NER model.

2 · WordPiece BIO merge inspector

Each dashed box is one word; inside are its WordPieces with the label the model gave each piece. A solid warning border marks words whose pieces disagree on entity type — the word label underneath is what the chosen strategy decides.

Run the comparison above.

Naive token-level spans

Every WordPiece is its own unit, so a B- tag on a ## piece starts a new fragment.

Word-level BIO spans (what the suite uses)

Pieces fold into words first, then B-/I- runs of the same type merge.

3 · The 9-label CoNLL BIO scheme

The nine id2label entries of distilbert-NER
idLabelMeaning

The model card describes CoNLL's original IOB1 convention (B- only when an entity directly follows another of the same type). In practice this checkpoint emits B- on the first token of most entities (IOB2 style — e.g. Marie/B-PER C/I-PER), so the merger accepts both: B- always opens a span and an orphan I- opens one too, so no entity is silently dropped.

Show the code — ner-core.mjs: alignTokensToText() (recovering offsets for ## pieces)
Show the code — ner-core.mjs: analyzeCaseFragility() (casefolded recall vs the cased run)