Module 1 — The AI/ML Family Tree¶
In this module
- Understand how AI, ML, deep learning, and generative AI nest inside each other.
- Know the three flavors of ML at a glance (supervised, unsupervised, reinforcement).
- Understand what a neural network actually is — without the math.
- See why transformers changed everything in 2017.
- Distinguish training from inference, and know which one you'll ever touch.
- Understand what a foundation model is and why it shifted the industry.
Time: ~30 min · Lab: Lab 1 — Compare Models
Why this matters¶
When you join a conversation about AI systems, you'll hear a wall of terms — LLM, transformer, foundation model, inference — thrown around as if everyone already knows the map. This module is that map. Once you can place every term in its correct box, the rest of the course (and your day-to-day work alongside AI engineers) clicks into place. Think of it as reading the legend before navigating the territory.
The family tree: AI → ML → deep learning → generative AI¶
AI (Artificial Intelligence) is the broadest category: any technique that makes software perform tasks we'd normally call intelligent — recognising speech, playing chess, flagging spam. It includes hand-crafted rule engines from the 1970s just as much as today's neural networks.
ML (Machine Learning) sits inside AI. Instead of writing rules explicitly, ML programs learn patterns from examples. The classic analogy: you don't write code that says "an email is spam if it contains the word 'free'" — you feed the system thousands of labelled spam/not-spam emails and it writes those rules itself. Every modern AI product you interact with uses ML somewhere.
Deep learning is a subset of ML that uses many-layered neural networks. "Deep" just means many layers. The extra depth lets the network learn increasingly abstract features — raw pixels become edges, edges become shapes, shapes become "cat." Deep learning is what powers speech recognition, image generation, and language models.
Generative AI sits at the frontier of deep learning: models trained not just to classify or predict, but to create — text, images, code, audio. ChatGPT, Midjourney, and GitHub Copilot are all generative AI. It's a rapidly expanding sub-field, but it runs on the same deep-learning substrate as everything above it.
The nesting relationship — AI contains ML, which contains deep learning, which contains generative AI:
From training a model to using it:
flowchart LR
Data["Training Data"] --> Training["Training"] --> Model["Model Weights"] --> Inference["Inference (you are here)"]
Three kinds of ML: supervised, unsupervised, reinforcement¶
You'll hear these three categories often; one line each is all you need right now:
- Supervised learning — you provide labelled examples (input → correct output); the model learns the mapping. Example: spam classifier, image labeller.
- Unsupervised learning — you provide unlabelled data; the model finds structure on its own. Example: customer segmentation, anomaly detection.
- Reinforcement learning — an agent takes actions, receives reward or penalty, and learns a policy. Example: game-playing bots, robotics.
The three kinds side by side:
In plain words
Supervised = learning with an answer key (someone labelled the examples). Unsupervised = no answer key, so the model just sorts things into natural piles. Reinforcement = learning like a toddler or a dog — try something, get a treat or a "no," and adjust.
Most LLMs are trained with a mix: unsupervised pre-training on text, then reinforcement learning from human feedback (RLHF) to make them helpful.
Neural networks as function approximators¶
A neural network is, at its core, a very large function: it takes numbers in and produces numbers out. What makes it powerful is that the function's shape is learned from data rather than hand-coded. The best analogy for developers: imagine a nest of weighted if/else decisions, millions deep, where every weight starts random and is tuned — via a process called training — until the outputs match the desired answers. Once tuned, the weights are frozen and the network is just a fast, deterministic function you can call. There is no mystery in the box; it's arithmetic all the way down.
The "layers" in a neural network correspond to levels of abstraction. For text, a shallow layer might learn that "the" often precedes nouns; a deep layer might learn something closer to "the author is expressing doubt." This layered abstraction is why deep networks handle language better than shallow alternatives.
A small neural network — nodes (neurons) arranged in layers, every connection a learned weight:
Each node holds a number, each connection multiplies by its learned weight, and each layer passes its result to the next — "deep" simply means many such layers stacked. Real models have billions of these weights, but the shape is exactly this: numbers in, layers of weighted connections, numbers out.
In plain words
Picture a giant wall of dimmer switches — billions of them. "Training" is the slow process of nudging every dial up or down until the right answer lights up for the examples you've shown it. Once the dials are set, you freeze them; using the model just means sending numbers through that fixed wall. ("Function approximator" is the textbook name; "a wall of tuned dials" is the picture.)
What made transformers different¶
Before 2017, the dominant approach to language modeling processed text one word at a time — slow and bad at long-range context. Then the Google Brain team published "Attention Is All You Need," introducing the transformer architecture.
The key insight: process all tokens in parallel and use a mechanism called attention to let every token weigh how much every other token matters to it. Think of it as every word in a sentence voting on how relevant every other word is — simultaneously. This made training dramatically faster (parallelises across GPUs) and gave models far better understanding of long-range relationships. Concretely: in "The trophy didn't fit in the suitcase because it was too big," attention is what lets the model know "it" means the trophy, not the suitcase — every word scores how related it is to every other word.
Every major language model today — GPT-4o, Claude, Gemini, Llama — is a transformer. The architecture did not change the fundamental idea of learning from data; it changed how efficiently and effectively networks could learn language.
Training vs inference — and why you almost always only do inference¶
Training is the compute-heavy, weeks-long process of fitting a model's parameters / weights to a dataset. It is done once (or a handful of times) by the model maker, on thousands of specialised GPUs, at a cost that runs from tens of thousands to hundreds of millions of dollars. You will almost never do this.
Inference is running the finished model to
get an output — sending a request to the API and receiving a response. Think of it
as calling the deployed function. Every curl you send to OpenAI, every API call
in your LangChain app, every autocomplete GitHub Copilot shows you: that's inference.
As a developer building with AI rather than building AI, inference is your entire
relationship with the model. Understanding that distinction de-mystifies the cost
structure, the latency, and the boundaries of what you can change at runtime.
Foundation models and why they changed everything¶
A foundation model is a large model pre-trained on broad, general data — billions of web pages, books, code — so that it can be adapted to many tasks without being retrained from scratch.
Before foundation models, you trained a bespoke neural network for each task: one for sentiment analysis, a separate one for translation, another for summarisation. That required task-specific labelled data and significant compute for every new use case. Foundation models inverted the economics: train one gigantic model once on everything, then fine-tune or simply prompt it for specific tasks. GPT-4o, Claude, and Gemini are all foundation models. So are image generators like Stable Diffusion and code models like GitHub Copilot's backbone.
The software analogy: foundation models are like the OS or a major shared library. You don't rewrite the kernel for each application — you call the API. Foundation models provide a similar leverage: a common, powerful base that the whole ecosystem builds on top of.
Open vs closed source models¶
Models come in two flavours, with real tradeoffs for engineering teams:
Closed source (OpenAI GPT-4o, Anthropic Claude, Google Gemini): you interact via an API; weights are not public. Advantages — generally the highest capability at the frontier, no infra to run, the provider handles safety and updates. Disadvantages — data leaves your network, per-token cost at scale, no customisation of weights, potential vendor lock-in.
Open source / open weights (Meta Llama, Mistral, Falcon): weights are publicly downloadable. You can run them on your own hardware (or cloud). Advantages — full data privacy, self-hosted cost model (pay for compute, not per token), ability to fine-tune on proprietary data. Disadvantages — you own the infra, security, and updates; typically lags closed frontier models on benchmarks; smaller models may require more careful prompting.
At a glance:
| Closed (GPT-4o, Claude, Gemini) | Open weights (Llama, Mistral) | |
|---|---|---|
| Access | API only; weights private | download and run yourself |
| Capability | usually the frontier best | strong, typically a step behind |
| Your data | leaves your network | stays in-house |
| Cost model | per token | pay for compute you run |
| Infra/ops | provider handles it | you own it |
| Customise weights | no | yes (fine-tune) |
Practically: most teams start with a closed API to validate the idea, then evaluate whether open models meet their quality bar at lower cost. The choice is rarely permanent; the ecosystem moves fast.
Specific model names age fast
The flagship names and version numbers in this course move every few months — by the time you read this, the leaders will have shifted (and context windows have largely converged around ~1M tokens at the frontier). Treat every model name here as an example of a category, not a current recommendation. For today's best model on a given task, check a live leaderboard such as LMArena rather than any course's snapshot.
Mental model
Think of AI as a set of nested circles: AI is the outermost city, ML is a district within it, deep learning is a neighbourhood, and generative AI is the hottest block on that street. Transformers are the construction technique that built most of the buildings in that neighbourhood. Foundation models are the shared utilities everyone taps into. You — the developer — mostly show up to use the utilities (inference), not to lay the pipes (training).
When NOT to reach for an LLM¶
An LLM is the wrong tool more often than the hype suggests. The first instinct of a good evaluator is to ask "does this even need a model?" Reach for something simpler when:
- The rule is fixed and known. Validating an email format, calculating tax, routing by a
lookup table — a regex, a formula, or a
switchis cheaper, instant, and always correct. - You need exact, reproducible answers. Financial totals, compliance decisions, anything audited — deterministic code wins; an LLM only probably agrees with itself.
- A database query already answers it. "What's this order's status?" is a SQL lookup, not a generation task.
- Latency or cost is critical at scale. A model call is roughly 100–1000× slower and pricier than a function call; don't put one in a hot path a few lines of code can handle.
The honest framing: an LLM earns its place when the input is messy, unstructured, or open-ended language — and the output can tolerate "usually right, verify the rest." If the task is deterministic, structured, or must be exactly correct, prefer plain code and call the model only for the fuzzy edges.
In plain words
Don't use a self-driving car to back out of your own driveway. LLMs are for the messy, judgement-heavy stretches of the journey — not the parts a simple rule already nails.
Hands-on¶
Open Lab 1 — Compare Models. You'll send the same prompt to several models, compare outputs side-by-side, and build intuition for how model size and provider choice affect quality and latency.
Go deeper¶
-
A Visual Introduction to Machine Learning — R2D3 — An elegant interactive visualisation that walks you through a decision tree learning on real data; the best 5-minute intuition builder for what "learning from examples" actually means.
-
But what is a Neural Network? — 3Blue1Brown — Grant Sanderson's animated deep-dive makes the math feel like visual magic; watch this if you want genuine intuition for layers, weights, and learning — no calculus prerequisite.
-
The Illustrated Transformer — Jay Alammar — The go-to diagram-heavy walkthrough of the 2017 transformer paper; every concept is paired with a concrete visual, and it's been the standard reference for engineers coming up to speed for years.
-
Transformer Explainer — Polo Club / Georgia Tech — A live, interactive GPT-2 running in your browser; hover over any component and see real attention weights and intermediate computations update in real time.
Jargon recap¶
AI · ML · deep learning · neural network · transformer · attention · training · inference · foundation model · parameters / weights
Check yourself¶
Try to answer before expanding — active recall is what makes it stick.
How do AI, ML, deep learning, and generative AI relate to one another?
They nest as concentric circles: AI is the broadest, ML is a subset of AI, deep learning is a subset of ML, and generative AI is a subset of deep learning. Each step is narrower and more specific than the one around it.
What is the difference between supervised, unsupervised, and reinforcement learning?
Supervised learning trains on labelled input→output examples (an answer key). Unsupervised learning finds structure in unlabelled data (no answer key). Reinforcement learning learns from trial and error using rewards and penalties.
Why will you almost always do inference and almost never do training?
Training is the one-time, weeks-long, multi-million-dollar process the model maker runs to fit the weights. Inference is just calling the finished model via an API — that is your entire relationship with the model as a developer building with AI.
When should you NOT reach for an LLM?
When the task is deterministic, structured, or must be exactly correct — fixed rules, audited calculations, a SQL lookup, or a latency-critical hot path. An LLM earns its place only when the input is messy, open-ended language and the output can tolerate "usually right, verify the rest."
Key takeaways¶
- AI → ML → deep learning → generative AI — each step is a narrower, more specific technology nested inside the one before it.
- ML learns rules from examples; deep learning does so with many-layered neural networks; generative AI creates new content using that foundation.
- Transformers (2017) process tokens in parallel and use attention — that's why modern LLMs are so much better at language than earlier approaches.
- Training is expensive and done by model makers; inference is cheap and is everything you do as a developer.
- Foundation models provide a general-purpose base that the whole ecosystem fine-tunes and prompts — the OS analogy is apt.