Biaffine attention is a neural scoring function that applies a bilinear transformation to pairs of vectors to compute a score for every possible directed arc in a sentence. Unlike traditional affine transformations that use a single weight matrix, the biaffine classifier uses a learned tensor to capture multiplicative interactions between a head vector and a dependent vector, preceded by distinct multi-layer perceptron (MLP) projections that reduce dimensionality and strip away irrelevant information before scoring.
Glossary
Biaffine Attention

What is Biaffine Attention?
A deep learning mechanism for scoring all possible directed relationships between tokens in a sequence using a bilinear transformation, enabling efficient global dependency parsing.
Introduced by Dozat and Manning in their Deep Biaffine Parser, this mechanism enables graph-based dependency parsing by producing a full n x n matrix of head-dependent scores in a single pass. The architecture applies separate deep biaffine attention heads for arc prediction and relation label classification, allowing the model to jointly optimize for identifying syntactic heads and assigning typed dependency relations while maintaining computational efficiency through the use of low-rank weight matrices.
Key Characteristics of Biaffine Attention
The architectural innovations that make deep biaffine attention the dominant scoring mechanism for graph-based dependency parsing.
Bilinear Scoring of Head-Dependent Pairs
Biaffine attention computes a score for every possible directed arc in a sentence using a bilinear transformation. Unlike a simple dot product, it applies a learned weight matrix between distinct head and dependent representations.
- Head vector and dependent vector are projected through separate feedforward layers
- A bilinear term (U) captures interactions between the two representations
- A linear term for the head and dependent individually is added for bias
- Produces an n×n score matrix for a sentence of length n
Deep MLP Preprocessing
Before scoring, both head and dependent representations are passed through deep multilayer perceptrons with ReLU activations. This depth is critical for performance.
- Reduces dimensionality and decorrelates features
- Allows the model to learn specialized representations for head-seeking vs. dependent-seeking roles
- Typically uses a single hidden layer with a fraction of the input dimension
- Dropout applied to prevent overfitting on smaller treebanks
Joint Arc and Label Prediction
The architecture simultaneously predicts both the unlabeled dependency arc and the relation label using separate biaffine classifiers that share the same underlying representations.
- Arc classifier: Scores all head-dependent pairs to build the tree structure
- Label classifier: Given a predicted head, scores all possible relation types (nsubj, dobj, etc.)
- Label scoring uses a tensor with a third dimension for each relation class
- Enables globally coherent predictions without pipeline error propagation
Maximum Spanning Tree Decoding
The biaffine score matrix is decoded into a valid dependency tree using the Chu-Liu/Edmonds algorithm, which finds the maximum spanning tree in a directed graph.
- Guarantees a well-formed tree with a single root and no cycles
- Handles non-projective dependencies natively, unlike transition-based methods
- Runs in O(n²) time, efficient for typical sentence lengths
- The root node is treated as a special token with its own learned representation
BiLSTM Contextual Encoding
In the original Dozat & Manning architecture, biaffine attention operates on top of bidirectional LSTM hidden states that capture long-range syntactic context.
- Character-level CNNs or word embeddings feed into a multi-layer BiLSTM
- Each token's hidden state encodes both left and right context
- Modern variants replace BiLSTMs with transformer encoders like BERT
- The biaffine layer remains the task-specific prediction head regardless of encoder choice
State-of-the-Art Accuracy
The deep biaffine parser achieved state-of-the-art results across multiple languages upon introduction and remains a foundational architecture.
- Reported 95.7% UAS and 94.1% LAS on English Penn Treebank
- Consistently outperforms transition-based parsers on morphologically rich languages
- The biaffine mechanism has been adopted for semantic role labeling and coreference resolution
- Serves as the parsing backbone in the Stanza NLP toolkit
Frequently Asked Questions
Clear, technically precise answers to the most common questions about the biaffine attention mechanism used in state-of-the-art dependency parsing.
Biaffine attention is a neural scoring mechanism that applies a bilinear transformation to compute pairwise scores between all possible head-dependent word pairs in a sentence for deep dependency parsing. Unlike simpler dot-product or additive attention, it uses a learned weight matrix U to capture asymmetric relationships: score(h, d) = h^T U d + W[h; d] + b. The term 'biaffine' refers to the combination of a bilinear form (h^T U d) with linear terms (W[h; d]), making it an affine function of the head vector when the dependent is fixed, and vice versa. This allows the model to learn distinct roles for heads and dependents, which is crucial because the features that make a word a good syntactic head differ from those that make it a good dependent. In practice, the mechanism operates on contextualized word representations from a BiLSTM or Transformer encoder, first projecting them through separate feedforward networks to produce distinct head and dependent representations, then scoring every possible arc in a single matrix operation for efficient global prediction.
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
Core concepts and architectures that contextualize biaffine attention within the broader dependency parsing ecosystem.
Graph-Based Parsing
A parsing paradigm that scores all possible dependency arcs simultaneously and finds the highest-scoring tree via the Chu-Liu/Edmonds algorithm. Biaffine attention is the de facto scoring mechanism for modern graph-based parsers because it computes pairwise scores for every head-dependent combination in a single matrix multiplication, enabling efficient global inference over the full sentence.
Arc-Factored Model
A first-order parsing assumption where the score of a dependency tree equals the sum of its individual arc scores, treating edges as independent. Biaffine attention naturally implements this factorization: the score for attaching token j as a dependent of head i depends only on their representations. This assumption makes maximum spanning tree decoding computationally tractable at O(n²).
Labeled Attachment Score (LAS)
The primary evaluation metric for dependency parsers, measuring the percentage of tokens assigned both the correct syntactic head and the correct dependency relation label. Biaffine parsers excel on LAS because they decouple head prediction from label prediction, using separate biaffine transformations optimized for each subtask.
Higher-Order Parsing
An extension beyond arc-factored models that incorporates features from sibling arcs or grandparent arcs to capture richer syntactic contexts. While basic biaffine attention models first-order interactions, the mechanism can be extended with triaffine or higher-order tensors to score arc combinations jointly, improving accuracy on complex constructions at increased computational cost.
Non-Projective Parsing
A dependency tree containing crossing arcs, common in languages with free word order like Czech or Dutch. Biaffine attention supports non-projective parsing because it scores all possible arcs independently, and the Chu-Liu/Edmonds decoding algorithm finds the optimal tree without enforcing projectivity constraints.

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