Masked Language Models

Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 9

11 cards in “9.5 Sequence labeling: named entity recognition” · whole deck

9.5 Sequence labeling: named entity recognition

  1. What is sequence labeling?
    Assigning each token a label from a small fixed set, e.g. named entity recognition or part-of-speech tagging.
  2. What is a named entity, and what is NER?
    Roughly anything referred to by a proper name: a person, location, organization. Named entity recognition finds the spans of text that are proper names and tags their type. The term is often extended to dates, times and prices.
  3. What are the four most common named entity types?
    PER (person), LOC (location), ORG (organization), GPE (geo-political entity).
  4. What is NER useful for?
    Linking text to knowledge sources like Wikipedia, measuring sentiment toward particular entities, and anonymizing text for privacy.
  5. Why is NER difficult?
    Segmentation ambiguity (which tokens form an entity span, when most words aren’t entities) and type ambiguity: Washington can be a person, a sports team (ORG), a city (LOC) or a government (GPE).
  6. What is BIO tagging?
    A way to turn span recognition into per-token labeling: B marks the first token of a span, I a token inside a span, O a token outside any span, with B and I tags per entity type (\(2n + 1\) tags for \(n\) types).
    wordBIOBIOES
    JaneB-PERB-PER
    VillanuevaI-PERE-PER
    ofOO
    UnitedB-ORGB-ORG
    AirlinesI-ORGE-ORG
    ChicagoB-LOCS-LOC
  7. What are IO and BIOES tagging?
    IO drops the B tag, losing information about where adjacent spans begin. BIOES adds E for the end of a span and S for a single-token span.
  8. How does an encoder do NER as sequence labeling?
    Pass each token’s final output vector through a classifier \(y_i = \text{softmax}(h^L_iW_K)\) over the \(k\) tags and take the argmax per token, or pass the distributions to a CRF layer that models tag transitions.
  9. How do you handle the mismatch between word-level BIO annotations and subword tokens?
    Training: give every subword token the tag of the word it came from. Decoding: use the tag predicted for the first subword of each word (or combine the subwords’ tag distributions).
  10. How is NER evaluated, and what is the unit of response?
    Precision, recall and F1 (with paired bootstrap tests for significance), counting entities, not words, as units: Jane Villanueva is one response.
  11. Why does segmentation complicate NER evaluation?
    Labeling only Jane instead of Jane Villanueva as PER causes two errors (a false positive and a false negative), and training is per word while evaluation is per entity.

Source