Neural Mastery

NLP Task Taxonomy

Every major NLP task predates Transformers, and every one of them is now dominated by Transformer-based approaches — but the classical approach to each is worth knowing, both for historical grounding and because classical methods are sometimes still the right, cheaper tool for a well-defined production task.

Intuition: Constrained vs. Open-Ended Output

The tasks on this page split cleanly along one axis: does the model select from a fixed, small set of outputs (sequence labeling, classification, extractive QA), or does it generate genuinely new text (translation, abstractive summarization, generative QA)? Constrained tasks are structurally safer — a classifier can't hallucinate a label that doesn't exist, extractive QA can't hallucinate an answer not present in the source — at the cost of being unable to produce anything the fixed output space doesn't already contain. Every classical/modern contrast below is really a version of this same trade-off.

Sequence Labeling

The general framing behind POS tagging and NER: assign a label to every token in a sequence, where the labels of nearby tokens are dependent on each other (not independent per-token classification). Classical: HMMs/CRFs, modeling the label sequence's transition structure explicitly (see the real Viterbi decode on Classical NLP). Modern: a BiLSTM or Transformer encoder with a classification head per token, letting the model learn label dependencies implicitly through its own representations rather than an explicit transition matrix.

Text Classification & Sentiment Analysis

Assigning a label (or set of labels) to an entire document/sentence rather than per-token. Classical: bag-of-words or TF-IDF features feeding a Logistic Regression, Naive Bayes, or SVM classifier. Real bag-of-words scoring, live — including exactly where it structurally breaks:

Sentence
the
movie
was
great (+2.2)
and
amazing (+2.5)
P(positive)=σ(iwi)=σ(4.70)=0.991P(\text{positive}) = \sigma\left(\sum_i w_i\right) = \sigma(4.70) = 0.991
Watch example 2 -- "not good" and "not terrible" both contain sentiment words, but bag-of-words has no notion of negation scope, so it just sums every word's weight independently, "not" included as its own small negative nudge. This is exactly the structural limitation modern contextual models fix.
Real sum of per-word sentiment weights = 4.70, passed through a real sigmoid = 99.1% positive. This entire classifier is one dot product between a bag-of-words vector and a learned weight vector -- exactly what a real logistic-regression sentiment classifier computes, just with hand-set weights here instead of ones learned from data.

Still a completely reasonable, fast, interpretable baseline for well-scoped classification tasks with limited labeled data. Modern: fine-tuning a BERT-style encoder (see Attention & Transformers) or prompting an LLM directly (see Prompt Engineering) — better accuracy, especially on nuanced/context-dependent sentiment (exactly the negation-scope case above), at higher compute cost per prediction.

Machine Translation

Translating text from one language to another — the task that originally motivated the encoder-decoder Transformer architecture (Attention & Transformers — The T5 Lineage):

  • Statistical Machine Translation (SMT): pre-neural approaches built from explicit translation probability tables (phrase-to-phrase translation likelihoods learned from parallel corpora) combined with a language model scoring fluency — a pipeline of separately-optimized components, not end-to-end trained.
  • Neural Machine Translation (NMT): end-to-end sequence-to-sequence models (originally RNN encoder-decoder with attention, see Sequence Models — Seq2Seq with Attention, now Transformer encoder-decoder) trained directly on parallel text — a single model learns the entire mapping, substantially outperforming SMT's pipeline once enough training data and compute were available.
  • Evaluation: BLEU (n-gram precision overlap against reference translations) remains the standard automatic metric despite well-known limitations. Real BLEU-style precision, computed live, on exactly the case that exposes the limitation:
Candidate translation
reference: the cat sat on the mat
candidate: a cat was sitting on the mat
57%
unigram precision
33%
bigram precision
44%
BLEU (geo. mean)
This is the exact well-known limitation the prose warns about, made concrete with a real, computed number instead of an assertion.
Real unigram precision (fraction of candidate words found in the reference) = 57%; real bigram precision = 33%; BLEU-style score (geometric mean) = 43.6%. A genuinely valid paraphrase still scores well below 100% -- BLEU rewards n-gram overlap with ONE specific reference wording, not meaning.

See LLM Evaluation & RAGOps — Traditional Metrics for how LLM-as-judge approaches are increasingly used alongside or instead of BLEU for more nuanced translation quality assessment.

Summarization

  • Extractive summarization: select and concatenate existing sentences/phrases directly from the source document — guaranteed factually grounded, but can read disjointedly since it's a selection, not a composition.
  • Abstractive summarization: generate genuinely new sentences that convey the source's meaning — reads more naturally, but introduces real risk of hallucination. Toggle between the two on the same source below — one of them contains a deliberately planted factual error, exactly the faithfulness/groundedness concern covered in LLM Evaluation & RAGOps:
Summary type
The company reported quarterly revenue of $4.2 million, up 12% year over year.
Growth was driven primarily by strong demand in the enterprise segment.
The CEO said the company plans to expand into two new markets next year.
Operating costs also rose slightly due to increased hiring.
Summary:
The company reported quarterly revenue of $4.2 million, up 12% year over year. The CEO said the company plans to expand into two new markets next year.
Every word in the summary came directly from the highlighted source sentences -- guaranteed factually grounded (it's literally a subset of the source), but reads as two disconnected facts rather than a composed narrative.

Modern LLMs perform abstractive summarization by default when prompted to summarize — the extractive/abstractive distinction remains relevant for understanding why a summary might be unfaithful to its source (an abstractive method structurally can be, an extractive one structurally cannot).

Question Answering

  • Extractive QA: given a question and a passage, identify the exact span of the passage that answers it — framed as predicting a start and end token position, a structurally different (and simpler, more constrained) task than free-form generation. Real softmax, real argmax, real predicted span:
Question: "When was the Eiffel Tower completed?"
The
 
 
Eiffel
 
 
Tower
 
 
was
 
 
completed
 
 
in
 
 
1889
start 88%
end 94%
in
 
 
Paris
 
 
.
 
 
span=[argmax(start probs), argmax(end probs)]=[6,6]\text{span} = [\arg\max(\text{start probs}),\ \arg\max(\text{end probs})] = [6, 6]
A structurally simpler, more constrained task than free-form generation -- the model can only ever point at something already in the passage, which is exactly why it can't hallucinate an answer not present in the source.
Real softmax over start/end logits, then real argmax: predicted span = "1889" (position 6 to 6), with start probability 88.3% and end probability 93.5%. This is the entire extractive-QA mechanism -- two independent per-token classification heads over the passage, not free-form generation.
  • Generative/open-domain QA: generate a free-form answer, potentially synthesizing information across multiple sources or requiring knowledge not explicitly present in any single retrieved passage — the task framing behind RAG, which combines retrieval (find relevant passages) with generative QA (compose an answer from them) rather than either extractive matching or ungrounded generation alone.

Code: A Real Extractive-QA Span Predictor

The exact computation the diagram above runs, in the form a real fine-tuned model's head actually takes:

import torch
import torch.nn.functional as F

def predict_span(start_logits: torch.Tensor, end_logits: torch.Tensor, tokens: list[str]) -> str:
    start_probs = F.softmax(start_logits, dim=-1)
    end_probs = F.softmax(end_logits, dim=-1)
    start_idx = torch.argmax(start_probs).item()
    end_idx = torch.argmax(end_probs).item()
    return " ".join(tokens[start_idx:end_idx + 1])  # can only ever point INTO the passage

NLP section complete. Next: LLMs & GenAI — where this entire task taxonomy gets absorbed into general-purpose, prompted Transformer models rather than one specialized architecture per task.

Last updated Sep 5, 2026Edit this pageReport an issue
← Previous
Word Embeddings
Next →
Speech & Audio AI — Overview