From Machine Learning to Generative AI — Why the Shift Happened¶
What this is: the bridge between "classical" machine learning (the 2010s–2023 workhorse) and modern generative AI. What each is, the real differences, the disadvantages of classical ML that drove the shift, when you should — and should not — move to AI, and a concrete before/after case study: fraud detection and spam detection, 2020–2023 vs after 2023.
Prerequisite: AI Fundamentals for Beginners — this guide assumes you know what ML, neural networks, and LLMs are.
1. Quick Recap — Where ML and AI Sit¶
flowchart LR
ML["📊 Classical ML (2010s–2023 mainstream)<br/>learns patterns from YOUR labelled data<br/>one model = one task"] --> GEN["✨ Generative AI / LLMs (2023–)<br/>pre-trained on the world's text<br/>one model = many tasks, zero training"]
| Classical Machine Learning | Modern (Generative) AI | |
|---|---|---|
| Learns from | Your dataset (thousands–millions of labelled rows) | Pre-trained on internet-scale data; you mostly prompt it |
| One model does | One narrow task (classify, predict a number) | Many tasks — summarise, classify, extract, reason, converse |
| Input type | Structured features you engineer (age, amount, counts) | Raw unstructured text, images, documents — as-is |
| Output | A label or score (fraud: 0.93) |
Free text, JSON, code, decisions with explanations |
| To improve it | Collect more labels, re-engineer features, retrain | Rewrite the prompt, add context (RAG), or fine-tune |
| Cost profile | Cheap per prediction, expensive to build | Expensive per call (tokens), near-zero to start |
| Determinism | Same input → same score | Same input → different valid outputs |
| Explainability | Feature importances, SHAP values | Natural-language rationale (but can be confabulated) |
The one-sentence version: classical ML recognises patterns it was trained on; generative AI applies general knowledge it already has to your problem.
2. The Disadvantages of Classical ML (What Drove the Shift)¶
Classical ML is not "bad" — it dominated for a decade because it works. But it carries structural costs:
| Disadvantage | What it means in practice |
|---|---|
| Label hunger | Supervised models need thousands of correctly labelled examples. Labelling is slow, expensive, and itself error-prone |
| Feature engineering burden | Humans must hand-design the input signals ("transactions per hour", "sender domain age"). Months of expert work per model |
| One model per task | Fraud model can't do spam. Spam model can't do refunds. Every new task = a new data-collection + training project |
| Cold-start problem | No historical data → no model. New product, new market, new attack type = blind |
| Drift & retraining treadmill | The world changes (new fraud patterns, new slang) → model decays → collect labels → retrain → redeploy, forever |
| Rigid inputs | Structured features only. Free text, screenshots, PDFs need separate NLP/OCR pipelines bolted on |
| Poor generalisation | Trained on UK card fraud? Useless for a novel attack it has never seen an example of. It can only interpolate its training distribution |
| No reasoning or context | It scores; it cannot read a customer email, weigh context, or explain its decision in words |
The core limitation in one line: classical ML can only recognise what it has already seen labelled examples of — it cannot reason about the genuinely new.
3. Case Study — Fraud Detection¶
2020 → 2023: the classical ML era¶
A typical bank fraud stack:
flowchart LR
TX["💳 Transaction"] --> FE["🔧 Feature engineering<br/>amount, merchant, geo-velocity,<br/>time-of-day, device fingerprint,<br/>txns-last-hour…"]
FE --> M["📊 XGBoost / Random Forest<br/>trained on millions of<br/>labelled fraud/legit rows"]
M --> S["score 0.0–1.0"]
S -->|"> threshold"| BLOCK["🚫 block / step-up auth"]
S -->|else| OK["✅ approve"]
BLOCK --> AN["👩💻 human analyst reviews queue"]
- Models: gradient-boosted trees (XGBoost/LightGBM) on engineered features; sometimes a rules engine in front.
- Strengths: ~10ms scoring, cheap at millions of transactions/day, well-understood, explainable enough for regulators.
- Pain points:
- New fraud pattern (e.g. a fresh APP-scam script) → invisible until enough labelled losses accumulate → weeks of exposure.
- Analysts drowning in alert queues with no context — just a score and 40 feature values.
- Unstructured evidence (customer chat, scam SMS text, mule-account emails) largely unused.
After 2023: the GenAI-augmented era¶
Nobody threw the XGBoost model away — it still scores every transaction. What changed is the layers around it:
flowchart LR
TX["💳 Transaction"] --> M["📊 Classical ML score<br/>(unchanged — fast, cheap)"]
M -->|suspicious| LLM["🤖 LLM investigation layer<br/>reads txn history + customer chat +<br/>device data + KYC docs via RAG"]
LLM --> NARR["📝 case narrative:<br/>'Pattern matches APP scam:<br/>new payee + urgency language<br/>in chat + first-ever crypto merchant'"]
NARR --> AN["👩💻 analyst decides in minutes,<br/>not hours"]
LLM --> SAR["📄 auto-drafted SAR /<br/>regulator report"]
| Capability | 2020–2023 (ML only) | 2023+ (ML + GenAI) |
|---|---|---|
| Transaction scoring | XGBoost score | Same XGBoost score — unchanged |
| Novel scam patterns | Blind until retrained on new labels | LLM reasons about behaviour ("urgency language", "romance-scam script") without labelled examples |
| Unstructured evidence | Ignored or manual | Chat logs, emails, scam texts read directly |
| Analyst workflow | Raw score + feature dump | LLM-drafted case narrative with cited evidence |
| Reporting (SARs) | Hand-written, hours each | Auto-drafted, human-reviewed |
| Attackers | Rule-probing, card testing | Also using GenAI — deepfake voice, flawless phishing — raising the bar on both sides |
Why not replace the ML model entirely?¶
Because at the scoring tier, classical ML still wins on the things that matter there: latency (ms vs seconds), cost (fractions of a cent vs LLM tokens × millions of transactions), determinism (regulators like reproducible scores). The modern pattern is hybrid: ML for high-volume scoring, GenAI for investigation, context, and language.
4. Case Study — Spam / Phishing Detection¶
2020 → 2023: classical text ML¶
- Pipeline: email → tokenise → TF-IDF / embeddings features → Naive Bayes / logistic regression / small BERT fine-tune → spam score; plus reputation lists (sender IP, domain age) and hand-written rules.
- Worked well for: bulk spam with statistical fingerprints — repeated templates, spammy keywords, known-bad senders.
- Failed against: well-written, personalised phishing. A grammatically perfect, context-aware email from a fresh domain sails through — there's no statistical "spam smell" to detect. Every new campaign needed fresh labels and retraining.
After 2023: LLMs on both sides of the war¶
- Attack side changed first: GenAI now writes flawless, personalised phishing at scale — the classic "spelling mistakes and weird grammar" tells are gone. Polymorphic campaigns generate a unique email per victim, defeating template matching.
- Defence responded:
- LLM semantic analysis — the model reads the email like a human: "this claims to be from your CEO, creates payment urgency, and the reply-to doesn't match the display name" → flags intent, not keywords.
- Zero-shot on novel campaigns — no labelled examples of this week's campaign needed; the LLM recognises the social-engineering pattern itself.
- Hybrid tiering — cheap classical filter kills the 90% of obvious bulk spam; the LLM examines the ambiguous remainder (cost control again).
- Explanations for users — instead of
[SPAM], a banner: "This email pressures you to act urgently and the sender's domain was registered 3 days ago."
Same lesson as fraud: classical ML wasn't replaced at the high-volume tier — GenAI was added where reasoning about novel, unstructured content matters, while attackers' use of GenAI made that layer mandatory, not optional.
5. Why Move to AI — and When Not To¶
Move (or add an AI layer) when…¶
- The input is unstructured — text, documents, images, conversations.
- You face novel patterns faster than you can label them.
- You need explanations in language, not just scores.
- You have no training data (cold start) — an LLM works day one.
- One team must cover many tasks — one model + prompts beats ten bespoke models.
Stay with classical ML when…¶
- Data is tabular/structured and plentiful — gradient boosting still beats LLMs on tabular prediction.
- You need millisecond latency or micro-cent unit costs at huge volume.
- You need reproducible, auditable outputs for regulators.
- The task is stable and well-labelled — spam-vs-ham on bulk mail, credit scoring, demand forecasting.
The honest answer to "ML or AI?" is usually "both, tiered": classical ML as the cheap, fast, deterministic front line; GenAI as the reasoning layer for whatever is novel, ambiguous, or unstructured.
6. What This Means for Testing (the QA Angle)¶
The two eras are tested completely differently — and a hybrid system needs both disciplines:
| Dimension | Testing classical ML | Testing GenAI layer |
|---|---|---|
| Core question | Is accuracy/precision/recall above baseline on a held-out set? | Is the output good enough — faithful, relevant, safe? |
| Method | Deterministic metrics, confusion matrix, drift monitors | LLM-as-judge, golden datasets, semantic scoring |
| Regression | Same test set, compare metrics per model version | Eval suites in CI with threshold gates |
| Data tests | Feature pipeline validation, schema drift | RAG retrieval quality, context recall |
| Adversarial | Evasion attacks on features | Prompt injection, jailbreaks |
| Tooling | scikit-learn metrics, Evidently, MLflow | Ragas, DeepEval, cloud evaluation services |
Where to Go Next¶
- Cloud LLM Evaluation Tools — evaluating the GenAI layer with Bedrock, Azure AI Foundry, and Vertex AI
- AI Fundamentals for Beginners — the underlying concepts
- LLM Testing Lifecycle — the process for testing the new layer
- Enterprise LLM Platforms — the platforms these systems run on