Notes

BIO Tagging Scheme

Pulling names, dates and amounts out of a contract means finding stretches of text, but the models that do it label one token at a time. BIO tagging is the convention that bridges the two, and it is the format almost every entity dataset you download arrives in.

Three letters, one per token
Each token gets B-X if it begins a span of type X, I-X if it continues one, and O if it belongs to no span. In Acme Corp hired Ada Lovelace the tags run B-ORG I-ORG O B-PER I-PER. That explicit B is what keeps two adjacent entities of the same type from fusing into one, which is the whole reason the scheme is not simply in-or-out. Decoding reverses it: scan the tags, open a span at each B, close it when an O or a new B arrives.

Why it matters
BIO is the interchange format of sequence labelling. CoNLL-2003 ships this way, spaCy and Hugging Face token-classification pipelines consume and emit it, and span F1 is computed by decoding predicted tags into spans and comparing whole spans — an entity with one token mislabelled scores zero, not partial credit.

Where it fails
A token classifier can emit I-PER after O, or I-LOC after B-PER; both are illegal and nothing in the tag set prevents them. A CRF layer with forbidden transitions, or a repair pass during decoding, is standard equipment for this reason. BIO also cannot express spans that overlap or nest, which is why nested entity recognition needs a different formulation entirely.

The BIO scheme encodes spans as per-token labels: B-X begins a span of type X, I-X continues it, O falls outside any span. The explicit B stops two adjacent entities of the same type merging into one. It is the standard interchange format for named entity recognition and chunking, used by CoNLL-2003 and by token-classification pipelines, and the form predictions must take before span F1 can be computed. Nested or overlapping spans are beyond it.

Suppose you are going through a document with a pen, underlining every company name. Underlining the words is not quite enough — you also need to signal where each name opens, or two companies listed one after another look like a single long one.

BIO tagging is how software records that. Every word gets one of three marks: this word begins something, this word is inside what was just begun, or this word is outside and part of nothing. Read the marks back and you can see exactly which groups of words form a name, a place or a date. It is the plain, agreed shorthand that lets different programs and datasets hand this kind of markup to each other without confusion.