Sequence labeling is a type of pattern recognition task in machine learning that involves the algorithmic assignment of a categorical label to each member of a sequence of observed values. It is a well-established concept with reliable encyclopedic sources, including coverage in Wikipedia and standard natural language processing (NLP) literature.
Definition
Formally, given an input sequence of observations $x = (x_1, \ldots, x_n)$, a sequence labeling system produces an output sequence of labels $y = (y_1, \ldots, y_n)$ of the same length, where each $y_i$ is the label assigned to $x_i$.
Approaches
Sequence labeling can be treated as a set of independent classification tasks, one per member of the sequence. However, accuracy is generally improved by making the optimal label for a given element dependent on the choices of nearby elements, using algorithms that select the globally best set of labels for the entire sequence at once.
The rationale for joint (structured) prediction is that the correct label of an ambiguous element may often be deduced from the correct labels of adjacent elements. The word "sets", for example, can be either a noun or a verb; its correct part of speech can frequently be resolved by the labels of neighboring words.
Statistical models
Most sequence labeling algorithms are probabilistic in nature, relying on statistical inference to find the best label sequence. The most common statistical models make a Markov assumption — that the label for a particular element depends directly only on the immediately adjacent labels — so that the sequence of labels forms a Markov chain. This leads naturally to the hidden Markov model (HMM), one of the most frequently used models for sequence labeling. Other common models include the maximum entropy Markov model (MEMM) and the conditional random field (CRF).
Approaches are frequently categorized as either generative (e.g., HMMs) or discriminative (e.g., CRFs, structured support vector machines). Modern neural approaches commonly use bidirectional recurrent neural networks and, more recently, transformer-based encoders, often combined with a CRF output layer for structured decoding. Inference over such models is typically performed using dynamic programming algorithms such as the Viterbi algorithm, while learning can use the forward–backward algorithm.
Applications
Common sequence labeling tasks include:
- Part-of-speech (POS) tagging — assigning a grammatical category to each word in a sentence.
- Named entity recognition (NER) — identifying spans such as persons, organizations, and locations, typically encoded with the BIO (Beginning, Inside, Outside) tagging scheme.
- Chunking / shallow parsing — grouping words into syntactic constituents.
- Chinese word segmentation — labeling characters by their position within words.
- Speech and handwriting recognition — where the input is a sequence of acoustic or image observations rather than words.
- Slot filling in task-oriented dialogue — extracting structured values from user utterances.
Related concepts
Sequence labeling is closely related to structured prediction, classification (machine learning), Bayesian networks (of which HMMs are an example), and pattern recognition. A mathematically analogous task in which the "label" is a real number rather than a category is handled by linear dynamical systems.
References
- Wikipedia contributors, "Sequence labeling," Wikipedia.
- Erdogan, H. "Sequence labeling: generative and discriminative approaches, hidden Markov models, conditional random fields and structured SVMs," ICMLA 2010 tutorial, Bethesda, MD (2010).
- Course notes: "Sequence labeling," Natural Language Processing (NYU CS2590).
- Jurafsky, D. and Martin, J. H., Speech and Language Processing (standard NLP textbook).