Conditional Random Fields › Summary
Language AI HandbookAll chapters Conditional Random Fields › SummaryOne section · Sections in this chapter12 / 13 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
Conditional Random Fields represent a fundamental advance in sequence labeling, shifting from generative to discriminative modeling to support richer feature representations.
Key concepts from this chapter:
Generative vs. Discriminative: HMMs model and derive predictions through Bayes' rule. CRFs directly model , avoiding independence assumptions about observations. This allows arbitrary overlapping features of the input sequence.
Log-Linear Formulation: CRFs define probabilities through weighted feature functions:
where is the label sequence, is the observation sequence, are learned weights, are feature functions, and normalizes the distribution. Feature functions capture both label-observation relationships (like HMM emissions) and label-label relationships (like HMM transitions), plus arbitrary combinations.
Partition Function: The normalization constant sums over all possible label sequences. The forward algorithm computes it efficiently in time using dynamic programming.
Inference: The Viterbi algorithm finds the most likely label sequence in time. Beam search provides an approximate alternative for very large label sets.
Feature Functions: CRF power comes from rich features:
- State features link observations to labels (word suffixes, capitalization, POS tags)
- Transition features capture label-label patterns (valid BIO transitions)
- Context features use surrounding words and their properties
Neural CRFs: Modern architectures combine neural networks (BiLSTMs, transformers) for feature learning with CRF layers for structured prediction. The neural network learns representations; the CRF enforces output constraints.
Implementation: Libraries like sklearn-crfsuite provide efficient CRF training and inference. Feature engineering remains important for traditional CRFs, while neural CRFs learn features automatically but require more training infrastructure.
CRFs transformed sequence labeling by providing a principled framework for combining rich, overlapping features with structured output constraints. They remain the foundation of production NER, POS tagging, and chunking systems, either as traditional feature-based models or as structured output layers in neural architectures. The next chapter explores CRF training in detail: the forward-backward algorithm, gradient computation, and optimization techniques that make learning possible.