Part IV ยท Ch. 20 โ€” Soโ€ฆ What Is AI/ML?

Part IV ยท Chapter 20 of 20

Soโ€ฆ What Is AI/ML?

Zooming out: LLMs are one species in a big family


What did we actually build?

Nineteen chapters ago you had never seen a vector. Now you can hand-walk attention, read a loss curve, and decode "a rank-16 LoRA, 8K context, Q4" as if it were an ordinary sentence. But let's step back and ask the question this whole site pointed at without ever answering head-on: what kind of thing is an LLM? Is it "artificial intelligence"? "Machine learning"? "Deep learning"? You hear all three thrown at it โ€” and this is the chapter where they get sorted.

Fair warning: this is the one chapter that builds no new machine. It zooms all the way out, draws the family map of the field, drops a pin on exactly where the LLM sits, and shows you that the toolkit in your hands was never an "LLM toolkit" โ€” it was the field's shared toolkit all along.

I won't keep you waiting for the answer, because this site never teases. An LLM is all three of those words at once โ€” because they are nested rings, not rival camps, and the LLM lives in the innermost one. The rest of the chapter earns that sentence.

Everything was one idea in disguise

Let me recompress the entire site into a single sentence: an LLM is a gigantic function that takes a context of tokens and returns a probability for every possible next token โ€” and "training" was nothing but nudging that function's numbers, one small downhill step at a time, until its guesses stopped being wrong so often. Here is the job itself, from Chapter 9:

$$p(\text{next token} \mid \text{context})$$

In words: given the run of tokens so far, hand back the probability of every token that could come next. That distribution is the LLM's entire output.

Walk your own bench and watch the parts line up: tokens turned text into numbers (Ch. 7); embeddings gave every token a direction (Ch. 8); attention and the transformer are the shape of the function (Ch. 10โ€“11); softmax turned raw scores into that probability distribution (Ch. 9); cross-entropy loss graded each guess (Ch. 12); gradients pointed downhill and gradient descent took the steps (Ch. 13โ€“14); and the training run repeated that step trillions of times (Ch. 15).

That frame has a name. It is function-fitting, and it is the whole definition of machine learning: you don't tell the machine the rules; you give it a flexible function with millions of adjustable numbers and a way to measure wrongness, and you let a downhill walk find the numbers. An LLM is a spectacularly large instance of that recipe โ€” not a different kind of thing. Strip away the tokens and the trillions of steps, and the machinery of learning fits on one line:

$$\theta \leftarrow \theta - \eta\,\nabla L$$

In words: take every number in the model โ€” $\theta$ (theta, all the parameters) โ€” and nudge it a small step, of size $\eta$ (eta, the learning rate), in the direction that most reduces the loss. That direction is $\nabla L$ (the gradient of the loss, the compass we walk against). Then do it again.

That one line trains an LLM, a spam filter, a self-driving car's vision system, and a sonar classifier. The same line โ€” only the function and the data change.

Four nested rings

Now let's sort those three words, widest to narrowest, as rings inside rings. Picture first, definitions after:

Four concentric rings like a target sharing one center. The outer ring is labeled ARTIFICIAL INTELLIGENCE, with a band note 'hand-written rules โ€” old chess engines, a thermostat's logic (no learning)'. Inside it a ring labeled machine learning, band note 'rules learned from data, not written by hand'. Inside that a blue ring labeled deep learning, band note 'many-layered neural networks'. The innermost mint ring is labeled transformers, and a single mint dot at the very center is labeled 'the LLM you built'.
Not rival camps โ€” nested rings. AI is the widest goal and includes methods that never learn at all (hand-written rules). Machine learning is the part where rules are fit to data; deep learning is the part of that using many-layered neural networks; the transformer is one architecture in the deep ring โ€” and the LLM you built is a single dot at the center, AI and machine learning and deep learning all at once, just at different zoom levels.

Ring 1, the widest, is artificial intelligence (AI): the oldest, broadest goal โ€” make a machine do something that looks intelligent. Crucially, this ring includes methods with no learning at all: 1990s chess programs, tax software applying rules an accountant wrote, a thermostat's logic. Someone wrote those rules by hand. That is AI, and it is not machine learning.

Ring 2, inside it, is machine learning (ML): the subset where nobody writes the rules โ€” the machine finds them by fitting a function to data. The moment a system learns from examples instead of following hand-written instructions, it steps from the outer ring into this one.

Ring 3, inside that, is deep learning (DL): the flavor of ML where the flexible function is a neural network โ€” many layers of the weighted-sum-then-squash idea, stacked so early layers learn simple features and later ones build on them. Not all ML is deep: a line-fitter learns, but it is not a deep network. Deep learning is what made vision, speech, and language suddenly work in the 2010s.

Ring 4, the innermost, is where your pin goes: the transformer (Chapter 11) and the LLM built from it โ€” one deep-learning architecture, specialized for sequences of tokens, trained on a mountain of text. So the pin sits in all four rings at once, because they are nested: an LLM is a transformer, which is deep learning, which is machine learning, which is AI. Every "is it X?" answers yes; it is only a question of how far in you zoom.

One honest widening, so you don't over-fit to the center: the transformer is not the only tenant of the deep ring, and the deep ring is not all of ML. Beside the transformer live other architectures (next section), and outside the deep ring sit whole families โ€” decision trees, forests, clustering โ€” that never touch a neural network and still quietly win on huge classes of real problems. The center is famous; it is not the whole map.

Three ways a machine can learn

Zoom into the machine-learning ring and ask a different question: how does a model learn โ€” what does it learn from? There are three classic answers, and the whole field organizes around them.

Three panels. Supervised: three blue data dots each tagged with a check-answer label; 'learn from examples WITH answers'; example 'spam vs not, house prices'. Unsupervised: a scatter of blue dots lassoed by two dashed rings into clusters; 'find structure, NO answers'; example 'customer clusters, compression'. Reinforcement: a mint agent box with an action arrow to a muted world box and an amber reward arrow back; 'act, get reward, adjust'; example 'play Go, steer a robot'. A mint-bordered banner across the bottom reads 'the LLM you built used TWO of these โ€” pretraining = self-supervised (a supervised trick), assistant polish = reinforcement (RLHF)', with connector ticks rising to the supervised and reinforcement panels only.
Three ways a machine can learn. Supervised learning trains on examples that come with the right answers; unsupervised learning finds structure in data with no answers; reinforcement learning acts in a world and chases reward. The LLM you built quietly used two of them: pretraining is self-supervised (the next token is the answer, free from the text), and the assistant polish on top is reinforcement learning from human preference.

Way one is supervised learning: examples come with the right answers โ€” photos labeled cat/dog, emails labeled spam/not, houses labeled with their price. The model learns to predict the answer from the input, and the loss measures how far its guess sits from the true label (Chapter 12's whole idea). This is the workhorse: classification and regression.

Way two is unsupervised learning: no answers at all, just raw data, and the job is to find structure in it โ€” group customers into natural clusters, compress a thousand features into the two that matter, spot the odd one out. Nobody labeled anything; the model organizes the pile.

Way three is reinforcement learning (RL): no fixed dataset โ€” an agent acts in a world, gets a reward or a penalty, and adjusts to earn more reward over time. This is how machines learned to play Go and steer robots, and it is deliberately harder, because the right answer is never handed over โ€” it has to be discovered through consequences.

Now the beat that makes the whole site click: where did the LLM learn? It used two of the three, in sequence. Pretraining (Chapter 15) is a sly form of supervised learning called self-supervised learning: the "label" for each position is just the next token, already sitting there in the text โ€” so the internet becomes a labeled dataset with no human labeling at all, which is exactly why LLMs could train on trillions of tokens. Then the assistant polish (Chapter 16) is a reinforcement-learning-style finish that rewards the responses humans prefer โ€” RLHF, or its leaner cousin DPO. The chatbot you talk to is a self-supervised base model with a preference-tuned finish.

Data has a shape โ€” match the tool to it

The last big idea of the map, and the sister site's whole third act in one sentence: the transformer is not the universal answer. Different data has different shape, and the winning architecture is usually the one whose structure matches the data's.

A mapping from data shape (left) to best-fit family (right), four rows joined by straight arrows. Row 1: a sequence of chips, 'sequence โ€” text, audio (order matters)', arrow to a mint-bordered 'transformer' pill, tagged 'Remembering Machines'. Row 2: a 4x4 pixel grid, 'grid โ€” images (neighbors matter)', arrow to a blue 'CNN' pill, tagged 'Seeing Machines'. Row 3: four nodes joined by edges, 'graph โ€” networks (highlighted), social graphs (no order)', arrow to a blue 'GNN' pill, tagged 'Networks of Relationships, link analysis lives here'. Row 4: a 3x3 spreadsheet grid, 'table โ€” rows and columns (a spreadsheet)', arrow to an amber 'classical methods โ€” trees, forests, boosting' pill, tagged 'The Classical Toolbox, often beats deep nets here'.
Match the tool to the shape of the data. Sequences (text, audio) fit transformers โ€” the machine you just built. Grids (images) fit CNNs; graphs (comms links, social networks) fit GNNs; plain tables of rows and columns are often won by classical methods like random forests, which beat deep networks on that kind of data while training in seconds. Real skill in this field is reading the data's shape and reaching for the right family.

Text and audio are sequences โ€” order matters, and each piece looks at the others โ€” so the transformer fits (and, before it, the recurrent networks it dethroned). The sister site's Remembering Machines tells the honest story of why attention replaced recurrence.

Images are grids โ€” a pixel's meaning depends on its neighbors, and the same little pattern (an edge, an eye) can appear anywhere โ€” so the winning tool is the convolutional neural network (CNN), which slides small learned filters across the grid and reuses the same weights everywhere: Seeing Machines.

Some data is a graph โ€” nodes joined by edges, with no natural order: social networks, road maps, and communications networks, where the stations are nodes and the links between them are edges. The tool is the graph neural network (GNN), which learns by passing messages between connected nodes. This is how machine learning predicts a node's role from the structure of the network around it โ€” the sister site's Networks of Relationships.

And a great deal of the world's most valuable data is just a table โ€” rows and columns, like a spreadsheet of customers or lab measurements โ€” where, surprisingly often, no neural network wins at all. The champions here are the classical methods: decision trees, random forests, gradient boosting. On tabular data they routinely beat deep networks while training in seconds and staying interpretable (The Classical Toolbox). The honest headline: deep learning is the right answer for perceptual, high-dimensional data โ€” pixels, audio, language โ€” and often the wrong one for a spreadsheet. Real expertise is reading a problem's data shape and choosing the right family: a forest for a spreadsheet, a GNN for a network, a transformer for a sequence.

Your toolkit already travels

Here is the chapter's gift: you did not learn a pile of "LLM facts." You learned the field's shared vocabulary, and it transfers to every architecture on that map with almost nothing to relearn.

Vectors and embeddings (Ch. 1, 8): every model represents its inputs as vectors โ€” a CNN turns an image patch into a vector, a GNN gives every node a vector, a recommender gives every song a vector. "Turn the thing into a vector" is step one of all of machine learning.

The dot product (Ch. 2), the operation I promised was the most important on the site, measures similarity everywhere: attention scores are dot products, an SVM's kernel is a dot product, a GNN's messages are weighted by dot products, a recommender ranks songs by the dot product of their vectors. Learn it once, meet it forever.

Matrices (Ch. 3), gradient descent and backprop (Ch. 13โ€“14), the loss (Ch. 12), softmax (Ch. 9): every neural network is stacked matrix transformations, trained by gradient descent walking downhill on a loss with backprop assigning the blame, and nearly every classifier ends in a softmax turning scores into a probability distribution. A CNN and a GNN and your transformer are, under the hood, the same three verbs: represent as vectors, transform with matrices, train downhill.

So carry this as a rule: when you open the sister site and meet a convolution or a message-passing step for the first time, it will feel new for about a paragraph โ€” and then you'll see it's your old friends in a new arrangement. You are not starting over; you're reading the same language with a new accent.

Where you're headed

This site answered one deep question โ€” how does an LLM actually work โ€” by building it from the first vector up. The sister site, AI/ML from the Ground Up, asks the broader one: how does the whole field work, and how do you choose the right model for any problem? It rebuilds machine learning from first principles โ€” line-fitting, the neuron, the classical toolbox, CNNs, RNNs, GNNs, generative models, reinforcement learning โ€” and ends by teaching you to pick the right tool given a problem's shape.

Your footing there is unusually good, because you arrive already fluent in the math. The sister site opens with a condensed Math Toolkit you can skim as a victory lap or skip outright โ€” every idea in it, you built in depth here. From there, jump to whatever pulls you: the classical methods that win on tables, how machines see, how they learn on graphs and networks, or the capstone that ties it together.

There is a third site, and for many readers it is the better next step โ€” especially if you arrived here from AI/ML from the Ground Up and have already walked its floors. How AI Makes Images takes everything you built here โ€” vectors, the dot product, gradient descent, backprop, attention โ€” and points it at pictures instead of words. It answers the question people ask second, right after the one about ChatGPT: when a machine makes a picture out of nothing, what is actually happening? The answer runs on your machinery. A network predicts noise instead of the next token, graded by a loss and trained downhill exactly as here; the prompt steers the image through the same attention you can now compute by hand. It is the third rung, and it assumes no more than you already have.

And to close the way we opened: you asked how these things actually work, and now you know โ€” not by analogy, but by the arithmetic. You can check attention by hand, read a loss curve, and place any model you meet on the family map. That was the promise. The door to the rest of the field is open, and you already speak the language. Go build something.

What you now know

  • An LLM is artificial intelligence and machine learning and deep learning at once, because those are nested rings, not rival camps: AI is the widest goal (it even includes hand-written rules that never learn), machine learning fits functions to data, deep learning uses many-layered neural networks, and the transformer is one architecture inside that โ€” with the LLM as a single dot at the center.
  • Everything on this site was one idea in disguise โ€” function-fitting: a flexible function with millions of adjustable numbers, a loss that measures wrongness, and the update $\theta \leftarrow \theta - \eta\,\nabla L$ walking it downhill; the same line trains a spam filter, a vision system, and a sonar classifier, with only the function and the data changed.
  • There are three classic ways to learn โ€” supervised (examples with answers), unsupervised (structure with no answers), and reinforcement (act and chase reward) โ€” and the LLM used two: self-supervised pretraining (the next token is the free label) followed by a preference-tuned reinforcement finish (RLHF or DPO).
  • Different data has different shape, and the winning architecture usually matches it: sequences โ†’ transformers, grids and images โ†’ CNNs, graphs and networks โ†’ GNNs, and plain tables โ†’ classical methods like random forests, which often beat deep networks on tabular data outright.
  • Your toolkit already travels: vectors, the dot product, matrices, gradient descent, backprop, loss, and softmax are the shared language of all of machine learning, so meeting a CNN or a GNN for the first time feels new for a paragraph and then resolves into old friends in a new arrangement.
  • The natural next step is one of two sites: AI/ML from the Ground Up, which rebuilds the whole field from the ground up and teaches the real skill โ€” choosing the right model for a problem โ€” or, if you have already read that one, How AI Makes Images, which points this same math at pictures and builds an image generator out of noise. You arrive at either already fluent in the math.

Where we're headed. This is the last chapter of this site โ€” so the door it opens isn't a next chapter here, it's the one across the hall: AI/ML from the Ground Up. You came here asking how one machine works, and you can now answer with arithmetic instead of analogy. The sister site widens the question to the whole field: it starts by fitting a single line to data โ€” the humblest possible act of machine learning โ€” and climbs through neurons, the classical toolbox, CNNs, RNNs, GNNs, generative models, and reinforcement learning, ending with the skill this chapter previewed: given a problem, read the shape of its data and choose the right tool. Skim or skip its math chapter โ€” you built all of it here โ€” then go wherever your curiosity pulls. And if you have already been down that hall, the door at the far end is How AI Makes Images, the third site: the same machinery, aimed at pictures, building one out of pure static. You already speak the language.