AI & LLM Basics
AI vs Machine Learning vs Deep Learning vs Generative AI: How They Fit Together
Beginner 10 min For: Beginners
Key takeaways
- ▸The four terms nest: artificial intelligence (AI) ⊃ machine learning (ML) ⊃ deep learning (DL) ⊃ today's generative AI (LLMs, text-to-image and so on).
- ▸Rule-based AI is programmed by people; machine learning learns the rules from data. Supervised, unsupervised and reinforcement learning are the three main ways to learn.
- ▸Deep learning uses many-layer neural networks that learn their own features; once big data and GPUs arrived it took over, starting with image recognition in 2012.
- ▸Discriminative models answer “what is this?” (classify, score); generative models answer “make another one like this” (text, images, code). Large language models are generative.
The short answer
Artificial intelligence (AI) is the biggest circle: getting machines to do tasks that need “intelligence”. Machine learning (ML) is one way to do it: instead of people writing the rules, a program learns them from data. Deep learning (DL) is the part of machine learning that uses many-layer neural networks. What people now call generative AI — large language models, text-to-image models — is almost entirely deep learning models that produce content.
flowchart TB
subgraph AI["Artificial intelligence: machines doing tasks that need intelligence"]
R["Rule-based AI: expert systems, search, planning"]
subgraph ML["Machine learning: learning rules from data"]
T["Classic ML: linear regression, decision trees, gradient boosting"]
subgraph DL["Deep learning: many-layer neural networks"]
D["Discriminative: image classification, speech recognition"]
G["Generative AI: LLMs, text-to-image, speech synthesis"]
end
end
endRule-based AI vs learned AI
Early AI was mostly hand-written rules. A spam filter might say “if the subject contains ‘you won’, mark as spam”. This rule-based AI (symbolic AI, expert systems) is transparent and controllable, but you can never write enough rules: spammers simply rephrase.
Machine learning flips the approach: collect many emails already labelled spam or not, and let an algorithm find which features predict the label. The rules are no longer written one by one — they live in the model's parameters. When the data changes, you retrain.
Three main ways to learn
| Approach | What the model gets | Typical tasks |
|---|---|---|
| Supervised learning | Inputs plus correct answers (labels) | Spam classification, price prediction, image recognition |
| Unsupervised / self-supervised learning | Inputs only, no human labels | Clustering, dimensionality reduction; LLM pre-training (“predict the next token”) is self-supervised |
| Reinforcement learning | An environment plus a reward signal | Game playing, robot control; RLHF in LLM alignment |
Training a modern LLM uses all three: self-supervised pre-training on huge text corpora, supervised fine-tuning on human-written demonstrations, then reinforcement learning from human preferences (see How LLMs Learn).
Why deep learning won
Classic machine learning often needs people to design “features” first (edges in an image, colour histograms). Deep learning stacks many neural-network layers: early layers learn simple features and later layers combine them into complex concepts, removing most hand-built feature engineering (LeCun, Bengio & Hinton, 2015).
The turning point came in 2012, when AlexNet — a deep convolutional network trained on GPUs — won the ImageNet image-recognition challenge by a wide margin (Krizhevsky et al., 2012). Speech recognition and machine translation followed. The 2017 Transformer architecture (Vaswani et al.) made training highly parallel and became the base of almost every large model today. For how neural networks themselves work, see Neural Networks.
It took three ingredients together: more data (the internet), more compute (GPUs) and better architectures and training methods.
Generative vs discriminative models
- A discriminative model learns “given this input, what is the answer?”: is this a cat or a dog, is this transaction risky? It outputs a class or a score.
- A generative model learns what the data looks like, so it can create new samples: a paragraph, an image, a voice clip. GANs (Goodfellow et al., 2014), diffusion models and LLMs are all generative.
LLMs generate text by repeatedly predicting the next token (see What Is a Large Language Model?). The GPT-3 paper also showed that a large enough model can do tasks it was never specifically trained for, just from a few examples in the prompt (Brown et al., 2020) — the starting point of the next lesson, Prompting Basics.
Common misconceptions
- “AI = large language models.” LLMs are just the newest, most visible branch. Recommenders, fraud detection, navigation and OCR rely heavily on other AI methods.
- “Deep learning always beats classic ML.” On small, well-structured tabular data, gradient-boosted trees are often more accurate, faster and easier to explain.
- “What a model learns from data is fact.” Models learn statistical patterns; biased data gives biased models, and generative models can also hallucinate.
Try it yourself
- Open Teachable Machine and, without code, take a few dozen webcam pictures of two hand gestures to train a classifier — that is supervised learning.
- Open TensorFlow Playground and go from 0 to 3 hidden layers; watch the decision boundary bend from a straight line into complex curves — that is what “deep” buys you.
- For a structured start, try the free Elements of AI, AI for Everyone or Google's Machine Learning Crash Course.
FAQ
Which layer does ChatGPT belong to?
All four: it is AI, trained with machine learning, built on a deep neural network (a Transformer), and generative — it writes text one token at a time.
Does all AI use machine learning?
No. Shortest-path routing, classic expert systems and chess-engine search are AI, but their rules and search methods are designed by people rather than learned from data.
Is deep learning the opposite of machine learning?
No. Deep learning is a branch of machine learning that uses many-layer neural networks. On many tabular-data problems, “classic” methods such as gradient-boosted trees are still common and strong.
Will generative AI replace discriminative models?
They are often used together. A generative LLM can classify through a prompt, but for spam filtering or risk scoring a small purpose-trained discriminative model is usually faster, cheaper and easier to evaluate.