Structured Prediction and Parsing Evaluation › The Structured Prediction Problem
Language AI HandbookAll chapters A structured predictor chooses a legal output for input , here a sentence of tokens. The legal set may depend on the input. A maximum-score decoder selects a highest-scoring legal output.
where:
- : the input, a sentence of tokens
- : a candidate output structure drawn from , the set of valid structures for
- : the legal output set for , such as all well-formed dependency trees over the tokens
- : the model's scalar score for structure given input ; higher is better
- : the highest-scoring structure, the decoder's output
In ordinary multiclass classification, the candidate labels usually form a fixed finite list. In parsing, sentence length sets the token positions for candidate attachments and the boundaries available for candidate spans. Constituent counts can vary between legal trees for the same sentence, for example through a unary chain. Well-formedness restricts which combinations are legal. A structured task can also have the same legal output set for every input. A decoder must account for output dependencies when they affect which outputs are legal or how those outputs score. The argmax chooses the highest score, with a fixed tie-breaking convention when several structures share that score.
For dependency parsing, is a set of arcs where is the head index, the modifier index, and a labeled relation. For constituency parsing, we use half-open token boundaries: covers token indices with label . Dependency chart intervals below are inclusive; the separate conventions will be stated where they are used. In both cases the parts must form one well-formed tree. Arcs or spans can be legal on their own and still be incompatible in the same tree.
Why the Output Space Is the Hard Part
For , the number of rooted directed trees on fixed word positions is when any word may be the root and arcs are directed from heads to dependents. Cayley's count gives undirected labeled trees; choosing one of roots fixes the outward orientation. Here we count the lexical arcs and omit an artificial-root edge. At the count is one by convention. For 20 words the unrestricted count is . If every lexical arc can independently take any of 40 labels, each unlabeled tree has labeled versions, giving about possibilities. This deliberately unconstrained label count ignores relation-specific grammatical restrictions.
Even an imaginary decoder examining a billion complete labeled trees each second would need about seconds to enumerate that example's labeled output space. The point is the count, not a hardware benchmark: exhaustive enumeration already fails at a sentence length that appears in ordinary text. Restricting the allowed structures helps, but it does not turn enumeration into a practical general decoder.
Projectivity helps, but not enough. A projective tree is one where every subtree occupies a contiguous span, so no two arcs cross. The projective-tree recurrence below gives an asymptotic exponential growth constant of , with a polynomial prefactor; this is much slower than the super-exponential count of unrestricted trees. The exponential factor alone is not a finite-length count. At , the recurrence gives exactly 47,365,474,641,870 projective trees, approximately , a reduction of eleven orders of magnitude that still leaves too many candidates for a practical exhaustive decoder.
The lesson is that exhaustive search is impractical. Exact maximization over an opaque table of candidate scores has no general shortcut: in the worst case every entry must be examined. The decoders here exploit the specified factorization and legal output structure.
Factorizing the Score
The exact charts below use decomposability of the score. Instead of scoring a tree as an opaque object, score it as a sum over its parts:
where:
- : the score assigned to structure given input , built as a sum over its parts
- : the scored part occurrences in , such as arcs, labeled span occurrences, or production uses. A repeated part contributes once per occurrence.
- : the local score for one part given input
If the parts are arcs, the model is called arc-factored or first-order:
where:
- : an arc in with head , modifier , and label
- : the model's weight vector, with one entry for each of features
- : the feature vector for that arc given the input
An arc score may use the head word, dependent word, their distance, tags, or contextual representations computed from the entire input sentence. Arc factorization restricts dependence on the selected output: the score of one arc does not change according to which other arcs the decoder selects. It does not require a narrow input window. This distinction lets a contextual neural encoder use sentence-wide information while the structural decoder still optimizes a sum of individual arc scores.
A factorization is a choice of which subsets of the output get their own score. The score of the whole is the sum of the scores of the parts. Changing the factorization can change the model family, decoding algorithm, and computational cost. Different factorizations need not have different asymptotic costs; the chart states and algorithm also matter.
The factorization and the decoder's state design jointly determine complexity. The examples below exclude the cost of computing neural or hand-built part scores; is the number of arc labels and the number of binary grammar rules.
| Parts | Model family | Exact decoder example | Time |
|---|---|---|---|
| arc | first-order | Eisner, projective | |
| arc | first-order | optimized Chu-Liu/Edmonds arborescence | |
| labeled arc , independent labels | labeled first-order | label maximization plus Eisner | |
| successive same-side sibling pair | second-order, two arcs | sibling chart | |
| grandparent chain | second-order, two arcs | grandparent-augmented chart | |
| grand-sibling, three arcs | third-order | Koo and Collins chart | |
| labeled spans with binary rule constraints | constituency | CKY enumerating binary rules | $O(n^3 |
| production | weighted CFG or PCFG | CKY | $O(n^3 |
Order counts arcs in a part, not the number of word indices: a grandparent chain has two arcs and is second-order. Richer parts can require extra state, but each increase in order does not automatically add a power of . Koo and Collins (2010) describe cubic parsing with successive modifiers on the same side of their head and quartic grandparent and selected third-order parsers. For non-projective arborescences the table gives an optimized bound; a straightforward recursive Chu-Liu/Edmonds implementation can take cubic time. Enforcing exactly one lexical root child may add work beyond an unconstrained arborescence call. McDonald et al. (2005) explain the edge-factored reduction and its decoder implementations.
Neural scoring can change the information used to assign each part's score without changing that factorization. This makes it useful to report encoder/scorer cost separately from structural decoding cost when comparing complete systems.
The chart below compares illustrative operation counts for candidate lexical arcs, cubic charts, and quartic charts. They are operation-count surrogates with their constants suppressed, not measured timings or a universal mapping from model order to runtime. In particular, adjacent-sibling and first-order projective parsing can both be cubic.
PythonIn [3]Expand
import numpy as np
n_values = np.arange(5, 41)
candidate_arc_counts = n_values.astype(float) * (n_values - 1)
cubic_growth = n_values.astype(float) ** 3
quartic_growth = n_values.astype(float) ** 4VisualizationOut [4]Expand

The Price of Richer Parts
Why not score every complete tree with an unrestricted neural network? Without additional exploitable structure, an exact maximization would need to examine candidates that cannot be merged into reusable chart states. Exact enumeration is possible on tiny inputs, but the sentence-length count above makes it impractical in general. A system may instead use a restricted candidate list, beam search, or another approximate method. The appropriate claim is about this unrestricted scorer: it does not itself supply an efficient exact decoder or partition-function computation.
For chart-based parsing, a useful factorization balances the distinctions retained in a state against the cost of combining states. Larger parts can express interactions among selected arcs, but their tractability depends on the interaction pattern and the chosen algorithm. Other structured predictors can exploit graph algorithms, integer programming, or special problem structure instead of a chart. Identifying that structure is a modeling step, not a property guaranteed by the words “structured prediction.”
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!