Structured Prediction and Parsing Evaluation › Worked Example: UAS and LAS by Hand

Michael BrenndoerferNovember 17, 20263 min read
Language AI HandbookAll chapters
Part 7 of 67Linguistic Form: Morphology and Syntax
Chapter 49Structured Prediction and Parsing Evaluation › Worked Example: UAS and LAS by Hand
Reading section 9 of 14 · Worked Example: UAS and LAS by Hand · 3 minSection 9 of 14 · 3 min

Section 9 of 14 · 3 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

Take this hand-built teaching fixture with fixed tokenization. Heads are zero-based lexical indices and the root points to itself as a local marker. Labels follow an older dependency-label style, with a deliberately different predicted obj string; this is not a UD v2 or official EVALB/shared-task example. All 11 words, including punctuation and the locally marked root, are scored exactly as written.

Fixed annotations used to calculate attachment fractions by hand.
iTokenGold headGold labelPred headPred label
0The2det2det
1old2amod2amod
2man7nsubj7nsubj
3who4nsubj4nsubj
4lives2rcmod7rcmod
5next6amod6amod
6door4npadvmod4npadvmod
7reads7root7root
8many9amod9amod
9books7dobj7obj
10.7punct7punct

Count the errors:

  • Token 4: predicted head 7, gold head 2. Head wrong. Counts against both UAS and LAS.
  • Token 9: predicted head 7 (correct), predicted label obj (gold dobj). Head right, label wrong. Counts against LAS only.

So N=11N = 11, head errors =1= 1, label-only errors =1= 1.

UAS=11−111≈0.909,LAS=11−211≈0.818\text{UAS} = \frac{11 - 1}{11} \approx 0.909, \qquad \text{LAS} = \frac{11 - 2}{11} \approx 0.818

The gap is 1/111/11, approximately 9.09 percentage points, and comes from the one label-only error. UAS alone would miss that label mismatch; LAS alone would combine it with the head error. Looking at the two scores and the token-level errors reveals both defects in this fixture. Whether either error matters more downstream cannot be read from their equal contribution to the aggregate.

Now suppose the model produced the exact same heads but every label was wrong. UAS would stay at approximately 0.909 while LAS dropped to 0.0. This is why reporting both matters, and why the UAS-LAS gap is a diagnostic rather than a nuisance.

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!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy