Generative AI vs traditional machine learning
Since 2023 many teams reach for a large language model by reflex. That is often the slowest, costliest and least reliable option. Understanding the difference between generative and discriminative (traditional) ML helps you pick the right tool for each task.
The core difference
A traditional supervised model learns a boundary: given features, output one label or number. A generative model learns to produce new content — the next token of text, the next pixel block, the next audio frame — from a distribution learned over huge amounts of data.
| Traditional ML | Generative AI | |
|---|---|---|
| Typical output | Label, score, number | Text, image, code, audio |
| Training data | Your labelled rows | Massive pre-training, then your prompt or fine-tune |
| Cost per 1,000 predictions | Nearly free after training | Paid per token / per image |
| Latency | Milliseconds | Hundreds of milliseconds to seconds |
| Explainability | Feature importance, coefficients | Weak; output can be fluent and wrong |
| Fails by | Being wrong with a low confidence score | Being wrong confidently (hallucination) |
A concrete comparison
Routing 200 customer complaints a day into delivery, product or payment. A few hundred labelled examples make a
TF-IDF plus logistic-regression model that runs on a laptop:
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import LogisticRegression
from sklearn.pipeline import make_pipeline
texts = ["parcel not delivered yet", "courier lost my order", "delivery is late by a week",
"size is wrong", "kurta colour faded", "item arrived damaged",
"refund not credited", "double charged on UPI", "payment deducted but no order"]
labels = ["delivery"] * 3 + ["product"] * 3 + ["payment"] * 3
clf = make_pipeline(TfidfVectorizer(ngram_range=(1, 2)), LogisticRegression(max_iter=1000))
clf.fit(texts, labels)
print(clf.predict(["upi payment deducted twice"])) # ['payment']
Nine examples are only enough to show the shape of the code; in production you would label a few hundred.
That is cheap, fast, testable and auditable. But ask for a polite Hinglish reply that quotes the order date and apologises and no classifier can help — that is generation, and an LLM is the right tool.
A simple decision guide
- Fixed set of categories, plenty of examples, high volume → traditional ML.
- A number to predict (demand, price, days to deliver) → traditional ML.
- Free-form text in, free-form text out; long tail of instructions; few labelled examples → generative AI.
- Regulated decision that must be explained to a customer or auditor → rules or traditional ML, with generation used only to phrase the explanation.
- Unsure? Start with an LLM to prototype in a day, then distil the labels it produces into a small model once volume grows.
Evaluation differs too
A classifier is judged by accuracy, precision, recall and F1 on a held-out set. Generative output has no single correct answer, so teams build a golden set of prompts with expected properties and score outputs on faithfulness, format compliance, tone and safety — often with a mix of automatic checks and human review.
Key takeaways
- Generative models create; discriminative models decide. Match the tool to the shape of the output.
- Per-call cost and latency matter enormously at scale; a model that is 2% better but 100x costlier rarely wins.
- Hybrid designs are common: an LLM extracts structured fields, a rule or a small model makes the decision.
Practice
Take 30 real support messages from any business you know. Hand-label them into three categories, train the pipeline above, and write down where a classifier is clearly enough and where you would genuinely need generation.