Modeladvanced
Semi-Markov conditional random field
Also called semi-CRF.
A CRF over segmentations into labeled spans, with features of whole spans, decoded by a segment Viterbi in O(n L k^2) time.
A semi-Markov conditional random field (semi-CRF) is a conditional random field whose output is a segmentation of the input into labeled spans, not one label per token. Its features can look at a whole span: its length, the phrase inside it, and how similar that phrase is to entries of a dictionary. The Markov assumption holds between segments, not between tokens. Compared with a linear-chain CRF over BIO tags, it can use these span features directly, at a cost that is only a factor larger, where is the maximum span length. Compared with a hidden semi-Markov model, it is trained conditionally, so its features can overlap and look at the whole input. Sarawagi and Cohen (2004) introduced it for named entity recognition.
The machine
The input is a sequence and a label set of labels. A segmentation splits into consecutive non-empty spans that cover it: segment covers the tokens to and has the label , with , , and . In named entity recognition, tokens outside entities are put into segments of length 1 with the label O.
A segment feature vector may look at the label of the segment, the label of the segment before it, the whole input, and the two ends of the segment. Let . The model is
with the sum over all segmentations with segments of length at most (Sarawagi and Cohen 2004, Section 2.1, Equations 2 and 3).
Decoding. Let be the best score of a segmentation of the first tokens whose last segment ends at and has the label . Then , for , and for
The best segmentation is traced back from (Section 2.2, Equation 4). For this is the usual Viterbi algorithm.
Training. The conditional log likelihood is concave, and its gradient is the observed minus its expectation under the model (Section 2.4). The normalizer comes from the forward recursion
with and for , and the expectations from a similar recursion, the segment form of the forward-backward algorithm. Sarawagi and Cohen used a limited-memory quasi-Newton method with a Gaussian prior.
What it counts
- Decoding and the forward recursion: evaluations of the segment score, since each of the cells takes a maximum or sum over lengths and previous labels. With (no limit), this is , still polynomial.
- Space: for the tables and . Sarawagi and Cohen (2004, Section 2.4, footnote 2) note that the expectations can be computed in space instead of by first computing the backward values.
- Feature cost: there are at most candidate spans. Span features such as the similarity to a dictionary are computed once per span and label.
Relation to other models
- Linear-chain CRF: the case . A semi-CRF can be written as a first-order CRF exactly when the sum of its segment features can be written as a sum of token features (Section 2.3). A feature , the length of an entity, is of this kind, since it equals the number of tokens labeled I. A feature , which gives a Gaussian model of entity length, is not.
- Order- CRF: Sarawagi and Cohen state that for fixed a semi-CRF is no more expressive than an order- CRF, but an order- CRF has label tuples as states, while the semi-CRF only considers runs of one label, so its extra cost is linear in , not exponential (Section 2.3).
- BIO tagging: a CRF over BIO encoding tags also outputs labeled spans, and its features see only one token and two adjacent tags at a time. Sarawagi and Cohen compared the semi-CRF with a CRF over I and O tags and with a CRF over four tags that mark the beginning, end, continuation and unit entity.
- Hidden semi-Markov model: the generative model with explicit state durations. The semi-CRF is its conditionally trained form, in the same way as the CRF is the conditional form of the HMM.
- Semi-Markov perceptron: the same segment Viterbi with structured perceptron updates. Sarawagi and Cohen report that their earlier perceptron-based learner was simpler and numerically more stable, since it needs no partition function, but that the semi-CRF did somewhat better on average (in their discussion of related work).
- Without the dependence on the previous label, the best segmentation is a set of disjoint weighted intervals that cover the input, the weighted interval scheduling structure.
Known results in the model
- Exact inference and learning take polynomial time (a theorem): the recursions above are exact because each segment score depends only on the segment and the label of the previous segment.
- The likelihood is concave in (a theorem), so training finds a global optimum, as for the CRF.
- Named entity recognition (a measurement, Sarawagi and Cohen 2004, Section 3.3): on five extraction tasks from three small corpora (addresses, job postings and email), with between 4 and 6, the semi-CRF had the best F1 on all five tasks without dictionary features. With all available features it beat both CRF variants on eight of ten conditions. Segment-level dictionary features, such as the similarity of a span to the nearest dictionary entry, helped the semi-CRF, while their token-level versions often hurt the CRFs.
- Sarawagi and Cohen (Section 1) name gene finding and NP chunking as other tasks where segments have a clear meaning; see text chunking. Word segmentation has the same form, with words as segments.
References
- Sarawagi and Cohen 2004, Section 2.1 (segmentations and segment features, Equations 2 and 3), Section 2.2 (the semi-Markov Viterbi recursion, Equation 4), Section 2.3 (comparison with order-L CRFs), Section 2.4 (likelihood, gradient and the forward recursion), Section 3.3 (NER results)
- Lafferty, McCallum and Pereira 2001, the linear-chain CRF that the semi-CRF generalizes
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W4 complete |
|
Tag N6VK89 Edit this page History Report an error Markdown