Boundary detection is the process of segmenting a text sequence to locate the exact character offsets or token indices where a named entity begins and ends. Unlike full Named Entity Recognition (NER), which jointly identifies spans and assigns a type label, boundary detection is a binary segmentation task that asks only "is this a named entity?" without determining if it is a person, organization, or location. This decoupling allows for granular evaluation of a model's ability to find entity mentions, a critical capability measured by Mention-Level F1 scores that penalize both partial matches and missed boundaries.
Glossary
Boundary Detection

What is Boundary Detection?
Boundary detection is the foundational subtask of Named Entity Recognition that focuses exclusively on identifying the precise start and end points of an entity mention in text, evaluated independently of its semantic classification.
In modern sequence labeling architectures, boundary detection is often implicitly learned through BIO tagging schemes where 'B' and 'I' tokens define span edges, or explicitly modeled using Span Categorization and Global Pointer methods that score all possible start-end token pairs. Accurate boundary detection is particularly challenging in Nested NER scenarios where entities overlap, and in domains with ambiguous multi-word expressions. A model that perfectly classifies entity types but fails to detect correct boundaries produces unusable extractions, making span localization the non-negotiable first step in any information extraction pipeline.
Key Characteristics of Boundary Detection
Boundary detection isolates the precise start and end points of entity mentions, a foundational step evaluated independently of type classification accuracy.
Span Identification
The core mechanism involves predicting the exact token indices where an entity begins and ends. Unlike sequence labeling which classifies every token, boundary-focused models often score start-end pair representations directly. This is evaluated using span-level F1, which requires an exact match of the offsets, making it a stricter metric than token-level accuracy.
BIO Tagging Scheme
A token-level annotation format where tokens are tagged as B (Beginning), I (Inside), or O (Outside). Boundary detection is implicit in the transition from O to B and B to I. A common error is a B-I mismatch, where an I-tag follows an O-tag, indicating a false start. This scheme is the standard output for linear-chain CRF models.
Global Pointer Architecture
An architecture that bypasses token-level classification by using multiplicative attention to score all possible (start, end) token pairs in a sentence. It identifies entities by recognizing that the vector representation of a start token and an end token should have a high affinity. This method naturally handles nested entities without the constraints of a linear-chain CRF.
Mention-Level Evaluation
Performance is measured using Mention-Level F1, which computes the harmonic mean of precision and recall based on exact span matches. A prediction is only a true positive if both the left and right boundaries are perfectly aligned with the gold standard annotation. This metric is far more stringent than token-level accuracy, which can be inflated by the high frequency of the O tag.
Semi-Markov CRF
A segment-level sequence model that directly models the probability of entire entity spans rather than individual tokens. Unlike a linear-chain CRF, it allows features to be defined over the entire multi-token segment, such as the phrase's internal syntactic structure. This provides a principled probabilistic framework for boundary detection with segment-level consistency.
Viterbi Decoding
A dynamic programming algorithm used to find the most probable sequence of hidden states (e.g., BIO tags) in a linear-chain CRF. It efficiently computes the maximum over all possible label paths, ensuring that the output sequence is globally coherent. This prevents illegal transitions, such as an I-ORG tag following a B-PER tag, enforcing valid boundary structures.
Frequently Asked Questions
Explore the critical subtask of Named Entity Recognition that focuses exclusively on identifying the precise start and end points of entity mentions, evaluated independently of type classification accuracy.
Boundary detection is the NER subtask focused solely on identifying the start and end character offsets of entity mentions in unstructured text, evaluated independently of whether the entity type is correctly classified. While standard NER evaluates both span boundaries and type labels together using metrics like Mention-Level F1, boundary detection isolates the model's ability to locate entities. A system correctly detects a boundary if it identifies the exact token span for "Apple Inc." even if it misclassifies the entity as a LOCATION instead of an ORGANIZATION. This separation is crucial for debugging NER pipelines, as boundary errors and type errors often stem from different architectural weaknesses. Modern span-based architectures like SpanBERT and Global Pointer have significantly improved boundary detection by directly modeling span representations rather than relying on token-level BIO tagging schemes.
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.
Boundary Detection vs. Related NER Evaluation Concepts
How boundary detection evaluation differs from related NER assessment methodologies in scope, metrics, and application.
| Feature | Boundary Detection | Mention-Level F1 | BIO Tagging Accuracy |
|---|---|---|---|
Primary evaluation focus | Span offset correctness only | Exact span + type match | Per-token label correctness |
Type classification required | |||
Penalizes type errors | |||
Penalizes boundary errors | |||
Partial credit for overlapping spans | |||
Evaluates segmentation independently | |||
Standard metric | Boundary F1 | MUC/CEAF/Exact Match F1 | Token-level accuracy |
Used in CoNLL-2003 evaluation |
Related Terms
Boundary detection is the foundational step in entity extraction. These related concepts define how spans are identified, evaluated, and integrated into the broader NER workflow.
BIO Tagging
The standard token-level annotation scheme for sequence labeling. Each token is tagged as B (Beginning), I (Inside), or O (Outside) of a named entity span.
- B-PER: First token of a person entity
- I-PER: Subsequent tokens of a person entity
- O: Token not part of any entity
Boundary errors occur when a model predicts I-PER without a preceding B-PER, creating an illegal transition that violates the schema's constraints.
Span Categorization
A NER paradigm that bypasses token-level BIO tagging entirely. The model directly enumerates all possible text spans up to a maximum length and classifies each as an entity type or null.
- Flat NER: Enumerates spans from a single layer
- Enumeration: Scores all start-end token pairs
- Advantage: Eliminates illegal BIO transitions by design
This approach naturally handles nested entities without the structural limitations of linear-chain sequence models.
Mention-Level F1
The primary evaluation metric for boundary detection quality. A predicted entity is counted as correct only if both its span boundaries and its type classification match the gold standard exactly.
- Precision: Correct predictions / Total predictions
- Recall: Correct predictions / Total gold entities
- F1: Harmonic mean of precision and recall
A boundary-only F1 variant evaluates span detection independently of type accuracy, isolating the model's segmentation performance.
Viterbi Decoding
A dynamic programming algorithm that finds the most probable sequence of hidden states in a linear-chain Conditional Random Field (CRF). It efficiently computes the maximum over all possible label paths.
- Input: Emission scores from a neural encoder
- Output: Globally optimal BIO tag sequence
- Constraint: Learns valid transitions (e.g.,
I-PERmust followB-PER)
Viterbi decoding enforces structural consistency, dramatically reducing illegal boundary predictions compared to independent token classification.
Biaffine Classifier
A deep learning layer that applies a bilinear transformation to pairs of input vectors. In span-based NER, it scores the relationship between the start token and end token of a candidate entity.
- Mechanism:
score(i,j) = h_i^T U h_j + W[h_i; h_j] + b - Output: A score for every possible span in the sentence
- Advantage: Models the start-end dependency directly
Used in architectures like Global Pointer to replace CRF layers while maintaining global span coherence.
CoNLL-2003
The benchmark dataset and shared task that established the standard evaluation methodology for language-independent NER. It defines four entity types evaluated with exact boundary matching.
- Entity Types: PER, LOC, ORG, MISC
- Languages: English and German news wire text
- Metric: Mention-level F1 with exact span matching
A boundary detection error on CoNLL-2003—such as predicting "Bank of" instead of "Bank of America"—results in a complete miss, penalizing both precision and recall.

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