A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Sequence Labeling and CRFs

Research Depth 109 in the knowledge graph I know this Set as goal
783prerequisites beneath it
See this on the map →
Hidden Markov ModelsNamed Entity Recognition (NER)
sequence-labeling crf structured

Core Idea

Sequence labeling assigns labels to each element in a sequence (part-of-speech tagging, named entity recognition). Conditional Random Fields (CRFs) model label dependencies, capturing that consecutive labels influence each other. As discriminative models, CRFs typically outperform generative HMMs for sequence labeling tasks.

Explainer

From your study of Hidden Markov Models, you understand the basic structure of sequence labeling: given a sequence of observations (words in a sentence, characters in a string, signals in a time series), assign a label to each position. In part-of-speech tagging, the input "The cat sat" gets labels [DET, NOUN, VERB]. In named entity recognition, "Barack Obama visited Paris" might get [B-PER, I-PER, O, B-LOC]. The challenge is that labels are not independent — knowing the current word is tagged as a determiner makes it much more likely that the next word is a noun.

HMMs handle these dependencies by modeling the joint probability P(observations, labels) as a product of emission probabilities (how likely is this word given this tag?) and transition probabilities (how likely is this tag given the previous tag?). But HMMs make a strong independence assumption: the probability of observing a word depends *only* on its tag, not on the surrounding words or any other features. This means an HMM cannot easily use rich features like "the word ends in -ing" or "the previous word is capitalized" without dramatically expanding the state space.

Conditional Random Fields (CRFs) solve this by modeling the conditional probability P(labels | observations) directly, without modeling how observations are generated. This discriminative approach means CRFs can incorporate arbitrary feature functions that examine any part of the input sequence — the current word, neighboring words, capitalization patterns, suffixes, prefixes — without worrying about their joint distribution. A linear-chain CRF defines a score for each label sequence as a weighted sum of feature functions evaluated at each position and each pair of adjacent labels, then normalizes over all possible label sequences to produce a valid probability distribution.

Training a CRF means finding feature weights that maximize the conditional likelihood of the correct label sequences in the training data. Inference — finding the most probable label sequence for a new input — uses the Viterbi algorithm, the same dynamic programming approach you learned for HMMs. The partition function (normalizing constant) is computed with the forward algorithm, again borrowed from HMMs. The algorithmic machinery is familiar; the difference is entirely in what is being modeled. Because CRFs are discriminative and feature-rich, they consistently outperform HMMs on tasks like POS tagging and NER. Modern systems often combine a neural network (BiLSTM or Transformer) to produce contextualized features with a CRF layer on top to enforce label consistency — getting the best of learned representations and structured prediction.

Practice Questions 5 questions

Prerequisite Chain

Understanding ZeroThe Number ZeroCounting to FiveCounting to 10Counting to 20Counting a Set of Objects Up to 20Cardinality: The Last Number CountedMatching Numerals to QuantitiesSubitizing Small QuantitiesAddition Within 10Number Bonds to 10Addition Within 20Doubles and Near DoublesDoubles Facts Within 10Near Doubles Facts Within 20Mental Math Strategies for AdditionMental Math: Adding and Subtracting TensAddition Within 100Repeated Addition as MultiplicationMultiplication as Equal GroupsMultiplication: ArraysBasic Multiplication Facts (0s, 1s, 2s, 5s, 10s)Multiplication Facts Within 100Division as Equal SharingDivision as Grouping (Measurement Division)Division: Grouping (Repeated Subtraction) ModelDivision: Fair Sharing ModelDivision as Equal SharingDivision as GroupingBasic Division FactsDivision Facts Within 100Multiplication and Division Fact FamiliesRelationship Between Multiplication and DivisionDivision Facts as Inverse of MultiplicationRemainders and Quotients in DivisionDivision Word ProblemsMulti-Step Word ProblemsSolving Multi-Step Word ProblemsMultiplication Word ProblemsDivision Word ProblemsIntroduction to Long DivisionFactors and MultiplesPrime and Composite NumbersEquivalent FractionsRelating Fractions and DecimalsDecimal Place ValueIntegers and the Number LineComparing and Ordering IntegersAbsolute ValueAdding IntegersSubtracting IntegersMultiplying IntegersDividing IntegersUnit RatesProportionsPercent ConceptConverting Between Fractions, Decimals, and PercentsOperations with Rational NumbersTwo-Step EquationsSolving Multi-Step EquationsEquations with Variables on Both SidesAngle Pairs: Complementary, Supplementary, and VerticalParallel Lines and TransversalsCorresponding AnglesAlternate Interior AnglesTriangle Angle Sum TheoremExterior Angle TheoremTriangle Inequality TheoremSimilar Triangles: AA SimilaritySimilar Triangles: SSS and SAS SimilarityProportions in Similar TrianglesRight Triangle Trigonometry IntroductionSine, Cosine, and Tangent RatiosTrigonometric Ratios ReviewRadian MeasureConverting Between Degrees and RadiansThe Unit CircleGraphing Sine and CosineGraphing Tangent and Reciprocal Trigonometric FunctionsDerivatives of Trigonometric FunctionsAntiderivativesIndefinite IntegralsBasic Integration RulesRiemann SumsDefinite Integral DefinitionProbability Density Functions and Continuous DistributionsCumulative Distribution FunctionsContinuous Random VariablesProbability Density FunctionsExpected ValueWeak Law of Large NumbersProbability Axioms and RulesConditional ProbabilityConditional DistributionsConditional ExpectationMarkov ChainsMarkov Decision ProcessesIntroduction to Reinforcement LearningPolicy Gradient MethodsPolicy Networks and Policy GradientsActor-Critic MethodsTemporal Difference LearningQ-Learning AlgorithmDeep Q-Networks (DQN)Recurrent Neural NetworksLSTM and Gated Recurrent UnitsGated Recurrent Units (GRU)Sequence-to-Sequence ModelsNamed Entity Recognition (NER)Sequence Labeling and CRFs

Longest path: 110 steps · 783 total prerequisite topics

Prerequisites (2)

Leads To (0)

No topics depend on this one yet.