AI Glossary / Natural language and speech / Advanced
BIO tagging
Definition
BIO tagging represents labeled text spans through a tag attached to each token. B marks the beginning of a span, I marks a continuation inside that span, and O marks a token outside the spans being annotated. A type suffix, such as PER for person or ORG for organization, identifies the span's category. Here, BIO means the convention in which every span begins with B, often called IOB2.
What it means
Many language tasks need to identify phrases rather than classify isolated words. A person's name may contain two tokens; an organization name may contain three. BIO converts those boundaries and categories into a sequence of token labels that a sequence-labeling model can predict.
The boundary markers matter as much as the category. Two adjacent tokens labeled as people could form one two-token name or two separate one-token names. B and I distinguish those possibilities. O means outside the selected annotation categories, not that the token is meaningless or unimportant for every other task.
How it works
First define tokenization and the annotation inventory. For each flat, contiguous span, assign B-type to its first token and I-type to its remaining tokens. Assign O to tokens not covered by a span. With n entity types, this scheme has 2n + 1 possible tags: one B and one I for each type, plus O.
A decoder reconstructs spans by opening a new span at B and continuing it through matching I tags. A new B or an O ends the current span. Under strict IOB2 interpretation, an I-type tag cannot validly begin a sequence or follow O without a matching open span. Systems need a documented policy for invalid predictions rather than silently interpreting every tag sequence identically.
Tokenization is part of the representation. If a model uses subword pieces while the annotations use words, their alignment must be defined. A single BIO label per token also does not directly encode arbitrary nested, overlapping or discontinuous spans.
Three practical examples
- A named-entity dataset marks person and organization mentions. BIO tags preserve which tokens belong together, allowing a model to learn both entity categories and boundaries.
- A document-extraction workflow marks contiguous fields of a chosen type. Tokens outside those fields receive O even when they contain useful context for deciding the field boundaries.
- A chunking task uses BIO to represent shallow phrases. The marker scheme stays the same while the type inventory changes, illustrating that BIO is a representation rather than a named-entity-specific algorithm.
Think of it this way
Think of highlighting selected passages with a label at each starting point. B says “a new highlighted passage starts here,” I says “continue the same passage,” and O says “this token is outside.” The category tells you what kind of passage is highlighted. A misplaced boundary can change the extracted passage even when most token labels are correct.
Worked example
Use the invented sentence “Maya Chen met Noor at Cedar Labs.” Split it into eight tokens, treating the final period separately: Maya, Chen, met, Noor, at, Cedar, Labs, and the period. Suppose the annotation identifies Maya Chen and Noor as person mentions and Cedar Labs as an organization mention.
The labels are Maya/B-PER, Chen/I-PER, met/O, Noor/B-PER, at/O, Cedar/B-ORG, Labs/I-ORG, and period/O. There are two entity types, so the possible tag inventory contains five tags: B-PER, I-PER, B-ORG, I-ORG and O.
Decoding the sequence recovers three spans: Maya Chen, Noor and Cedar Labs, with their respective types. Noor is a single-token entity, but it still receives B-PER. BIO does not require a separate tag for single-token spans.
Now suppose a prediction changes only Chen's label from I-PER to O. Seven of the eight token labels remain correct, giving token-label accuracy of 7/8 = 87.5%. The predicted spans are now Maya, Noor and Cedar Labs.
Under exact span-and-type evaluation, only Noor and Cedar Labs match the reference. Maya is not an exact match for Maya Chen. There are three predicted spans and three reference spans, with two correct matches. Precision and recall are both 2/3, and their F1 score is also 2/3, or about 66.7%.
The difference is meaningful: token accuracy and exact-span evaluation answer different questions. A single boundary error can damage an extracted name even when the surrounding labels are correct. These calculations concern this teaching example and are not an estimate of real model performance.
Illustrative case study
In a fictional contact-extraction project, a team evaluates the worked prediction and promotes its 87.5% token-label accuracy as the percentage of correctly extracted names. A reviewer notices that the first person has been truncated to Maya.
The team adds exact span-and-type evaluation and reports the two correct entities out of three. It also preserves the token-level score as a diagnostic measure. This lets the team see that one boundary mistake accounts for the different results.
A separate import test reveals another issue: one data supplier uses a tagging convention that does not place B at every span start. The team documents the source convention and converts it before combining datasets. Similar tag names are not sufficient evidence that two annotation formats can be merged without checking their boundary rules.
Common misconceptions and mistakes
BIO is not a model architecture. Different sequence-labeling systems can predict the same tag representation. Nor does B identify a sentence beginning; it identifies a span beginning.
Do not merge adjacent same-type spans merely because their categories match. In an annotation where Maya and Noor are separate adjacent person mentions, B-PER followed by B-PER represents two spans, while B-PER followed by I-PER represents one. Also, entity mention detection does not itself determine whether two mentions refer to the same real-world person.
Business use
Document tokenization, entity definitions, tag convention and invalid-sequence handling. Evaluate complete extracted spans when downstream work depends on exact names or fields. Keep token metrics available for diagnosis, and test conversions carefully when annotations or model tokenizers change.
People also ask
What does O stand for?
Outside the spans of interest.
How is a one-token entity tagged?
B-type under the convention used here.
Can one ordinary BIO sequence represent arbitrary overlapping entities?
No; additional representation is needed.
Check your understanding
Why does Chen receive I-PER?
Answer: It continues the person span beginning at Maya.
How many tags are possible for two types?
Answer: Five.
Why is the predicted Maya span incorrect under exact evaluation?
Answer: Its end boundary does not match the reference Maya Chen span.
Related terms
- Sequence labeling
- Named entity recognition
- Tokenization
- Span
- BIOES
- Entity linking
- Precision
- Recall
- IOB2
- F1 score
Learn next
Decode BIO sequences into spans, then compare BIO with schemes that explicitly mark final and single-token spans.
More in Natural language and speech
- Best-worst scaling - Best-worst scaling is a comparative annotation method in which a person selects the highest and lowest items on a specified property from a small group.
- Bilabial - Bilabial describes a speech sound whose primary constriction is made using both lips.
- Binary branching - Binary branching describes a tree structure in which a branching node has two immediate children.
- Bitext word alignment - Definition: Bitext word alignment identifies corresponding words or tokens in two texts that express substantially the same content in different languages.
- Bound pronoun - A bound pronoun is a pronoun interpreted as a variable whose value depends on a binding expression, often a quantified noun phrase.
- Boundary tones - Boundary tones are tonal events associated with the edges of prosodic phrases in speech.
Sources
Jurafsky and Martin, Speech and Language Processing, chapter 18, section 18.3: BIO tagging, entity boundaries, type-specific tags and related schemes. https://web.stanford.edu/~jurafsky/slp3/18.pdf The sentence, error calculation and fictional extraction case are original teaching illustrations.
Previous: Binomial test Next: BIOES