Home/Language & LLMs/Text Classification
Language & LLMs

Text Classification

Sorting text into categories — spam or not, positive or negative, which topic — the most widely deployed NLP task, and the one you've used a hundred times without noticing.

Reviewed July 16, 2026Stable
Reading level: Curious
Pick your depth ↓

When not to use it

  • When the task is really extraction or generation, not sorting into fixed buckets.
  • When classes are ill-defined or overlapping — fix the label scheme before modelling.
  • Judging skewed-class performance by accuracy — it hides failure on the rare class that usually matters most.

Reach for something else instead

  • Named entity recognition when you need to extract spans, not label the whole document.
  • Clustering when you don't have labels and want to discover groupings.
  • Zero-shot LLM prompting when labels change often and per-call cost is acceptable.

Sources & further reading

  • Joachims (1998), Text Categorization with Support Vector Machines — a foundational treatment of the classic approach.
  • Devlin et al. (2018), BERT — fine-tuning pretrained transformers for classification.
  • Manning, Raghavan & Schütze, Introduction to Information Retrieval — text classification fundamentals and evaluation.

Primary sources, listed so you can check the claims on this page rather than take them on trust.

Where people go wrong

  • Using accuracy on imbalanced data — a trivial "majority class" model scores high and does nothing.
  • Reaching for a heavy model when a logistic-regression baseline would win at a fraction of the cost.
  • Under-investing in label quality, which caps the achievable performance regardless of model.

At a glance

FieldLanguage & LLMs
Taskassign text to categories
Approachesbaselines → fine-tuned transformers → zero-shot LLM
Metric cautionnot accuracy on imbalanced data
DifficultyBeginner
Flashcards for this concept · study, save or share them →
Question
Answer
1 / 4