Conditional Random Fields: Probabilistic Models for Segmenting and Labeling Sequence Data

Lafferty et al., 2001, Conditional Random Fields (Proceedings of the 18th International Conference on Machine Learning (ICML))

Subscriber deck — free during early access

25 cards

1 Introduction

  1. What are conditional random fields (CRFs)?
    Discriminative probabilistic models for segmenting and labeling sequence data that define a single globally normalized conditional distribution \(p(\mathbf{y} \mid \mathbf{x})\) over whole label sequences, relaxing the independence assumptions of HMMs and avoiding the label bias problem of MEMMs.
    • Lafferty et al., 2001, Conditional Random Fields (Proceedings of the 18th International Conference on Machine Learning (ICML)), §1
  2. Why is it hard for generative models like HMMs to use rich features of the observations?
    A generative model defines a joint probability, so it must model the observations themselves; that requires enumerating observation sequences, typically as atomic units (words), and strict independence assumptions. Multiple interacting features or long-range dependencies make inference intractable.
    • Lafferty et al., 2001, Conditional Random Fields (Proceedings of the 18th International Conference on Machine Learning (ICML)), §1
  3. What advantages do conditional models of label sequences have?
    They don’t spend modelling effort on the observations, which are fixed at test time anyway; the label probabilities can depend on arbitrary, non-independent features of the whole observation sequence (words and characters, layout, past and future observations) without modelling their distribution.
    • Lafferty et al., 2001, Conditional Random Fields (Proceedings of the 18th International Conference on Machine Learning (ICML)), §1
  4. What is a maximum entropy Markov model (MEMM)?
    A conditional sequence model in which each source state has an exponential (maxent) model giving a distribution over next states given the current observation features (McCallum et al. 2000).
    • Lafferty et al., 2001, Conditional Random Fields (Proceedings of the 18th International Conference on Machine Learning (ICML)), §1
  5. What is the label bias problem?
    In MEMMs and other models with per-state normalized next-state classifiers, transitions out of a state compete only with each other. All probability mass arriving at a state must be passed on (“conservation of score mass”): observations affect where it goes but not how much, biasing toward states with few outgoing transitions; a state with one outgoing transition ignores its observation entirely.
    • Lafferty et al., 2001, Conditional Random Fields (Proceedings of the 18th International Conference on Machine Learning (ICML)), §1
  6. What is the critical difference between a CRF and an MEMM?
    An MEMM uses per-state exponential models for next-state probabilities given the current state; a CRF has a single exponential model for the joint probability of the entire label sequence given the observations, so feature weights at different states can be traded off against each other.
    • Lafferty et al., 2001, Conditional Random Fields (Proceedings of the 18th International Conference on Machine Learning (ICML)), §1

2 The label bias problem

  1. Explain the label bias problem with the rib/rob example.
    A finite-state model branches at r into a path for rib (state 1) and one for rob (state 4). On input r i b, both states 1 and 4 have a single outgoing transition, so state 4 must pass on all its mass though it has rarely seen i: the two paths stay about equally likely regardless of the observations, and whichever word was slightly more frequent in training always wins.
    012453r : _r : _i : _o : _b : ribb : rob
    States 1 and 4 each have one exit, so they ignore whether they see i or o
    • Lafferty et al., 2001, Conditional Random Fields (Proceedings of the 18th International Conference on Machine Learning (ICML)), §2
  2. What remedies did Bottou propose for label bias, and why are they unsatisfactory?
    Changing the state structure, e.g. collapsing states 1 and 4 to delay branching (determinization, not always possible and can explode combinatorially); or starting fully connected and letting training find structure, which discards valuable prior structural knowledge.
    • Lafferty et al., 2001, Conditional Random Fields (Proceedings of the 18th International Conference on Machine Learning (ICML)), §2
  3. What property must a proper solution to label bias have?
    It must score whole state sequences at once, letting some transitions “vote” more strongly than others depending on the observations: score mass isn’t conserved, and transitions can amplify or dampen the mass they receive.
    • Lafferty et al., 2001, Conditional Random Fields (Proceedings of the 18th International Conference on Machine Learning (ICML)), §2

3 Conditional random fields

  1. Define a conditional random field.
    Let \(G = (V, E)\) be a graph indexing the label variables \(\mathbf{Y} = (Y_v)_{v \in V}\). \((\mathbf{X}, \mathbf{Y})\) is a CRF if, conditioned on \(\mathbf{X}\), each \(Y_v\) obeys the Markov property with respect to \(G\): \(p(Y_v \mid \mathbf{X}, Y_w, w \neq v) = p(Y_v \mid \mathbf{X}, Y_w, w \sim v)\). It is a random field globally conditioned on the observations.
    • Lafferty et al., 2001, Conditional Random Fields (Proceedings of the 18th International Conference on Machine Learning (ICML)), §3
  2. What form does a linear-chain CRF take?
    By the Hammersley–Clifford theorem, with edge features \(f_k\) and vertex features \(g_k\): \(p_\theta(\mathbf{y} \mid \mathbf{x}) \propto \exp\big(\sum_{e,k} \lambda_k f_k(e, \mathbf{y}|_e, \mathbf{x}) + \sum_{v,k} \mu_k g_k(v, \mathbf{y}|_v, \mathbf{x})\big)\), normalized by an observation-dependent \(Z(\mathbf{x})\).
    • Lafferty et al., 2001, Conditional Random Fields (Proceedings of the 18th International Conference on Machine Learning (ICML)), §3
  3. Give an example of a CRF vertex feature.
    A Boolean \(g_k\) true if word \(X_i\) is upper case and tag \(Y_i\) is “proper noun”. Features need not fully specify a state or observation, and can look at any part of \(\mathbf{x}\).
    • Lafferty et al., 2001, Conditional Random Fields (Proceedings of the 18th International Conference on Machine Learning (ICML)), §3
  4. How is an HMM-like CRF constructed, and how does it differ from an HMM?
    With one feature per label pair \((y', y)\) and one per label–observation pair \((y, x)\); their weights \(\lambda_{y',y}\), \(\mu_{y,x}\) play the role of log transition and emission probabilities. But CRFs normalize per observation sequence, \(Z(\mathbf{x})\), giving conditional rather than joint distributions, and can add arbitrary observation features.
    • Lafferty et al., 2001, Conditional Random Fields (Proceedings of the 18th International Conference on Machine Learning (ICML)), §3
  5. Compare the graphical structures of HMMs, MEMMs and linear-chain CRFs.
    HMMMEMMCRFyxopen: observations not generated by the model
    HMM: labels generate observations (directed). MEMM: each label conditioned on the previous label and observation, normalized per state. CRF: an undirected chain over labels, globally conditioned on all observations.
    • Lafferty et al., 2001, Conditional Random Fields (Proceedings of the 18th International Conference on Machine Learning (ICML)), §3
  6. How is a chain CRF written in matrix form, and how is its partition function computed?
    For each position define \(M_i(y', y \mid \mathbf{x}) = \exp(\Lambda_i(y', y \mid \mathbf{x}))\) from the edge and vertex features there. Then \(p(\mathbf{y} \mid \mathbf{x}) = \prod_i M_i(y_{i-1}, y_i \mid \mathbf{x}) / Z(\mathbf{x})\) and \(Z(\mathbf{x}) = (M_1 M_2 \cdots M_{n+1})_{\text{start}, \text{stop}}\), computed directly for the given \(\mathbf{x}\).
    • Lafferty et al., 2001, Conditional Random Fields (Proceedings of the 18th International Conference on Machine Learning (ICML)), §3
  7. Why is CRF training attractive in terms of optimization?
    The log-likelihood objective is convex (CRFs share the convexity of general maximum entropy models), so training converges to the global optimum.
    • Lafferty et al., 2001, Conditional Random Fields (Proceedings of the 18th International Conference on Machine Learning (ICML)), §3

4 Parameter estimation for CRFs

  1. How did Lafferty et al. train CRFs?
    By maximizing conditional log-likelihood with improved iterative scaling variants. Algorithm S adds a global “slack” feature making the total feature count constant; Algorithm T tracks partial feature totals per sequence and converges faster when lengths vary. Expectations come from forward–backward vectors \(\alpha_i = \alpha_{i-1} M_i\), \(\beta_i = M_{i+1} \beta_{i+1}\).
    • Lafferty et al., 2001, Conditional Random Fields (Proceedings of the 18th International Conference on Machine Learning (ICML)), §4
  2. Why can Algorithm S converge slowly?
    Its slack constant \(S\) is proportional to the longest training sequence length, so each iteration takes very small steps.
    • Lafferty et al., 2001, Conditional Random Fields (Proceedings of the 18th International Conference on Machine Learning (ICML)), §4
  3. How costly is one CRF training iteration?
    Roughly as costly in time and space as one Baum–Welch iteration for HMMs, because expectations are computed with forward–backward recursions over the chain.
    • Lafferty et al., 2001, Conditional Random Fields (Proceedings of the 18th International Conference on Machine Learning (ICML)), §4

5 Experiments

  1. How did CRFs and MEMMs compare on data generated from the rib/rob network?
    With identical topology and only symbol-identity features, the CRF erred about 5% of the time while the MEMM erred about 42%, failing to discriminate the two branches: a direct demonstration of label bias.
    • Lafferty et al., 2001, Conditional Random Fields (Proceedings of the 18th International Conference on Machine Learning (ICML)), §5
  2. What did the mixed-order synthetic experiments show?
    Data came from HMMs mixing first- and second-order dependencies; as data became more second-order, all first-order models erred more. CRFs typically beat MEMMs by a wide margin, HMMs beat MEMMs, and CRFs beat HMMs on mostly second-order data: CRFs are more robust to inaccurate modelling assumptions.
    • Lafferty et al., 2001, Conditional Random Fields (Proceedings of the 18th International Conference on Machine Learning (ICML)), §5
  3. What did the Penn Treebank POS tagging experiments show?
    With the same tag–word and tag–tag parameters, HMM beat MEMM (label bias) and CRF beat HMM. Adding orthographic features (capitalization, numbers, hyphens, suffixes like -ing, -ed, -tion) helped MEMMs and CRFs greatly, especially on out-of-vocabulary words.
    • Lafferty et al., 2001, Conditional Random Fields (Proceedings of the 18th International Conference on Machine Learning (ICML)), §5
  4. How was slow CRF training from the uniform distribution addressed in the POS experiments?
    Initialize the CRF with the trained MEMM’s parameters; it then converged in about 1,000 iterations, while training from all-zero parameters had not converged after 2,000.
    • Lafferty et al., 2001, Conditional Random Fields (Proceedings of the 18th International Conference on Machine Learning (ICML)), §5

6 Further aspects of CRFs

  1. What extensions of CRFs did the paper suggest?
    Training with AdaBoost’s exponential loss over whole sequences (using forward–backward for feature expectations), feature selection and induction (adapting Della Pietra et al.’s methods), and tree-structured or grammar-like CRFs (analogues of stochastic context-free grammars).
    • Lafferty et al., 2001, Conditional Random Fields (Proceedings of the 18th International Conference on Machine Learning (ICML)), §6

7 Related work and conclusions

  1. How do CRFs relate to earlier exponential sequence models?
    They are the first to combine conditional modelling with the global normalization of random fields: earlier work either built generative exponential models with hard normalization (Rosenfeld) or local conditional models (Berger et al., Ratnaparkhi, MEMMs) that can suffer from label bias.
    • Lafferty et al., 2001, Conditional Random Fields (Proceedings of the 18th International Conference on Machine Learning (ICML)), §7

Source

  • John Lafferty, Andrew McCallum and Fernando C. N. Pereira. 2001. Conditional Random Fields: Probabilistic Models for Segmenting and Labeling Sequence Data. In Proceedings of the 18th International Conference on Machine Learning (ICML), pp. 282–289.