Structured Prediction and Parsing Evaluation › Evaluating Parsers
Language AI HandbookAll chapters Two parsers can have similar LAS values and different error profiles. The aggregate score does not show which heads, labels, or constructions account for the difference.
Attachment Scores
The two standard dependency metrics are unlabeled attachment score and labeled attachment score:
where:
- : the number of evaluated tokens
- and : the predicted and gold heads for token
- and : the predicted and gold labels for token
- : the indicator that returns 1 when its condition holds and 0 otherwise
With the same aligned words and scoring mask, LAS is at most UAS. Their difference is the fraction of evaluated words whose head is correct but relation label is wrong. It is not the total rate of incorrect labels, because words with wrong heads already fail both metrics.
These formulas assume identical gold and predicted word segmentation, nonempty evaluation masks, and one predicted attachment per scored word. Otherwise word alignment and precision/recall denominators must be specified. Several choices change the quantity being measured:
- Punctuation. Declare the scorer's inclusion mask. The CoNLL 2018 UD shared-task protocol includes punctuation in LAS; another experiment may exclude it explicitly. Neither the direction nor size of a score change is universal.
- Root handling. In UD's CoNLL-U format, a lexical root has
HEAD=0, referring to a notional root, rather than pointing to itself. The hand-built fixtures below use zero-based lexical indices and a self-head root marker only as a documented local convention. The simulator later uses-1for the root; do not export either fixture representation as CoNLL-U without conversion. - Segmentation and alignment. UD distinguishes orthographic multiword tokens from syntactic words. In raw-text evaluation, the scorer aligns words and their heads before attachment comparison. The CoNLL 2018 scorer computes precision and recall over system and gold words, then F1, so segmentation failures cannot be handled merely by zipping rows.
- Labels and versions. Record the treebank release and label normalization. CoNLL 2018 truncates relation labels at the first colon for its primary LAS score.
objanddobjremain distinct base relations under that rule. The fixtures below compare literal labels on prealigned words using their declared root convention. - Basic versus enhanced dependencies. Basic UD annotations are trees; enhanced annotations can contain additional edges and empty nodes. Specify the target graph and edge-matching metric. An enhanced graph score cannot be compared with basic word-head accuracy as if the targets were identical.
For an aligned, fixed-word test set the simple attachment fractions are useful. For a shared-task result, use the published scorer and configuration rather than assuming that a short custom function reproduces every normalization and alignment rule. Keep the protocol beside the score so a reader can determine what a reported difference means.
What the Number Hides
UAS and LAS are averages, and averages hide distributions. Four breakdowns are worth computing routinely:
- UAS minus LAS. The gap counts label-only errors on correctly headed words. It motivates inspecting label decisions, but does not identify their cause: shared encoder features, label scoring, or training coverage may contribute.
- Accuracy by attachment distance. Measure accuracy by gold attachment distance rather than assuming all distances behave alike. For illustration, a system could have 92 UAS overall, 97 on distance-1 arcs, and 65 on distance-10 arcs; these are hypothetical values, not benchmark measurements. If your downstream task cares about long-distance dependencies, report accuracy for those attachments as well.
- Accuracy by direction. Compare accuracy on leftward and rightward gold attachments under the same scoring convention. Measure any difference for the target parser and corpus.
- Per-relation F1. A low-support relation can have poor precision or recall while contributing little to aggregate LAS. Report support alongside per-relation scores. Macro-averaging gives each included relation equal weight, with an explicit convention for absent labels.
Constituency Evaluation
PARSEVAL-style constituency scoring compares predicted labeled constituents with gold constituents after a specified normalization. Ordinary sets suffice when each labeled span occurs at most once in each scored output. Use multisets when repeated same-labeled unary constituents are scored separately:
where:
- : the multiset of scored labeled constituents the parser produced
- : the multiset of scored gold labeled constituents
- : matched constituent count, clipping each labeled-span multiplicity to the smaller gold/predicted count
- and : labeled precision and recall
A constituent matches only if its span endpoints and category label match under the declared normalization. Each displayed precision or recall ratio requires its own positive denominator. For F1, the equivalent count form gives zero when only one multiset is empty or when there are no matches. If both are empty, the denominator is zero and a scorer must declare a separate convention. PARSEVAL configurations also differ in the following ways:
- Punctuation.
EVALBuses a parameter file controlling removals and label equivalences, including punctuation treatment. Report that file and scorer version when comparing scores. - Unary rules. Whether unary productions count as separate constituents varies. PTB has many unary rules, so this matters.
- Preterminal tags. Specify whether POS preterminals are scored or excluded. Adding them changes the evaluated constituent population and can change the result; it does not guarantee an increase.
- Root. Whether the root node counts as a constituent.
- Sentence-level versus corpus-level averaging. Corpus micro-F1 pools matched, gold, and predicted counts before forming F1. Sentence macro-F1 averages the individual sentence F1 values. Relative to pooling, it gives sentences with fewer predicted and gold constituents in total more weight; either average can be larger depending on the error distribution.
Constituent F1 gives partial credit for each matched labeled span, regardless of whether that span controls an attachment distinction important to a downstream application. Producing only a few safe spans may preserve precision, but omitting other gold spans lowers recall; the metric does penalize that omission. Report sentence exact match alongside F1 when agreement on every scored constituent matters. It is the fraction of sentences whose entire scored multiset matches gold. To check full ordered-tree agreement, compare the normalized trees directly. A single wrong constituent makes exact match zero for that sentence even when most other spans are right. The relationship depends on sentence length and the evaluation configuration, so it should be measured rather than replaced by a universal benchmark percentage.
Exact Match and Sentence-Level Scores
Three dependency summaries answer different questions:
- Sentence exact match: the fraction of sentences for which every scored head and relation label agrees with gold. Name this criterion explicitly because metric labels differ between tools.
- Content-word attachment: a metric such as CLAS focuses attachment scoring on a declared content-relation subset. It remains a partial-credit attachment metric, not sentence exact match. The CoNLL 2018 protocol describes its morphology-aware extension MLAS and its relation inventory.
- Sentence macro-LAS: the mean of per-sentence LAS fractions, as opposed to micro-LAS over all scored words.
Sentence exact match cannot exceed sentence macro-LAS when both use the same positive-word masks: within each sentence, the exact-match indicator is at most that sentence's LAS. There is no fixed ordering against word-level micro-LAS because micro-LAS weights sentences by their scored word counts. Sentence macro-LAS and content-word LAS need not be lower than micro-LAS. Exact match records whether an error occurs anywhere in a sentence; it does not by itself establish that one error caused another. Distinguish this all-or-nothing criterion from causal error propagation in a particular parsing algorithm.
Statistical Significance
A small score difference may or may not be stable across samples. Compare systems on the same held-out inputs, report the effect size, and use an uncertainty procedure whose sampling unit matches the data. Dror et al. (2018) discuss how NLP tasks, metrics, and experimental designs affect significance-test selection.
- Paired bootstrap: for independent, identically distributed sentence pairs, resample the same sentence indices with replacement for both systems, recompute the corpus metric from pooled counts within each sample, and examine the distribution of score differences. If sentences within documents or speakers are dependent, resample those larger paired units when they are suitable and can be treated as independent and identically distributed. This ordinary paired bootstrap avoids a specified parametric score distribution, but still needs a representative sample of independent, identically distributed units. The interval construction and number of replicates should be stated.
- Paired binary tests: McNemar's test uses discordant outcomes where only A or only B is correct. Treating every attachment token as an independent observation can be inappropriate when errors within a sentence are dependent. A sentence-exact binary outcome can fit a paired test under independent sentence sampling; small discordant counts need an appropriate exact rather than large-sample approximation.
A measured 0.4-point LAS increase is an effect on the test set, even when its uncertainty includes zero. A significance result does not establish a practically useful difference, robustness to domain shift, or independence from training randomness. Keep development-based selection separate from the final test, and state whether uncertainty covers test sampling, training seeds, or both. This makes the comparison's claim narrower and more interpretable than treating an arbitrary point threshold as reliable or unreliable.
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!