Biaffine attention is a scoring function that computes a real-valued score for every pair of elements from two input sequences by applying a bilinear transformation with a learned weight matrix. Unlike simple dot-product attention, it introduces a distinct affine transformation to each input before the multiplicative interaction, enabling the model to separately weight the importance of a head word and its dependent before scoring their relationship.
Glossary
Biaffine Attention

What is Biaffine Attention?
A neural network operation that computes pairwise scores between two sequences using a low-rank bilinear transformation, widely adopted for dependency parsing and semantic role labeling.
In semantic role labeling, biaffine attention scores the compatibility between a predicate representation and every candidate argument span, producing a matrix of predicate-argument scores. This mechanism excels at capturing asymmetric relationships—where the influence of a predicate on its argument differs from the reverse—making it fundamentally more expressive than symmetric scoring functions for structured prediction tasks.
Key Features of Biaffine Attention
The biaffine attention mechanism is a specialized scoring function that computes pairwise affinity between two distinct input sequences—typically predicates and candidate arguments—using a low-rank bilinear transformation. It has become the standard classifier head in state-of-the-art dependency parsing and semantic role labeling systems.
Low-Rank Bilinear Scoring
Unlike a standard bilinear transformation that requires a full weight tensor, biaffine attention uses a low-rank factorization to reduce parameters. It computes the score between a head vector h and a dependent vector d as: s = h^T U d + W[h; d] + b. The U matrix captures multiplicative interactions, while the W term adds a linear component. This factorization prevents overfitting and dramatically reduces memory consumption when the number of possible relations is large.
Deep vs. Shallow Affine Components
The mechanism is called 'deep' biaffine when separate multi-layer perceptrons (MLPs) transform the input representations before the bilinear scoring. This creates a task-specific subspace for the head and dependent roles:
- Head MLP: Projects predicate representations into a lower-dimensional space optimized for governing relations
- Dependent MLP: Projects argument candidate representations into a space optimized for receiving relations
- Deep biaffine consistently outperforms shallow variants by learning non-linear interactions before the final affinity computation
Pairwise Independence Assumption
Biaffine attention scores each predicate-argument pair independently of other arguments. This design choice enables:
- Parallel computation: All candidate spans can be scored simultaneously against a predicate
- Global normalization: A softmax over all candidates produces a valid probability distribution
- Simplicity: No complex structured prediction or beam search is required during inference The independence assumption works well because the deep MLP encoders already capture contextual dependencies from the surrounding sentence.
Span Representation for SRL
In span-based SRL, biaffine attention scores arbitrary text spans rather than single tokens. A span from position i to j is represented by concatenating:
- The endpoint embeddings of the span boundaries from a BiLSTM or Transformer
- A span-width feature embedding to encode the length of the candidate argument
- An attention-weighted sum of all token representations within the span This representation is then fed through the dependent MLP before biaffine scoring against the predicate.
Label-Specific Scoring Tensors
For multi-class argument classification, the biaffine mechanism extends to a third-order tensor. Instead of a single score per pair, it produces a vector of scores—one for each semantic role label:
- The U matrix becomes a U tensor with dimensions
[d_head, d_dep, num_labels] - Each slice of the tensor corresponds to a specific role like ARG0, ARG1, or ARGM-LOC
- A softmax over the label dimension yields the probability distribution over possible semantic roles This allows the model to jointly identify and classify arguments in a single forward pass.
Integration with Pre-Trained Transformers
Modern implementations replace the original BiLSTM encoders with BERT or RoBERTa representations. The workflow becomes:
- Feed the sentence through a pre-trained Transformer to get contextualized token embeddings
- Apply the deep biaffine attention head directly on top of these embeddings
- Fine-tune the entire model end-to-end This combination achieves state-of-the-art results on the CoNLL-2012 and OntoNotes 5.0 benchmarks, with F1 scores exceeding 87% for span-based SRL.
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.
Frequently Asked Questions
Explore the core architectural questions surrounding biaffine attention, the deep learning scoring mechanism that revolutionized dependency parsing and semantic role labeling by computing pairwise affinity between predicates and their potential arguments.
Biaffine attention is a deep learning scoring mechanism that computes pairwise scores between two distinct vector representations—typically a predicate (head) and a candidate argument (dependent)—using a low-rank bilinear transformation. Unlike standard dot-product attention, which assumes a single representation space, biaffine attention introduces a learned affine transformation matrix that captures asymmetric relationships. The mechanism operates by first projecting the head vector and dependent vector through separate feedforward layers to decouple their representations. It then computes the score as: score = h^T U d + W[h; d] + b, where U is a learned bilinear weight tensor, W is a linear weight matrix for the concatenated vectors, and b is a bias term. This formulation allows the model to learn distinct interaction patterns for different relationship types, making it exceptionally effective for structured prediction tasks where the relationship between two elements is inherently directional and asymmetric.
Related Terms
Explore the core mechanisms and surrounding concepts that define how biaffine attention computes pairwise scores between predicates and their potential arguments.
Low-Rank Bilinear Transformation
The mathematical core of biaffine attention. Instead of a full weight tensor, it factorizes the transformation into two smaller matrices, drastically reducing parameters while preserving expressiveness.
- Mechanism: Computes
score = h_arg^T * U * h_predwhereUis a low-rank matrix. - Benefit: Prevents overfitting on small treebanks by limiting model capacity.
- Origin: Introduced by Dozat & Manning (2017) for dependency parsing.
Deep Biaffine Classifier
A specific instantiation of biaffine attention used for argument classification in SRL. It separately scores each candidate span against the predicate representation.
- Input: Contextualized embeddings for the predicate and a candidate argument span.
- Output: A probability distribution over semantic role labels (e.g.,
ARG0,ARG1,ARGM-LOC). - Advantage: Decouples the role label from the syntactic distance, allowing the model to learn label-specific affinities.
Dependency Arc Scoring
The original application of biaffine attention. It scores the likelihood of a directed edge between a head word and a dependent word in a syntactic parse tree.
- Head Score: Computes the probability that word
iis the syntactic head of wordj. - Label Score: A separate biaffine classifier predicts the specific dependency relation (e.g.,
nsubj,dobj). - Result: Enables globally optimal parsing via the Chu-Liu/Edmonds algorithm.
Span Representation Pooling
A critical preprocessing step for span-based SRL models using biaffine attention. Raw token embeddings within a candidate argument span must be aggregated into a fixed-size vector.
- Max Pooling: Takes the element-wise maximum across token embeddings.
- Mean Pooling: Averages token embeddings.
- Endpoint Concatenation: Concatenates only the first and last token embeddings, often combined with a learned span-width feature.
Pruning Candidate Arguments
To make biaffine scoring computationally feasible, the number of candidate spans must be drastically reduced before the attention calculation.
- Constituent Pruning: Uses a syntactic parser to propose only valid phrase-structure constituents.
- Heuristic Pruning: Filters spans by maximum width or total count.
- Learned Pruning: A lightweight feedforward network scores spans for likelihood of being any argument, keeping only the top-k candidates.
Multi-Task Learning with Syntax
Biaffine attention excels in architectures that jointly model syntactic parsing and semantic role labeling. Shared representations improve generalization.
- Shared Encoder: A single BiLSTM or Transformer processes the input text.
- Syntax Head: A biaffine arc scorer predicts the dependency tree.
- SRL Head: A biaffine classifier predicts semantic roles, using the syntactic head's hidden states as a structural prior.
- Benefit: Syntax acts as a regularizer, guiding the SRL model toward linguistically plausible argument boundaries.

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