BIO tagging is a token-level annotation scheme that assigns one of three labels—Beginning (B), Inside (I), or Outside (O)—to each token in a sequence, precisely demarcating the exact span of named entities. The 'B' tag marks the first token of an entity, 'I' tags mark subsequent tokens within the same entity, and 'O' tags identify tokens that belong to no entity, creating a structured input format for training sequence labeling models like Conditional Random Fields (CRF).
Glossary
BIO Tagging

What is BIO Tagging?
BIO tagging is the foundational sequence labeling scheme used to train medical named entity recognition models by assigning a boundary label to every token in a clinical text.
In clinical NLP, BIO tagging transforms unstructured medical narratives into supervised training data by encoding multi-token concepts such as 'acute myocardial infarction' as B-Disease, I-Disease, I-Disease. This scheme enables models to learn entity boundaries and types simultaneously, serving as the standard preprocessing step before fine-tuning domain-specific architectures like BioBERT on annotated corpora for tasks including medication extraction and PHI recognition.
Key Features of BIO Tagging
The BIO (Beginning, Inside, Outside) tagging scheme is the foundational token-level annotation format for training sequence labeling models to perform medical Named Entity Recognition. It provides a strict, unambiguous method for demarcating the exact span of clinical concepts in unstructured text.
The B-I-O Tag Structure
Each token in a clinical sentence receives exactly one tag. B (Beginning) marks the first token of an entity. I (Inside) marks any subsequent token within the same entity. O (Outside) marks tokens that are not part of any entity.
- Example: "The patient was given B-DRUG aspirin I-DRUG for B-PROBLEM chest I-PROBLEM pain I-PROBLEM ."
- This strict token-level mapping eliminates ambiguity about entity boundaries, which is critical for high-stakes medical data extraction.
Multi-Class Entity Encoding
BIO tags are combined with entity class labels to create a single, composite tag for each token. This allows a single sequence labeler to simultaneously identify boundaries and classify the entity type.
- Common Clinical Classes:
DRUG,PROBLEM,TEST,PROCEDURE. - Tag Examples:
B-PROBLEM,I-PROBLEM,B-DRUG,I-DRUG. - This encoding transforms the complex task of NER into a standard multi-class classification problem at every time step, suitable for models like Conditional Random Fields (CRF) or fine-tuned transformers.
Handling of Adjacent Entities
The 'B' tag is mandatory for the first token of every entity, even when two entities of the same type are directly adjacent. This rule prevents the model from incorrectly merging distinct concepts.
- Example: "...diagnosed with B-PROBLEM asthma B-PROBLEM COPD..."
- Without the second
Btag, the sequenceasthma COPDwould be incorrectly interpreted as a single, continuous problem entity. This strict boundary enforcement is essential for accurate medication lists and problem lists.
Limitations with Discontinuous Entities
Standard BIO tagging operates on a flat, linear sequence and cannot natively represent entities that are syntactically interrupted or overlapping. This is a known limitation in complex clinical narratives.
- Discontinuous Example: "B-PROBLEM right O and B-PROBLEM left I-PROBLEM lung I-PROBLEM opacities" is forced to be two separate entities.
- Overlapping Example: "B-PROBLEM left B-BODY_PART ventricle I-PROBLEM aneurysm" cannot be fully captured.
- Modern alternatives like Span Categorization are often employed to address these complex cases, but BIO remains the standard for its simplicity and broad tooling support.
Training Data Annotation Format
BIO-tagged corpora serve as the gold-standard input for supervised fine-tuning of medical NER models. The quality and consistency of this annotation directly dictate model performance.
- Annotation Process: Human experts label each token in a corpus of clinical notes, guided by a strict annotation guideline.
- Quality Metric: Inter-Annotator Agreement (IAA) is measured to ensure the resulting BIO tags are consistent and reliable.
- Models like BioBERT and MedSpaCy are fine-tuned on BIO-tagged datasets such as i2b2/n2c2 challenge data to learn clinical entity extraction.
Conversion to and from Spans
BIO tags are a serialization format for entity spans. A post-processing step is always required to convert the raw token-level predictions back into structured entity objects with start and end character offsets.
- Conversion Logic: A sequence of
B-DRUGfollowed byI-DRUGtokens is merged into a singleDRUGentity spanning the combined tokens. - Constraint Validation: Invalid sequences, such as an
I-PROBLEMtag immediately following anOtag, are automatically corrected during decoding. - This deterministic conversion makes BIO a reliable, lossless method for storing and transferring annotated clinical data.
Frequently Asked Questions
Clear, concise answers to the most common technical questions about the BIO tagging scheme, the foundational annotation standard for training medical named entity recognition models.
BIO tagging is a token-level annotation scheme that assigns one of three labels—B (Beginning), I (Inside), or O (Outside)—to each token in a text sequence to demarcate the exact span of named entities. The B tag marks the first token of an entity, I tags mark all subsequent tokens within that same entity, and O tags mark tokens that are not part of any entity. For example, in the phrase 'the patient was prescribed Metformin hydrochloride,' the token 'Metformin' receives a B-Medication tag, 'hydrochloride' receives I-Medication, and all other tokens receive O. This scheme transforms the unstructured text into a structured sequence labeling task, allowing machine learning models to learn precise entity boundaries. It is the standard input format for training token classification models like those built on BioBERT or Conditional Random Fields (CRF).
BIO Tagging vs. Other Annotation Schemes
A comparison of token-level and span-level annotation schemes used for training medical named entity recognition models.
| Feature | BIO Tagging | BIOES Tagging | Span Categorization |
|---|---|---|---|
Granularity | Token-level | Token-level | Span-level |
Captures entity boundaries | |||
Distinguishes entity types | |||
Handles nested entities | |||
Handles overlapping entities | |||
Explicit single-token entity marker | |||
Explicit end-of-entity marker | |||
Typical model architecture | CRF, BiLSTM-CRF | CRF, BiLSTM-CRF | Span-based classifiers, BERT |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Mastering BIO tagging requires understanding the foundational NLP tasks, model architectures, and evaluation frameworks that depend on this annotation scheme.
Token Classification
The fundamental NLP task that assigns a categorical label to each individual token in a sequence. BIO tagging is the most common encoding strategy for token classification in NER, transforming the problem into a supervised learning task where models predict B-Problem, I-Problem, or O for every word.
- Underpins all modern clinical entity extraction
- Enables models like BioBERT to learn entity boundaries
- Requires perfectly aligned token-label pairs for training
Sequence Labeling
A predictive modeling framework where the output is a sequence of labels corresponding to an input sequence. BIO tagging converts NER into a sequence labeling problem, allowing models to capture dependencies between adjacent tags—for example, an I-Drug tag cannot follow an O tag.
- Models: CRF, BiLSTM-CRF, Transformer+Linear
- Captures transition constraints between BIO tags
- Prevents illegal tag sequences like I-Drug → B-Disease
Span Categorization
A modern alternative to BIO tagging that directly classifies arbitrary text spans as entity types without token-level intermediate labels. Span-based NER enumerates all possible spans up to a maximum length and scores them, naturally handling nested entities where BIO schemes struggle.
- Eliminates the need for B/I/O annotation
- Handles overlapping clinical concepts elegantly
- Used in state-of-the-art models like SpanBERT
Conditional Random Fields (CRF)
A discriminative probabilistic model that serves as the classic decoding layer on top of neural NER architectures. A CRF layer learns transition probabilities between BIO tags—for instance, that I-Disease is likely to follow B-Disease but impossible after O—ensuring globally coherent entity predictions.
- Models tag sequence dependencies explicitly
- Viterbi decoding finds the optimal global tag path
- Often paired with BiLSTM encoders in clinical NLP
F1 Score
The harmonic mean of precision and recall, serving as the primary evaluation metric for BIO-tagged NER systems. Entity-level F1 requires exact boundary matching—both the entity type and its span must align perfectly with the gold standard, making it stricter than token-level accuracy.
- Strict F1: Exact span and type match required
- Relaxed F1: Partial overlap credit in some evaluations
- Standard benchmark metric for datasets like i2b2 and NCBI Disease
Inter-Annotator Agreement (IAA)
A statistical measure of consistency among human labelers who create BIO-tagged gold-standard corpora. High IAA (typically measured via Cohen's Kappa or F1) validates that entity boundaries and types are defined clearly enough for reliable model training.
- Kappa > 0.8 indicates strong agreement
- Low IAA signals ambiguous annotation guidelines
- Critical for defensible clinical NLP benchmarks

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us