The Learning Library
Contents

Module 13 — NLP Sequence Labeling: The Best Teaching Model, Not the Best Production Model

Part III · Modern Practice Across Domains · Status: Draft v0.1 Scope: HMM POS tagging as pedagogy versus BiLSTM-CRF and transformer production · Verdict: historical · Prerequisites: Module 00

Overview

A part-of-speech tagger assigns each word a grammatical label such as noun or verb. The HMM tagger treats tags as hidden states and words as emissions, then decodes the best tag sequence with Viterbi. You can teach the entire pipeline in one lecture on a whiteboard, and generations of lecturers have done exactly that.

Production moved on. Modern taggers are BiLSTM-CRF architectures or fine-tuned transformers, and this curriculum found no primary evidence of any current production HMM POS tagger. Saying that plainly is the point of this module: the HMM tagger is the best teaching model and not the best production model, and confusing the two is the exact error this verdict system exists to prevent.

In this module you build the toy tagger, learn why production left it behind, and extract the three lessons the HMM formulation still teaches better than any end-to-end model. You also learn how to state a negative evidence result honestly.

The structure of the argument matters as much as the conclusion. A historical verdict is not an insult; it says a model completed its lifecycle from production to pedagogy. Many great models end there, and recognizing the transition is a skill you will reuse on every later method you learn.

How It Works

The HMM tagger factorizes tagging into three small tables: starting tag probabilities, tag-to-tag transitions, and tag-to-word emissions. Decoding multiplies a path through these tables and picks the best one with Viterbi. Training is counting on a labeled corpus, possibly smoothed, with no gradients anywhere.

How to read this: boxes are the pipeline stages in order, arrows show data flow from labeled text to tagged output, and the final box names what replaced each stage in production.

flowchart TD
    C[Labeled corpus] --> T[Count transitions]
    C --> E[Count emissions]
    T --> V[Viterbi decode]
    E --> V
    V --> O[Tagged sentence]
    O --> R[Replaced by neural taggers]

Every box fits on one slide, which is the pedagogical superpower. A student sees where each number comes from, hand-computes a short sentence, and watches Viterbi resolve an ambiguity like “fish” as noun or verb. No production tagger offers that transparency at that size.

Property HMM tagger BiLSTM-CRF Transformer tagger
Context used Two previous tags Whole sentence Whole sentence
Training Counting Gradient descent Fine-tuning
One-lecture transparency Yes No No

[!NOTE] A generative tagger models how tags produce words, while a discriminative tagger models the tag boundary directly. The HMM is generative; the CRF and neural taggers that replaced it are discriminative.

One Lecture That Teaches Everything

The toy below tags a three-word sentence with two tags, and it is the whole lecture. Students compute the competing path scores by hand, see the transition table break the tie on the ambiguous word, and understand Viterbi as dynamic programming rather than magic. Tiny data is a feature here: six table entries carry the full lesson.

# Toy HMM POS tagger: 2 tags, 3 words. Teaching code only.
tags = ["NOUN", "VERB"]
start = {"NOUN": 0.6, "VERB": 0.4}
trans = {"NOUN": {"NOUN": 0.3, "VERB": 0.7},
         "VERB": {"NOUN": 0.8, "VERB": 0.2}}
emit = {"NOUN": {"fish": 0.5, "eat": 0.05, "sleep": 0.1},
        "VERB": {"fish": 0.05, "eat": 0.5, "sleep": 0.3}}

def viterbi_tag(words):
    # Standard Viterbi over the tag lattice; returns best tags.
    prev = {tag: (start[tag] * emit[tag][words[0]], [tag])
            for tag in tags}
    for word in words[1:]:
        nxt = {}
        for tag in tags:
            best = max(prev[t][0] * trans[t][tag] for t in tags)
            back = max(tags, key=lambda t: prev[t][0]
                       * trans[t][tag])
            nxt[tag] = (best * emit[tag][word],
                        prev[back][1] + [tag])
        prev = nxt
    return max(prev.values(), key=lambda item: item[0])[1]

print(viterbi_tag(["fish", "eat", "fish"]))

It prints NOUN, VERB, NOUN: the middle word’s verb emission combines with the noun-to-verb transition to resolve the sentence correctly. Change the transition table to uniform and watch the ambiguity return. That single manipulation teaches what transition structure contributes, and no transformer demo fits in the same fifty minutes.

Try a second manipulation once the first lands. Weaken the verb emission for “eat” until the decoded middle tag flips, and note the exact threshold where it happens. Students who find that threshold by hand have internalized the score-multiplication logic that Viterbi automates. The toy is small enough that every number stays visible throughout.

This is why tutorial sites are full of HMM tagging walkthroughs. GeeksforGeeks and GreatLearning both carry HMM POS tutorials, and both prove teaching demand, not production use. They belong in the exclusion log as evidence of pedagogy, which is exactly the verdict this module asserts.

Why Production Moved On, Stated Honestly

Production taggers condition on the whole sentence with rich features: character shapes, capitalization, morphology, and long-range context. A trigram HMM sees two previous tags and one current word, which throws away nearly everything a real tagger needs. BiLSTM-CRF models kept explicit sequence structure while adding neural features, and transformers then removed the feature engineering entirely.

The honest section this module must contain is short. This curriculum completed its primary-source pass on 2026-09-17 and found no primary evidence of any current production HMM POS tagger: no maintained project channel, no vendor documentation, no dated deployment announcement. Tutorials prove students still learn it; none claims a production deployment. Absence of evidence after a genuine search is a finding, and the finding is historical.

Note what would overturn this verdict so you can watch for it. A maintained open-source HMM tagger with dated release activity and documented deployments would force a downgrade to legacy-but-alive. An embedded or low-resource niche with dated production write-ups would do the same. Until such evidence appears with a retrieval date attached, the verdict stands as stated.

[!IMPORTANT] Never cite a tutorial as production evidence. A page that teaches HMM tagging proves the model is teachable, which supports the historical verdict rather than contradicting it.

What the HMM Formulation Still Teaches

First, explicit state priors: the start and transition tables are visible numbers you can read, perturb, and blame. End-to-end models bury priors in weights, and students who never saw an explicit prior cannot reason about what replaced it. Your toy’s transition table is the clearest prior you will ever meet.

Priors also teach smoothing as a decision rather than a default. Your toy’s unseen-word failure is cured the moment you add a small floor probability to every emission, and choosing that floor forces you to say what you believe about unseen events. Every production system hides an equivalent choice; the HMM makes you sign it.

Second, the decoding-versus-marginal distinction: Viterbi returns the single best path while the forward-backward algorithm returns per-position posteriors, and they can disagree. That distinction recurs in every structured model, including CRFs, and the HMM is the smallest stage on which to learn it. Modules 01 and 10 build this machinery; tagging is where it becomes concrete.

Third, generative-versus-discriminative framing: the HMM’s counting-based training shows what modeling the joint distribution buys and costs. Discriminative successors keep the sequence structure and drop the generative story, and you can only appreciate that trade after seeing the generative side work. Teach the HMM first, then motivate the CRF as the answer to its limits.

There is a practical payoff beyond philosophy. When a production tagger fails on your data, the debugging questions are HMM questions: is the prior wrong, is the context window too narrow, is decoding or marginalization at fault. Students who learned tagging through the HMM ask these questions naturally; students raised purely on fine-tuning reach for hyperparameters first.

Why It Survives or Died

HMM POS tagging died in production because tagging accuracy economically rewards whole-sentence context and learned features, which fixed-order generative models cannot supply, while it survives in classrooms because one lecture of counting plus Viterbi teaches priors, decoding, and generative framing more transparently than any production architecture can.

Testing It Honestly

Test the historical verdict by attempting to falsify it. Search vendor documentation, maintained project channels, and dated deployment posts for any current production HMM POS tagger, and record each search with its date. This curriculum’s 2026-09-17 pass returned tutorials and textbooks but zero production systems, which is what historical means: taught and studied, with no production evidence found.

Distinguish the two kinds of hits as you search. A university course page, a tutorial site, or a textbook chapter supports the teaching half of the verdict. Only a maintained codebase with dated production use supports a stronger verdict. If your search finds the latter, this module is wrong and should say so with the new source cited.

Notice how cheap this falsification attempt is: one focused search session with dates recorded. Historical verdicts are the easiest to test precisely because the claim is about absence, and a single dated counterexample overturns them. That asymmetry is why this curriculum states negative results boldly instead of hedging them. A historical verdict with a dated search behind it is stronger than a vague “still used somewhere” that no one can check.

Keep this module beside you when you read Part IV. Finance trading claims fail the same production-evidence test far more often than tagging claims do, and the honesty reflex you practiced here is the one that will save you there.

Hands-On Project

Extend the toy tagger to a ten-word vocabulary with four tags, train it by counting on twenty hand-tagged sentences, and evaluate on ten more. Reproduction card: data source is your own thirty hand-tagged sentences (commit them with the script); library is the Python standard library only; random seed is fixed at 7 for the train/test split; expected output is reasonable accuracy on familiar words and failure on unseen words.

Then document the failure precisely: list every error caused by an unseen word and every error caused by missing context beyond the tag bigram. Write one paragraph explaining which error class a BiLSTM-CRF fixes and why. Your deliverable is the script, the error table, and the paragraph, which together demonstrate both what the HMM teaches and why production left it.

As a final step, write the two-sentence verdict speech you would give a colleague who proposes shipping your toy. Sentence one states the historical verdict with its evidence date; sentence two names the production alternative and the structural reason it wins. Practicing the honest refusal is part of the exercise, because production pressure will test it.

Key Takeaways

  • The HMM tagger factorizes tagging into starts, transitions, and emissions decoded with Viterbi.
  • The full pipeline fits one lecture, which is its surviving superpower.
  • Production tagging is BiLSTM-CRF and transformer territory for reasons of context and features.
  • No primary evidence of any current production HMM POS tagger was found (pass dated 2026-09-17).
  • Tutorial sites prove teaching demand, not production use; cite them as pedagogy.
  • Explicit priors, decoding-versus-marginal, and generative framing are the three durable lessons.
  • A negative evidence result after a genuine search is a finding, not a gap.
  • Attempt falsification with dated searches before upgrading any historical verdict.

References

  • GeeksforGeeks HMM part-of-speech tagging tutorial (Background; teaching evidence, retrieved 2026-09-17).
  • GreatLearning HMM part-of-speech tagging tutorial (Background; teaching evidence, retrieved 2026-09-17).
  • Rabiner, “A tutorial on hidden Markov models,” Proceedings of the IEEE 77(2) 1989 (Mechanics; Viterbi decoding background).
  • Exclusion log: the GeeksforGeeks and GreatLearning tutorials prove teaching, not production; admitting them as status evidence would invert their meaning.