The BIO tagging scheme (also known as IOB) is a token-level annotation standard used in sequence labeling to demarcate spans of interest within a text. Each token receives one of three tags: B- (Beginning) marks the first token of an entity or chunk, I- (Inside) marks subsequent tokens within that same span, and O (Outside) marks tokens that belong to no entity. This encoding allows models to learn boundaries between adjacent entities of the same type.
Glossary
BIO Tagging Scheme

What is BIO Tagging Scheme?
The BIO tagging scheme is a foundational token-level annotation standard for sequence labeling tasks, where each token is classified as the Beginning, Inside, or Outside of a named entity or structural chunk.
In legal document parsing, BIO tagging is applied to structural role classification and named entity recognition (NER). For instance, a clause title like 'Governing Law' would be tagged as B-SectionTitle and I-SectionTitle, while surrounding text is tagged O. This scheme is essential for training token classification models to identify section boundaries, operative provisions, and deontic modality markers without ambiguity.
Key Features of BIO Tagging
The BIO (Beginning-Inside-Outside) tagging scheme is a foundational annotation standard for token-level classification tasks. It provides a structured way to label each token in a sequence, enabling machine learning models to precisely identify and extract multi-token entities and structural chunks from unstructured legal text.
The Core Tagging Triad
Every token in a sequence receives exactly one tag from three fundamental categories:
- B- (Beginning): Marks the first token of a named entity or structural element. For example,
B-PARTYidentifies the start of a party name like 'Acme' in 'Acme Corporation'. - I- (Inside): Marks any subsequent token that continues the entity. In 'Acme Corporation', 'Corporation' would be tagged
I-PARTY. - O- (Outside): Marks any token that is not part of any entity of interest. This is the default tag for the majority of tokens in a document.
This scheme resolves the ambiguity of adjacent entities of the same type. Without B- and I- prefixes, the sequence 'John Smith Mary Jones' tagged as PERSON would be indistinguishable from a single four-word entity.
Structural Parsing with BIO
BIO tagging extends beyond traditional Named Entity Recognition (NER) to parse the hierarchical structure of legal documents. By defining custom entity types, you can segment a contract into its logical components:
- B-HEADER / I-HEADER: Identifies section titles like 'ARTICLE II' or 'Definitions'.
- B-RECITAL / I-RECITAL: Isolates the 'Whereas' clauses that provide background context.
- B-PARTY / I-PARTY: Extracts the full legal names of contracting parties.
- B-DATE / I-DATE: Captures effective dates and execution timestamps.
This transforms a flat sequence of words into a structured, machine-readable map of the document's anatomy, which is a prerequisite for downstream tasks like clause extraction and obligation mining.
Tokenization Alignment
A critical implementation detail is the alignment between the BIO tags and the model's tokenizer. Modern language models often use subword tokenization (e.g., WordPiece, BPE), which can split a single word like 'Corporation' into multiple tokens like 'Corpor' and '##ation'.
- Standard Convention: The first subword token receives the original BIO tag (e.g.,
I-PARTY), and all subsequent continuation tokens receive the sameI-tag. - Alternative Approach: Some schemas use a special
I-prefix only for the first continuation token, but the consistentI-approach is more common. - Impact: Misalignment between word-level annotations and subword-level model inputs is a primary source of silent errors in production NER pipelines.
Training Data Construction
Building a high-quality BIO-tagged dataset for legal documents requires a rigorous annotation workflow:
- Schema Definition: First, define the complete set of entity types (e.g.,
STATUTE,CASE-NAME,JURISDICTION). - Inter-Annotator Agreement (IAA): Measure consistency between human annotators using metrics like Cohen's Kappa. Legal text is complex, and low IAA indicates ambiguous schema definitions.
- Sequential Consistency: Automated validation scripts must check that no
I-tag follows anOtag without a precedingB-tag, as this is an invalid state transition. - Domain Adaptation: Generic NER models trained on news text perform poorly on contracts. Fine-tuning on a manually annotated legal corpus using BIO is essential for production accuracy.
Beyond BIO: Advanced Variants
While BIO is the most widely adopted scheme, several variants address its limitations:
- BILOU (or BMEWO): Adds L- (Last token of an entity) and U- (Unit-length, single-token entity) tags. This provides explicit boundary information that can improve performance on entities with ambiguous endings.
- IOB2 vs. IOB1: Differ in how they handle the first token after an O. IOB2 (equivalent to standard BIO) always tags the first token of an entity as B-. IOB1 only uses B- when the preceding token is of the same class.
- BIOES: Adds E- (End) and S- (Singleton) tags. Research shows BILOU/BIOES often outperforms BIO for complex, nested structures, but requires more complex decoding logic.
Decoding and Conflict Resolution
The raw output of a BIO-tagging model is a probability distribution over tags for each token. Converting this to a valid entity sequence requires a decoding step:
- Greedy Decoding: Simply selects the highest-probability tag per token. Fast but can produce invalid sequences (e.g.,
Ofollowed byI-PARTY). - Conditional Random Fields (CRF): A CRF layer is often added on top of a neural network (e.g., BiLSTM-CRF) to model transition probabilities between tags. It learns that an
I-PARTYcannot follow anOand enforces global consistency. - Viterbi Algorithm: Used with CRFs to find the single most probable valid sequence of tags for the entire sentence, resolving local ambiguities with global context.
BIO vs. Other Tagging Schemes
Comparison of token-level annotation schemes for named entity and structural boundary detection in legal documents.
| Feature | BIO | BIOES | BILOU |
|---|---|---|---|
Tag granularity | 3 tags per entity type | 5 tags per entity type | 5 tags per entity type |
Beginning marker | B- | B- | B- |
Inside marker | I- | I- | I- |
End marker | E- | L- (Last) | |
Single-token entity | B- only | S- | U- (Unit) |
Outside marker | O | O | O |
Explicit entity boundaries | |||
Typical F1 improvement over BIO | Baseline | 0.3-0.8% | 0.2-0.6% |
Frequently Asked Questions
Explore the foundational concepts of the BIO tagging scheme, a critical token-level annotation standard for training sequence labeling models to parse legal document structure.
The BIO tagging scheme (also known as IOB or IOB2) is a token-level annotation standard used in sequence labeling tasks where each token in a text is tagged as the Beginning, Inside, or Outside of a named entity or structural chunk. In this scheme, the first token of a target entity receives a B- prefix (e.g., B-STATUTE), any subsequent token within the same entity receives an I- prefix (e.g., I-STATUTE), and any token not belonging to an entity of interest receives the O tag. This encoding allows machine learning models to learn precise entity boundaries, which is essential for extracting structured information like contract clauses, statutory citations, and party names from unstructured legal text. The scheme transforms a raw sentence into a parallel sequence of labels, enabling models such as Conditional Random Fields (CRFs) or transformer-based token classifiers to be trained on legal document structure parsing tasks.
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
The BIO tagging scheme is a foundational sequence labeling standard. These related concepts form the essential toolkit for implementing token-level classification in legal document structure parsing pipelines.
Token Classification for Boundaries
A machine learning approach that classifies each word or subword token in a sequence to determine if it constitutes the start or end of a structural element. This is the direct application layer where BIO tags serve as training labels.
- Input: Tokenized legal text sequence
- Output: Per-token structural label (e.g., B-PARTY, I-PARTY, O)
- Common architectures: BERT-based token classifiers, BiLSTM-CRF
- Legal use case: Identifying where a contract party name begins and ends within a preamble
Named Entity Recognition (NER)
A subtask of information extraction that seeks to locate and classify atomic elements in legal text into predefined categories such as person names, organizations, dates, and monetary amounts. BIO tagging is the standard encoding scheme for NER training data.
- Entity types in legal NER: PARTY, COURT, JUDGE, STATUTE, DATE, AMOUNT
- BIO example: 'Acme' → B-ORG, 'Corp' → I-ORG, 'shall' → O
- Downstream use: Populating legal knowledge graphs with extracted entities
Structural Role Classification
The task of assigning a functional label—such as 'title', 'recital', 'operative provision', or 'signature block'—to a segmented block of text within a legal document. BIO tagging can be extended to label structural boundaries, not just named entities.
- Structural BIO tags: B-TITLE, I-TITLE, B-RECITAL, I-RECITAL
- Purpose: Enables automatic table of contents generation and clause navigation
- Integration: Often combined with layout features from LayoutLM for spatial context
Section Boundary Detection
The algorithmic task of identifying the precise start and end points of logical sections within a legal document, such as articles, recitals, or schedules. BIO tagging provides the token-level precision needed to mark these boundaries.
- Challenge: Legal sections often span multiple pages with nested subsections
- Approach: Train a sequence labeler with B-SECTION and I-SECTION tags
- Output: Cleanly segmented document regions for downstream clause extraction
- Benefit: Enables precise cross-reference resolution by isolating target sections
Header Hierarchy Extraction
The process of identifying section titles and subtitles and reconstructing the nested parent-child relationships that form the document's outline. BIO tagging captures the token span of each heading, while post-processing reconstructs the hierarchy.
- Tag scheme extension: B-H1, I-H1, B-H2, I-H2 for multi-level headings
- Legal example: 'ARTICLE 1' → B-H1, 'Definitions' → I-H1
- Output: A structured outline tree for document navigation interfaces
Deontic Modality Extraction
The identification of linguistic markers in text that signal obligation, permission, or prohibition—such as 'shall', 'may', or 'must not'. BIO tagging can be adapted to label these modality-bearing tokens within operative provisions.
- Tag types: B-OBLIGATION, I-OBLIGATION, B-PERMISSION, I-PERMISSION
- Critical for: Automated compliance checking and obligation management
- Example: 'The Tenant shall pay rent' → 'shall' tagged as B-OBLIGATION
- Integration: Feeds into deontic logic modeling systems for normative reasoning

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