Skip to content

11.4.1 Sequence Labeling Roadmap: One Label per Token

Sequence labeling predicts one label for each token. NER, word segmentation, part-of-speech tagging, and slot filling all use this idea.

Sequence labeling chapter learning flowchart

HMM CRF sequence history map

BiLSTM CRF label path map

The key output is not one sentence label, but aligned token-level tags such as B-PER, I-PER, and O.

tokens = ["Ada", "Lovelace", "wrote", "notes"]
tags = ["B-PER", "I-PER", "O", "O"]
for token, tag in zip(tokens, tags):
print(token, tag)

Expected output:

Terminal window
Ada B-PER
Lovelace I-PER
wrote O
notes O

If tokenization changes, labels must stay aligned. Many sequence-labeling bugs are alignment bugs.

StepReadPractice Output
1NER and BIOCreate token-level labels and entity spans
2HMM/CRF historyUnderstand sequence constraints and label transitions
3BiLSTM-CRFConnect contextual features with valid label paths
4Project practiceEvaluate precision, recall, F1, boundary errors

Keep this page’s proof of learning as a small evidence card:

Schema
entity types, BIO tags, or sequence-label rules
Prediction
token-level labels and extracted spans
Metric
entity precision/recall/F1 and boundary cases
Failure Check
span boundary, nested entity, unknown word, or inconsistent annotation
Expected Output
gold-vs-predicted span table with at least one miss

You pass this chapter when you can inspect token/tag alignment and explain one boundary error or invalid tag transition.

Check reasoning and explanation
  1. A passing answer starts from the text unit and output type: token, span, sentence label, sequence, embedding, or generated text.
  2. The evidence should include a small dataset example, model or pipeline choice, metric, and at least one inspected error case.
  3. A good self-check distinguishes preprocessing issues from model issues, such as tokenization mistakes, label ambiguity, data imbalance, or hallucinated generation.