Picture a planning meeting where someone says, "We should use AI to catch fraudulent transactions." Everyone nods.
But one engineer is thinking about a gradient-boosted model trained on last year's transaction table. Another is imagining a neural network. A third has already opened the docs for a hosted LLM API. Same sentence, three completely different systems, with different costs, latencies and failure modes. Nobody in the room noticed, because "AI" has become a word that stretches from a 1990s chess engine to whatever is writing your pull request descriptions this week.
The words AI, machine learning, deep learning and generative AI are not synonyms. They aren't competitors either. They're nested, and once you have that picture in your head, a surprising number of architecture decisions get easier.
I also built an animated walkthrough of this hierarchy, ML vs Deep Learning vs Generative AI on SeeItFlow, if you'd rather watch it move. What follows is the written version.
Four circles, one inside the other
Think of four circles, each sitting inside the previous one.
The biggest is AI: any system that mimics intelligent behaviour. That includes hand-written rules, statistical methods and neural networks. A chess engine from 1997 counts.
Inside it sits machine learning, where the system learns patterns from data instead of following rules a human wrote down. Inside that is deep learning, which is machine learning done with neural networks that have many layers. And in the middle is generative AI, which is deep learning that creates new content (text, code, images, audio) rather than just labelling what you give it.
That nesting gives you a one-way rule. Every generative AI system is a deep learning system, and every deep learning system is a machine learning system. The reverse is not true. Your spam filter is machine learning but not deep learning. An image classifier that sorts photos into a thousand categories is deep learning but not generative. When someone says "AI" and means "a chatbot," they've skipped three circles and landed on the innermost one, and that's where a lot of bad project decisions start.
Why the layers exist at all
These categories didn't appear together. Each one showed up when the previous approach ran into a wall.
For decades, roughly the 1960s through the 90s, building intelligent software meant writing rules. Expert systems and chess engines ran on explicit if/else logic that people typed in by hand. This works until the world gets messier than your rulebook. A spam filter with 500 hardcoded rules is out of date the week a new spam pattern shows up, and someone has to notice and write rule 501. Manual rules don't scale.
Machine learning flipped the workflow. Instead of writing the rules, you show the system a pile of labelled examples and let it find the rules itself. Spam filters, credit scoring and recommendation systems all moved this way.
But classic ML has a catch that's easy to miss: a human still decides what the model gets to look at. That step is called feature engineering. On a table of transactions, a domain expert knows to compute something like "this amount compared to the customer's usual spending." On a photograph, though, nobody knows which combination of pixel values means "cat." Experts spent years hand-designing image features, and the results plateaued.
Then came 2012. AlexNet, a deep convolutional network, cut the error rate on the ImageNet benchmark from about 26% to about 15% in a single year. That was a gap large enough to change where the whole field put its money. Deep learning had been possible for a long time. What made it practical was a combination of things arriving together: GPUs, which are very good at the thousands of parallel matrix multiplications that training a neural network consists of, big datasets like ImageNet and Common Crawl, and training improvements like ReLU activations, dropout and batch normalisation. By the middle of the decade it was the dominant approach for images, audio and language.
Generative AI is the newest layer, from about 2020 onward. It didn't replace what came before it. It asked a different question, which we'll get to.
Classic ML: the workhorse nobody tweets about
Here's the whole idea of machine learning in a few lines:
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import LogisticRegression
from sklearn.pipeline import make_pipeline
model = make_pipeline(TfidfVectorizer(), LogisticRegression())
model.fit(train_emails, train_labels) # labelled examples go in
model.predict(["Congratulations, you won a free cruise"]) # a label comes out
You give it labelled data, it learns a mapping from inputs to outputs, and then it predicts on data it hasn't seen. Spam detection, fraud detection, demand forecasting and ranking items in a recommendation feed all follow this pattern.
The practical profile of classic ML is what makes it so useful. It typically needs thousands to millions of rows, not billions. It usually trains and runs fine on a CPU. Many of the models, like linear regression and decision trees, are interpretable, so when the model flags a transaction you can often say why. And on structured, tabular data, gradient boosting libraries like XGBoost and LightGBM have a long track record of beating fancier approaches, including in Kaggle competitions on tabular problems.
That last point is the one I'd tattoo on the inside of every AI roadmap. A large share of the AI running in production at real companies is still this: boring, cheap, debuggable classic ML. It's not glamorous, and it works.
Deep learning: for when you can't describe the features
Deep learning is machine learning with multi-layer neural networks, and the "deep" just means many layers. Each layer learns a more abstract representation of the input than the one before it. In an image model, early layers pick up edges, middle layers pick up textures and shapes, and later layers pick up things like "wheel" or "face."
The important shift is that the network discovers the features itself. You don't hand-craft them. That's exactly why deep learning took over problems where nobody could write down what to look for: image classification, object detection with models like YOLO, speech recognition, machine translation.
The trade-offs are the flip side of that power. You need much more data. You usually need GPUs. Training is expensive, and the resulting model is often a black box, so explaining an individual prediction gets much harder. If your data is a spreadsheet, you're probably paying all those costs for no gain. If your data is pixels or audio waveforms or raw text, you're paying them because you have no better option.
Generative AI asks a different question
This is the layer people mean when they say "AI" in 2026, and it's worth being precise about what's different.
A classic ML model, and most deep learning models, answer the question: which category does this input belong to? They output a label or a number. A generative model answers a different question: what should come next, given everything so far? It outputs new content.
For text and code, the mechanism is autoregressive generation. The model predicts the next token, appends it to the context, and repeats until it's done. Every response, however long, is built that way, one token at a time. (Image and video generators like Midjourney and Sora use other techniques, diffusion models being the common one, but the spirit is the same: a deep network trained to produce new content that resembles what it learned from.)
That difference is fundamental, not cosmetic. A fraud model gives you a probability between 0 and 1. A language model gives you a paragraph, and the paragraph might be brilliant, or plausible and wrong. You've moved from a system with a narrow, checkable output to a system with an open-ended one, and everything about how you test, monitor and budget for it changes.
It's also worth being honest about what these models are. They're extremely good at predicting statistically likely continuations of text. Whether that amounts to "understanding" is a real debate, and some behaviour at scale looks a lot like reasoning. But as an engineer you should design as though the model is a powerful pattern-matcher over token sequences, not as though it has a reliable model of the world. That assumption will save you from a lot of confidently wrong outputs in production.
So which one do you reach for?
The fastest way I know to sort a problem is to look at the input and the output.
Take "is this email spam?" The input is structured features plus text statistics, the output is a label, and you have labelled data. That's classic ML. "Predict tomorrow's sales" is a structured time series with a number as the output, and gradient boosting will often beat a neural network there. "Detect credit card fraud" is tabular data with numeric features, and an XGBoost-class model is the standard answer.
Now change the input. "Recognise objects in photos" has raw pixels as the input, and no one can handcraft pixel features at scale, so that's deep learning. "Transcribe spoken audio" is raw waveforms turned into text, which needs learned acoustic representations, so also deep learning.
Change the output and you get the third case. "Write a Python function," "generate marketing copy," "summarise a 50-page document": the output is new content, and only generative models can produce it.
If you want it as a rule of thumb:
Is the output a label or a number? -> start with classic ML
Is the input raw images, audio or text? -> deep learning
Is the output new content? -> generative AI
Read it top to bottom and stop at the first one that fits. The ordering is deliberate. It pushes you toward the simplest tool that could work.
What this changes about how you build
Once you see these as layers with different cost profiles, a few practical things follow.
An LLM is not a free upgrade. It adds latency, since generation is sequential and each response takes as many forward passes as it has tokens. It adds cost, since you're billed per token. And it adds unpredictability, because the same prompt can produce different outputs and there's no simple accuracy number to watch. For a spam filter, an inventory forecast or a click-through prediction, a small ML model is faster, cheaper, more predictable and frequently more accurate. Reaching for an LLM there is like hiring a novelist to fill in a spreadsheet.
Build the dumb baseline first. Before you design anything with GPUs in it, train a logistic regression or a gradient-boosted model on the data you have. It takes an afternoon. If it hits your target, you're done, and you've saved months. If it doesn't, you now have a number that any fancier approach has to beat, which keeps the conversation honest.
Debuggability is a feature. When a decision tree misclassifies something you can walk the tree and see why. When a deep network does, you get a shrug and some saliency maps. When an LLM does, you get a fluent explanation that may or may not reflect what actually happened. In regulated or high-stakes systems, that difference can decide the architecture on its own.
Mixing layers is normal. The strongest systems I see described tend to combine them: a deep model turns messy input like text or images into something structured, and a classic model makes the final scored decision on top. Nothing says a project has to live in one circle.
Where I'd land
None of these layers is better than the others. Each one is a response to a specific limit in the one before it: rules didn't scale, so we learned from data; hand-built features stalled, so we let networks learn them; classification wasn't enough, so we taught models to generate.
The mistake isn't using generative AI. The mistake is using it because it's the most visible circle, when the problem in front of you lives in an outer one. The next time someone in a meeting says "let's use AI," it's worth asking the boring questions first: what goes in, what comes out, and what's the simplest thing that could possibly work? That five-minute conversation is usually worth more than the model choice itself.
Explore It Visually
If you learn better by seeing the pieces move, I turned this whole hierarchy into an 8-scene animated walkthrough, from the confusion at the start to a complete side-by-side comparison. You can watch it straight through or jump between scenes: ML vs Deep Learning vs Generative AI on SeeItFlow.
I'm curious how it goes on your side. Have you ever seen a project reach for an LLM when a simple model would have done the job, or the reverse? Tell me in the comments.
Top comments (0)