A biaffine classifier is a neural layer that scores relationships between pairs of input vectors using a bilinear transformation—a function that is linear in each argument separately. Unlike a standard feedforward layer that operates on a single vector, a biaffine layer takes two distinct inputs and computes a score through a learned weight tensor, enabling the model to capture pairwise affinities directly.
Glossary
Biaffine Classifier

What is Biaffine Classifier?
A deep learning layer that applies a bilinear transformation to pairs of input vectors, commonly used in NER to score the relationship between the start and end tokens of an entity span.
In Named Entity Recognition, the biaffine classifier is employed to score every possible (start_token, end_token) pair within a sentence, producing a table of span candidates. This architecture, popularized by the Biaffine Parser for dependency parsing, eliminates the need for BIO tagging or CRF decoding by directly classifying spans, making it particularly effective for nested NER and flat span categorization tasks.
Key Features of Biaffine Classifiers
The biaffine classifier is a deep learning layer that applies a bilinear transformation to pairs of input vectors, enabling direct scoring of relationships between tokens for structured prediction tasks like Named Entity Recognition.
Bilinear Affine Transformation
The core mechanism applies a learned bilinear transformation to pairs of input vectors. Unlike a simple dot product or linear layer, the biaffine operation uses a learned weight matrix to capture asymmetric relationships between the start and end representations of a potential entity span. The operation computes score = x_start^T * W * x_end + U * [x_start; x_end] + b, where W models the interaction between the two vectors, U projects their concatenation, and b is a bias term. This allows the model to learn that certain start token representations are highly compatible with specific end token representations, directly encoding the structural prior that entities are contiguous spans.
Span Scoring Without CRF Decoding
Biaffine classifiers enable direct span enumeration by scoring all possible start-end token pairs in a sentence. For a sequence of length n, the model produces an n x n x c scoring tensor, where c is the number of entity types. This eliminates the need for Viterbi decoding or linear-chain CRFs, as the model independently scores each span rather than modeling global label sequence dependencies. The approach naturally handles nested NER scenarios where entities overlap, such as a person name embedded within an organization mention. During inference, spans exceeding a threshold score are selected, and non-maximum suppression resolves conflicting predictions.
Dual Feedforward Input Projections
Before the biaffine operation, two separate feedforward neural networks project the shared contextualized token representations into distinct start and end vector spaces. This is critical because the same token embedding from a model like BERT encodes different information depending on whether the token serves as a span start or span end. The start projection learns to identify tokens that initiate entities, while the end projection learns to recognize tokens that terminate them. These projections typically use a ReLU activation and dropout, creating an information bottleneck that forces the model to extract span-relevant features from the rich but general-purpose contextual embeddings.
Type-Specific Classification Head
The biaffine classifier incorporates a multi-class classification component that simultaneously predicts the entity type of each scored span. The weight matrix W is typically a tensor of shape d x d x c, where d is the hidden dimension and c is the number of entity classes. This means each entity type learns its own bilinear interaction pattern between start and end vectors. For example, the model can learn that PER entities have a distinct start-end interaction signature compared to LOC entities. The type-specific scoring enables the model to assign different confidence scores to the same span for different entity types, supporting fine-grained entity typing within a unified architecture.
Training with Span-Level Loss
Training uses a binary cross-entropy loss applied independently to each possible span in the sentence. The ground truth is a sparse matrix where valid entity spans are labeled as positive examples and all other spans are negative. This formulation treats NER as a set prediction problem rather than a sequence labeling problem. The loss function heavily penalizes false positives and false negatives at the span level. To handle the extreme class imbalance between the few true entities and the vast number of non-entity spans, techniques like focal loss or negative sampling are often employed to prevent the model from simply predicting all spans as negative.
Integration with Pre-Trained Encoders
Biaffine classifiers are typically stacked on top of transformer-based encoders like BERT, RoBERTa, or SpanBERT. The encoder produces contextualized token representations that capture long-range dependencies and semantic information. The biaffine layer then leverages these rich representations for span scoring. This architecture is end-to-end differentiable, allowing gradients from the span-level loss to flow back through the biaffine operation into the encoder during fine-tuning. The combination of a powerful pre-trained encoder with a structurally appropriate biaffine decoder consistently achieves state-of-the-art results on benchmarks like CoNLL-2003 and OntoNotes 5.0, particularly for nested and discontinuous entity recognition tasks.
Biaffine Classifier vs. Alternative Span Detection Methods
A technical comparison of the Biaffine Classifier against alternative methods for identifying entity spans in Named Entity Recognition tasks.
| Feature | Biaffine Classifier | CRF + BIO Tagging | Span Categorization |
|---|---|---|---|
Core Mechanism | Bilinear scoring of start-end token pairs | Linear-chain conditional probability over token labels | Direct enumeration and classification of candidate spans |
Span Representation | Concatenated start and end token vectors | Token-level emission scores | Pooled span representations from token embeddings |
Handles Nested Entities | |||
Handles Overlapping Entities | |||
Global Sequence Consistency | |||
Training Complexity | O(n²) pairwise scoring | O(n·|L|²) Viterbi decoding | O(n²) span enumeration |
Typical F1 on CoNLL-2003 | 93.5% | 93.1% | 92.8% |
Inference Speed | Parallelizable pairwise scoring | Sequential Viterbi decoding | Pruned span enumeration |
Frequently Asked Questions
Clear, technical answers to the most common questions about biaffine classifiers, their role in named entity recognition, and how they compare to alternative span-scoring architectures.
A biaffine classifier is a deep learning layer that applies a bilinear transformation to pairs of input vectors to produce a scalar score representing the affinity or relationship between them. In the context of Named Entity Recognition (NER), it is used to score the likelihood that a specific start token and end token form a valid entity span. The operation is defined as score(i, j) = h_i^T U h_j + W[h_i; h_j] + b, where h_i and h_j are the contextualized representations of the start and end tokens, U is a learned bilinear weight matrix, W is a learned linear weight matrix for the concatenated pair, and b is a bias term. This dual-affine formulation captures both multiplicative interactions between the two positions via U and additive features via W, making it more expressive than a simple dot-product or feedforward network. The output scores for all possible (start, end) pairs form a table, and spans exceeding a threshold are decoded as predicted entities. This architecture directly models span boundaries without relying on token-level BIO tagging or CRF decoding, making it a core component of modern span categorization pipelines.
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
Explore the core architectural components and training paradigms that surround the biaffine classifier in modern named entity recognition pipelines.
Mention-Level F1
The primary evaluation metric for span-based NER systems using biaffine classifiers. It computes the harmonic mean of precision and recall based on exact matches of entity span boundaries and their type classifications. A predicted entity is only counted as correct if both its start and end token positions and its entity type match the ground truth exactly.

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