← Lessons

quiz vs the machine

Gold1430

Machine Learning

The Sequence Labeling Task

Assign a label to every element of a sequence using surrounding context.

5 min read · core · beat Gold to climb

The Sequence Labeling Task

Sequence labeling assigns one label to each item in a sequence, such as a tag for every word in a sentence. Part of speech tagging and named entity recognition are both special cases of this general task.

Why labels depend on each other

Labels in a sequence are not independent. A noun rarely follows another determiner directly, and an entity inside tag cannot start a span. A good model scores whole label sequences, not each label alone.

  • The input is a sequence of tokens.
  • The output is a sequence of labels of the same length.
  • The model uses both the token features and the labels of neighbors.

Models that capture transitions

A conditional random field adds a layer that scores how compatible adjacent labels are, so it can forbid impossible transitions. Neural sequence models often place a conditional random field on top of an encoder to combine rich features with valid label structure.

Key idea

Sequence labeling tags every token while respecting dependencies between adjacent labels, often using a conditional random field to enforce valid label sequences.

Check yourself

Answer to earn rating on the learn ladder.

1. What is true about labels in a sequence labeling task?

2. What does a conditional random field add on top of an encoder?

3. Which tasks are special cases of sequence labeling?