Latest / CyberSecurity Summary / Deep Learning from Scratch: Building with Python from First Principles
Transcript
- 0:00Speaker 1: So if you ask an artificial intelligence to write a
- 0:03Speaker 1: Shakespearean saunet about I don't know a toaster.
- 0:06Speaker 2: Right, it just does it in like three seconds.
- 0:08Speaker 1: Flat, exactly. It's so incredibly fast and honestly so convincingly
- 0:14Speaker 1: human that it's really easy to just throw our hands
- 0:16Speaker 1: up and say, well, the computer is just thinking.
- 0:18Speaker 2: Yeah, that's the illusion.
- 0:19Speaker 1: But here is the secret that the tech world sort
- 0:22Speaker 1: of you know, blides right past. The AI doesn't actually
- 0:27Speaker 1: know what a toaster is.
- 0:29Speaker 2: No, not at all.
- 0:30Speaker 1: It doesn't know what a poem is. It's not experiencing
- 0:32Speaker 1: this burst of creative genius underneath the hood. It is
- 0:37Speaker 1: really just doing a massive amount of incredibly fast, very
- 0:41Speaker 1: boring accounting.
- 0:42Speaker 2: Which is exactly what we're going to get into.
- 0:44Speaker 1: Right. So today, for you, our listener, we're opening that ledger.
- 0:47Speaker 1: We are taking you on a custom tailored deep dive
- 0:50Speaker 1: to totally demystify how artificial intelligence actually you know, learns.
- 0:55Speaker 2: Yeah, no magic, no impenetrable labyrinths, just the raw mechanics.
- 0:59Speaker 1: The mechanics.
- 1:00Speaker 2: Because I mean, we appreciate the result of a neural network, right,
- 1:03Speaker 2: we rarely understand the underlying chemistry of how it actually
- 1:06Speaker 2: got there.
- 1:07Speaker 1: It's totally a black box for most people exactly.
- 1:10Speaker 2: So our guide for pulling back the curtain today is
- 1:12Speaker 2: this fantastic book by Seth Widman. It's called deep Learning
- 1:16Speaker 2: from Scratch, Building with Python from first principles A great resource,
- 1:20Speaker 2: really is. And what we're going to do is take
- 1:22Speaker 2: all that intimidating jargon, you know, the algorithms, the calculus,
- 1:26Speaker 2: the hyper parameteris very stuff, all of it, and we're
- 1:29Speaker 2: going to strip it all the way down to the
- 1:31Speaker 2: foundational floorboards.
- 1:33Speaker 1: So we're going to use simple math, visual diagrams, and
- 1:36Speaker 1: some basic code to show you that deep learning is
- 1:39Speaker 1: really just a highly scaled assembly line of very very
- 1:43Speaker 1: simple mathematical factories.
- 1:44Speaker 2: That's a great way to put it.
- 1:46Speaker 1: But before we actually get to building that assembly line,
- 1:48Speaker 1: we need to talk about why loving this stuff in
- 1:51Speaker 1: the first place is normally such a complete nightmare. Oh
- 1:53Speaker 1: it really is, because if you try to read a
- 1:55Speaker 1: standard academic paper on neural networks, it often feels like
- 1:59Speaker 1: you're trying to read ancient Greek. Why is the entry
- 2:02Speaker 1: point so brutal?
- 2:04Speaker 2: Well, Wideman tackles this right out of the gate. He
- 2:07Speaker 2: uses that old parable of the blind men and the elephant.
- 2:10Speaker 1: Oh right, sure.
- 2:11Speaker 2: So you have a group of blind men who encounter
- 2:14Speaker 2: an elephant for the first time. One touches the trunk
- 2:17Speaker 2: and says, oh, an elephant is like a thick snake, right,
- 2:20Speaker 2: Another touches the year and says, no, it's a fan.
- 2:22Speaker 2: Another grabs the leg and says it's a tree trunk.
- 2:25Speaker 1: And they're all kind of right but also completely wrong exactly.
- 2:30Speaker 2: They are all describing a correct, isolated part, but none
- 2:35Speaker 2: of them are describing the whole animal. And deep learning
- 2:38Speaker 2: resources have historically done the exact same thing.
- 2:41Speaker 1: Okay, that makes a lot of sense because, like, if
- 2:43Speaker 1: you want to learn a standard computer science concept, say
- 2:46Speaker 1: how a search algorithm works, the resources out there are
- 2:50Speaker 1: usually holistic, Like a good textbook gives you a plain
- 2:53Speaker 1: English explanation, then they give you a whiteboard diagram, then
- 2:56Speaker 1: the math, and finally the pseudo code so you can
- 2:59Speaker 1: actually build it. You get the whole elephant, right, you
- 3:01Speaker 1: get the whole elephant. But AI resources fracture this, don't They.
- 3:05Speaker 2: Completely The field sort of fractured into two really extreme camps.
- 3:09Speaker 2: On one side, you have these highly conceptual, incredibly dense.
- 3:15Speaker 1: Math textbooks, the ancient Greek exactly.
- 3:18Speaker 2: Wideman points to Ian Goodfellow's famous Deep Learning book and look,
- 3:22Speaker 2: it's an absolute masterpiece. Sure, but if you aren't already
- 3:26Speaker 2: fluent in advanced calculus and linear algebra, you're going to
- 3:30Speaker 2: hit a brook wall on like page ten, it's just
- 3:33Speaker 2: a sea of abstract equations.
- 3:34Speaker 1: So what's the other extreme then, Because if I don't
- 3:37Speaker 1: want to drown in calculus, where do people usually go?
- 3:40Speaker 2: Well, they go to the highly practical, code heavy tutorials.
- 3:45Speaker 2: So you might look up the documentation for a modern
- 3:47Speaker 2: library like PyTorch okay, and you just copy a block
- 3:51Speaker 2: of Python code, you paste it, you run it, and
- 3:53Speaker 2: you watch this number on your screen called the loss
- 3:56Speaker 2: value start to go down.
- 3:57Speaker 1: Which means it's working right.
- 3:59Speaker 2: Technically, Yes, the network is learning, but the tutorial never
- 4:02Speaker 2: actually stops to explain the why. It's like you're driving
- 4:05Speaker 2: a sports car but you have zero clue how the
- 4:08Speaker 2: internal combustion engine works.
- 4:09Speaker 1: Which is I'm guessing where Widman's approach comes in. He argues,
- 4:13Speaker 1: you have to merge these perspectives.
- 4:15Speaker 2: Yes, exactly. His core thesis is that to truly understand
- 4:19Speaker 2: neural networks, you have to hold multiple mental models in
- 4:22Speaker 2: your head simultaneously.
- 4:23Speaker 1: Okay, what does that look like?
- 4:25Speaker 2: Well, you have to look at a neural network and
- 4:27Speaker 2: see it as a mathematical function, but at the exact
- 4:30Speaker 2: same time, you have to see it as a computational
- 4:32Speaker 2: graph where data physically flows from left to right. Got it.
- 4:36Speaker 2: You also have to see it as a series of
- 4:38Speaker 2: layered neurons, and finally, you have to understand it conceptually
- 4:42Speaker 2: as a universal function approximator.
- 4:44Speaker 1: Wait, hold on, a universal function approximator. Yeah, that sounds
- 4:49Speaker 1: like a fancy blender from a late night infomercial or something.
- 4:53Speaker 1: What does that actually mean?
- 4:55Speaker 2: I know it sounds super intimidating, but it just means
- 4:58Speaker 2: a machine that can mold it self to approximate literally
- 5:02Speaker 2: any pattern in the universe, provided it has enough parts.
- 5:05Speaker 2: Any pattern, pretty much, whether the pattern is predicting tomorrow's weather,
- 5:09Speaker 2: or recognizing a cat in a photo, or translating English
- 5:13Speaker 2: to French. If there's a logical relationship between the input
- 5:16Speaker 2: and the output, a neural network can approximate it. That's wild,
- 5:20Speaker 2: it is, But you only realize how it does that
- 5:23Speaker 2: if you force yourself to see the math, the diagram
- 5:25Speaker 2: and the code side by side and.
- 5:27Speaker 1: I guess that's why Widman forces the reader to build
- 5:30Speaker 1: these networks from scratch in Python, using just like basic arrays.
- 5:34Speaker 2: In numpis exactly.
- 5:35Speaker 1: It's not because you're trying to build the fastest AI
- 5:37Speaker 1: in the world. It's purely an exercise in solidifying your
- 5:40Speaker 1: understanding of those models.
- 5:42Speaker 2: Spot on.
- 5:42Speaker 1: So let's start doing exactly that for the listener. Let's
- 5:46Speaker 1: abandon the complex terminology. We need to start at the
- 5:49Speaker 1: absolute foundation of all machine learning, the mathematical function and
- 5:54Speaker 1: the derivative right.
- 5:55Speaker 2: And usually when we learn about functions in high school,
- 5:58Speaker 2: we use the Cartesian plane, you know, Rineiti Card's classic
- 6:02Speaker 2: X and Y.
- 6:02Speaker 1: Axes, the good old graph paper.
- 6:04Speaker 2: Exactly, you plot some points, you draw a curved line
- 6:07Speaker 2: through them, and that's fine for basic geometry, but it's
- 6:10Speaker 2: actually a terrible mental model for deep learning.
- 6:13Speaker 1: Yeah, drawing parabolas isn't going to help us build an AI. Instead,
- 6:17Speaker 1: Widman tells us to visualize a function as a mini factory,
- 6:20Speaker 1: just a physical box sitting on a table. Inputs go
- 6:23Speaker 1: into the box on a conveyor belt. The factory has
- 6:27Speaker 1: some internal strict rules that it applies to whatever comes in,
- 6:31Speaker 1: and then a transformed output comes out the other side precisely.
- 6:35Speaker 2: So let's say the factory is a square function. Okay,
- 6:38Speaker 2: you send the number two into the factory. The factory's
- 6:41Speaker 2: internal rule is to multiply the input by itself, so
- 6:44Speaker 2: outcomes the number four. You send in a three outcomes
- 6:47Speaker 2: of nine. It's just a simple predictable machine.
- 6:49Speaker 1: Okay. So if the function is just a factory box,
- 6:52Speaker 1: what is a derivative? Because just hearing the word derivative
- 6:55Speaker 1: definitely triggers some traumatic math flashbacks for me.
- 6:58Speaker 2: Oh for sure. But let's dick with our factory visualization. Yeah,
- 7:01Speaker 2: imagine there is a physical string connecting the input of
- 7:04Speaker 2: the factory to the output of the factory, a string.
- 7:07Speaker 1: Okay.
- 7:07Speaker 2: The derivative is simply asking a very practical question. If
- 7:10Speaker 2: you pull on the input string by a very very
- 7:14Speaker 2: small amount, a tiny nudge like point zero zero zero one,
- 7:17Speaker 2: by what multiple does the output string move?
- 7:20Speaker 1: Ah? Okay, So it's kind of like adjusting an analog
- 7:23Speaker 1: volume knob on an old stereo. If I nudge the
- 7:27Speaker 1: input dial just a tiny fraction of a millimeter, how
- 7:30Speaker 1: much louder does the music actually get? Like? Does a
- 7:33Speaker 1: tiny nudge on the input cause a massive blown speaker
- 7:37Speaker 1: spike in the output, or does it barely move the
- 7:40Speaker 1: needle at all?
- 7:41Speaker 2: Exactly? You're measuring the rate of change.
- 7:43Speaker 1: But okay, why is this tiny nudge so crucial? Like
- 7:47Speaker 1: why does an artificial intelligence care so much about this
- 7:50Speaker 1: little string?
- 7:51Speaker 2: Because this rate of change? Knowing exactly how the input
- 7:56Speaker 2: affects the output is the literal engine of machine learning. Yes,
- 8:01Speaker 2: it is how the model knows how to correct its
- 8:03Speaker 2: own errors. Think about it. If an AI makes a
- 8:06Speaker 2: prediction and that prediction is wrong, it needs to know
- 8:09Speaker 2: how to fix it right.
- 8:10Speaker 1: It has to adjust.
- 8:11Speaker 2: And if the AI knows exactly how a tiny nudge
- 8:13Speaker 2: to its internal settings will affect the final outcome, it
- 8:16Speaker 2: knows exactly which dials to turn and in which direction
- 8:19Speaker 2: to get a better result next time. The derivative is
- 8:21Speaker 2: basically the compass pointing toward the correct answer.
- 8:24Speaker 1: I see. Okay, so we have a single mini factory.
- 8:26Speaker 1: You nudge the input, you watch the output change, you
- 8:28Speaker 1: adjust the dial. That makes sense, but predicting a housing
- 8:32Speaker 1: price or writing a poem takes way more than one
- 8:35Speaker 1: mathematical step. Real data doesn't just go through one simple rule.
- 8:39Speaker 1: So how do these boxes actually talk? To each other
- 8:41Speaker 1: without losing all the data.
- 8:43Speaker 2: So this brings us to the concept of nested functions.
- 8:46Speaker 2: In deep learning. You almost never have just one factory.
- 8:50Speaker 1: You have a chain of them, an assembly line.
- 8:52Speaker 2: Exactly an assembly line. The output conveyor belt of factory
- 8:55Speaker 2: one feeds directly into the input conveyor belt a factory
- 8:59Speaker 2: two one transforms the raw data, passes it to factory two,
- 9:03Speaker 2: which transforms it again, and so on.
- 9:05Speaker 1: Okay, but if I nudge the input at the very
- 9:07Speaker 1: beginning of the assembly line, that ripple has to travel
- 9:10Speaker 1: through every single factory to reach the end. How do
- 9:13Speaker 1: we track that string across ten different boxes.
- 9:16Speaker 2: We use what might be the single most important mathematical
- 9:18Speaker 2: rule in all the deep learning, the chain rule from calculus,
- 9:22Speaker 2: the chain rule. Yes and again, Wideman demystifies this beautifully
- 9:26Speaker 2: using the factory boxes.
- 9:28Speaker 1: Okay, let's trace the string. Then, let's say we have
- 9:29Speaker 1: two boxes. We pull the string on the input to
- 9:31Speaker 1: box one. We observe that its output changes by a
- 9:34Speaker 1: factor of three, so a three in a multiplier. Right,
- 9:37Speaker 1: That output is now the input for box two. And
- 9:40Speaker 1: we already know that if we tweak the input of
- 9:43Speaker 1: box two, its output changes by a factor of say
- 9:46Speaker 1: migus two units.
- 9:47Speaker 2: Perfect setup. So to find the total change across the
- 9:51Speaker 2: entire chain from the very first input to the very
- 9:53Speaker 2: last output, the chain rule says, we simply multiply those
- 9:56Speaker 2: rates of change together. Just multiply them, just multiply them.
- 10:00Speaker 2: One changes things by a factor three, box two changes
- 10:02Speaker 2: things by a factor of niggas two. The total change
- 10:05Speaker 2: across the whole chain is three multiplied by niggas two,
- 10:08Speaker 2: which equals negative six.
- 10:10Speaker 1: Oh wow, so a one unit nudge at the start
- 10:12Speaker 1: creates a null six unit shift at the very end.
- 10:14Speaker 2: Exactly.
- 10:15Speaker 1: But wait, practically speaking, if I'm actually coding this assembly line,
- 10:18Speaker 1: how does the system know those numbers? Like?
- 10:20Speaker 2: Do?
- 10:20Speaker 1: I have to run the data all the way forward
- 10:22Speaker 1: to get an answer, and then somehow trace my steps
- 10:24Speaker 1: all the way backward to figure out the chain rule math.
- 10:26Speaker 2: That is exactly what you have to do. To code
- 10:29Speaker 2: this from scratch. Your system has to make two distinct passes.
- 10:34Speaker 2: First is the forward pass. Okay, forward, You feed your
- 10:37Speaker 2: initial data into the first factory and you let it
- 10:40Speaker 2: run all the way down the assembly line. But here's
- 10:42Speaker 2: the catch. As the data moves forward, the system has
- 10:46Speaker 2: to save all the intermediate quantities at every single step.
- 10:50Speaker 2: It has to keep a meticulous record of what happened
- 10:53Speaker 2: inside each box.
- 10:54Speaker 1: Why doesn't need to save all that? If it reaches
- 10:56Speaker 1: the end and gets an answer, hasn't it done its job?
- 10:58Speaker 2: Because of the second step, the backward pass. Once the
- 11:02Speaker 2: data reaches the end and then network spits out a prediction,
- 11:05Speaker 2: you compare that prediction to the correct answer to see
- 11:08Speaker 2: how wrong you were. Then you run backward down the
- 11:11Speaker 2: assembly line. You use all those intermediate records you save
- 11:14Speaker 2: during the forward pass to calculate the derivatives the strings.
- 11:17Speaker 2: Going backward, you calculate box two string, then multiply it
- 11:20Speaker 2: by box one string using the chain rule, all the
- 11:23Speaker 2: way back to the start.
- 11:24Speaker 1: I'm not going to lie. That sounds incredibly tedious to
- 11:27Speaker 1: code by hand, keeping track of every single variable, saving
- 11:30Speaker 1: it all in memory, running backward, multiplying the strings. It
- 11:34Speaker 1: sounds like an absolute nightmare of bookkeeping.
- 11:37Speaker 2: It is. It's a massive bookkeeping operation. Yeah, and this
- 11:40Speaker 2: is exactly why modern deep learning libraries like PyTorch are
- 11:44Speaker 2: so popular.
- 11:44Speaker 1: Today because they do it for you exactly.
- 11:47Speaker 2: They use something called automatic differentiation. They handle all that
- 11:52Speaker 2: tedious forward and backward bookkeeping completely invisibly. You just define
- 11:56Speaker 2: the factories and the library does the calculus for you.
- 11:58Speaker 1: But Widman forces you to it by hand anyway, right,
- 12:01Speaker 1: he does, because if you just rely on PyTorch, you're
- 12:03Speaker 1: back to being a blind man touching the elephant. You
- 12:06Speaker 1: don't see the whole process exactly.
- 12:08Speaker 2: By coding the forward and backward passes from scratch in Python,
- 12:11Speaker 2: you actually see the mechanics. You realize that learning isn't consciousness.
- 12:15Speaker 2: It's literally just a series of multipliers passed backward down
- 12:19Speaker 2: an assembly line.
- 12:19Speaker 1: Okay, I'm with you on the strings in the assembly line,
- 12:22Speaker 1: But single numbers are great for theory. Reality is messy.
- 12:26Speaker 2: Very messy.
- 12:27Speaker 1: If I want an AI to predict a housing price,
- 12:30Speaker 1: I'm not just feeding it a single number. A house
- 12:34Speaker 1: has dozens of features, square footage, number of bedrooms, age
- 12:38Speaker 1: of the roof, proximity to a highway. So how do
- 12:41Speaker 1: we pull a string on a massive spreadsheet of information?
- 12:45Speaker 2: This is where we scale up to matrices and supervised
- 12:47Speaker 2: learning sew of us. Learning is just finding relationships between
- 12:51Speaker 2: characteristics that have already been measured, Okay, and to process
- 12:54Speaker 2: all those characteristics, we can't use single numbers. We have
- 12:57Speaker 2: to stack the data into grids, which in numb pie
- 13:00Speaker 2: are called end arrays or n dimensional arrays.
- 13:03Speaker 1: Right. So, if you visualize a spreadsheet, the columns are
- 13:06Speaker 1: the features like bedrooms, square footage, and every specific house
- 13:10Speaker 1: you are evaluating becomes a row.
- 13:12Speaker 2: Yep.
- 13:13Speaker 1: So a two x two grid might be two houses
- 13:15Speaker 1: each with two features exactly.
- 13:16Speaker 2: Now, when this grid of data enters the first factory,
- 13:19Speaker 2: the model needs a way to evaluate it. It performs
- 13:22Speaker 2: what's called a weighted sum.
- 13:23Speaker 1: A weighted sum.
- 13:24Speaker 2: Right. It looks at the features and decides how important
- 13:27Speaker 2: each one is. Does the square footage matter more than
- 13:30Speaker 2: the age of the roof? It assigns a mathematical weight
- 13:33Speaker 2: to each feature.
- 13:33Speaker 1: Okay, let me guess how this works mathematically. If I
- 13:37Speaker 1: have a column for bedrooms in a way that says
- 13:40Speaker 1: bedrooms are very important, is the factory just doing a
- 13:44Speaker 1: dot product like matching them up?
- 13:46Speaker 2: Yes. Think of a dot product as a matching game.
- 13:50Speaker 2: The factory lines up the house's features in one hand
- 13:53Speaker 2: and its internal priority weights in the other.
- 13:55Speaker 1: Okay.
- 13:56Speaker 2: It matches the bedrooms to the bedroom weight, multiplies them together,
- 14:00Speaker 2: matches the square footage to the square footage weight, multiplies them.
- 14:03Speaker 2: Then it throws all those paired results into one single
- 14:06Speaker 2: bucket and adds them up.
- 14:08Speaker 1: That's the sum, right, But if you keep multiplying features
- 14:11Speaker 1: by weights, that bucket is going to overflow real fast.
- 14:14Speaker 1: I mean, a three thousand square foot house multiplied by
- 14:16Speaker 1: a heavyweight becomes a massive number. Do we just let
- 14:19Speaker 1: the numbers get infinitely large?
- 14:21Speaker 2: We can't, which is why we usually feed that bucket
- 14:23Speaker 2: into another factory right afterward, typically something called a sigmoid function.
- 14:28Speaker 1: A sigmoid function, we haven't covered that one. What's that?
- 14:30Speaker 2: A sigmoid function is basically a squishing factory.
- 14:32Speaker 1: A squishing factory.
- 14:33Speaker 2: Yeah, it takes whatever wild massive number comes out of
- 14:36Speaker 2: the weighted sum, and it brutally compresses it into a
- 14:40Speaker 2: manageable decimal between zero and one.
- 14:42Speaker 1: Oh.
- 14:42Speaker 2: I see this is incredibly useful if you just want
- 14:44Speaker 2: the network to give you a probability, like a point
- 14:47Speaker 2: eight chance that the house is a goodbye, rather than
- 14:49Speaker 2: outputting a raw score of four million.
- 14:51Speaker 1: Okay, so our assembly line is now take the matrix
- 14:54Speaker 1: of houses, match them with weights, sum them up, and
- 14:58Speaker 1: then squish them through a sigmoid factory to get a probability.
- 15:01Speaker 2: You got it.
- 15:02Speaker 1: I get the forward pass. But here's where my brain
- 15:04Speaker 1: completely breaks. To do the backward pass, we have to
- 15:08Speaker 1: pull the string to correct the errors. How on earth
- 15:12Speaker 1: do you track the derivative of a giant grid of
- 15:15Speaker 1: interacting numbers. Every row and column is interacting with every weight.
- 15:19Speaker 1: The calculus must just explode into absolute chaos, you would.
- 15:23Speaker 2: Think so tracking every single string individually across a massive
- 15:26Speaker 2: matrix would be impossible, right, But the math looks incredibly
- 15:30Speaker 2: messy on a whiteboard, while the resulting code is brilliantly,
- 15:34Speaker 2: shockingly clean. It's a magical property of linear algebra.
- 15:39Speaker 1: WHOA, I would stop right there, time out. You literally
- 15:41Speaker 1: cannot start this deep dive by promising no magic and
- 15:45Speaker 1: then tell me the math relies on a magical property
- 15:48Speaker 1: that is totally cheating. Explain it. Why does the matrix
- 15:52Speaker 1: math clean up so nicely?
- 15:54Speaker 2: Fair? Catch? Okay, you're right, no magic. It comes down
- 15:57Speaker 2: to something called matrix transposition.
- 15:58Speaker 1: Matrix transposition.
- 16:00Speaker 2: Yes, when you need to compute the backward pass the
- 16:02Speaker 2: gradient for a giant grid of weights, the chain rule
- 16:07Speaker 2: dictates that you don't actually have to calculate a million
- 16:10Speaker 2: individual strings. Instead, you take the input matrix, and you
- 16:13Speaker 2: simply transcose it. You flip it on its side.
- 16:16Speaker 1: Meaning the rows become columns and the columns become rows.
- 16:19Speaker 2: Exactly, And why does this work mechanically? Think of the
- 16:22Speaker 2: forward pass like a river flowing downstream, splitting into hundreds
- 16:26Speaker 2: of tiny branches. Those are your data points interacting with weights.
- 16:29Speaker 1: Okay, I picture it.
- 16:30Speaker 2: If you want to send an error signal back up
- 16:32Speaker 2: the river to the exact source that caused it, you
- 16:34Speaker 2: just referse the map. Flipping the matrix on its side
- 16:37Speaker 2: perfectly re routes the air signals backward along the exact
- 16:40Speaker 2: same mathematical paths the data used to travel forward.
- 16:43Speaker 1: Oh wow, So you aren't doing entirely new chaotic math
- 16:47Speaker 1: to go backward, not at all. You're just taking the
- 16:49Speaker 1: infrastructure you build going forward, turning it sideways, and letting
- 16:52Speaker 1: the error flow back to the correct weight.
- 16:54Speaker 2: Precisely because of how matrix transposes work out mathematically, this
- 16:59Speaker 2: incredibly common plex web of interacting data collapses into a
- 17:03Speaker 2: few incredibly simple lines of Python code. During the backward pass.
- 17:07Speaker 2: It scales perfectly.
- 17:08Speaker 1: That is wild. So it doesn't matter if I'm feeding
- 17:11Speaker 1: the factory a single two x two grid or a
- 17:14Speaker 1: massive matrix with a million rows representing every house in
- 17:17Speaker 1: the country. The logic of the assembly line stays exactly
- 17:20Speaker 1: the same.
- 17:21Speaker 2: Exactly the same.
- 17:22Speaker 1: The forward pass runs the matching game and squishes the numbers.
- 17:25Speaker 1: The backward pass flips the map on its side to
- 17:27Speaker 1: route the blame, runs the chain roll and updates the weights.
- 17:31Speaker 2: And that is why we can have AI models today
- 17:34Speaker 2: with billions or even trillions of parameters. The fundamental architecture,
- 17:38Speaker 2: the mini factory, the chain roll, the matrix transposes. It's
- 17:42Speaker 2: infinitely scalable. You just need more powerful computers to run
- 17:45Speaker 2: the assembly line faster.
- 17:46Speaker 1: Okay, let's bring this all together for you, the listener.
- 17:50Speaker 1: We started this deep dive staring at a hidden circuitry
- 17:52Speaker 1: that everyone just assumes is impenetrable, but by looking through
- 17:56Speaker 1: the lens of Seth Weidman's work, we've stripped it down.
- 17:59Speaker 1: We have deep learning is an assembly line of mini factories.
- 18:03Speaker 1: We have inputs that flow forward through nested functions, matching
- 18:07Speaker 1: features to weights. We save our math as we go.
- 18:10Speaker 1: Then we compare our final answer, and we pull the
- 18:13Speaker 1: strings backward, flipping the matrices to calculate exactly how to
- 18:17Speaker 1: adjust our internal dials. It's not a brain, it's just
- 18:21Speaker 1: very fast, very elegant bookkeeping. You now have the foundational
- 18:25Speaker 1: mental model for how machines actually learn.
- 18:29Speaker 2: It's a very empowering realization, honestly, to finally see the
- 18:32Speaker 2: gears turning. But this actually raises a really important question,
- 18:35Speaker 2: and it's the thought I want to leave you with today.
- 18:37Speaker 2: It goes all the way back to the very first
- 18:39Speaker 2: step of this entire process supervised learning.
- 18:42Speaker 1: You mean, like setting up the grid of numbers in
- 18:44Speaker 1: the first place.
- 18:44Speaker 2: Right. Widman points out that to use these beautiful mathematical
- 18:48Speaker 2: assembly lines, we have to translate the messy, ambiguous real
- 18:52Speaker 2: world into precise numbers.
- 18:54Speaker 1: Yeah.
- 18:54Speaker 2: In our example, we chose price to perfectly represent a
- 18:58Speaker 2: house's value. The market decides the price, so mathematically that works.
- 19:02Speaker 2: But what happens when we try to force incredibly complex
- 19:05Speaker 2: human concepts into a single numeric matrix just to make
- 19:09Speaker 2: the math run.
- 19:10Speaker 1: So wait, if we're building a hiring algorithm, we have
- 19:13Speaker 1: to somehow turn a concept like desirability or work ethic
- 19:17Speaker 1: into a column on a spreadsheet exactly.
- 19:20Speaker 2: Or if we're building a loan approval model, we have
- 19:22Speaker 2: to quantify something like reliability. We have to convert nuanced,
- 19:26Speaker 2: deeply human ideas into cold, hard numbers so our minifactories
- 19:30Speaker 2: can actually process them.
- 19:31Speaker 1: So if we use something like say, zip codes to
- 19:33Speaker 1: help predict loan defaults, the math might work perfectly on
- 19:35Speaker 1: the assembly line, but we've accidentally built a machine that
- 19:38Speaker 1: mathematically justifies redlining es. The bias isn't in the AI's brain.
- 19:42Speaker 1: The bias is baked into the columns of the spreadsheet
- 19:44Speaker 1: before the forward pass even starts.
- 19:47Speaker 2: Precisely, if the factory only knows what we put on
- 19:51Speaker 2: the conveyor belt, then the very first step of deep learning,
- 19:54Speaker 2: choosing which numbers represent reality, might actually be its biggest vulnerability.
- 19:59Speaker 1: That's terrible wifying.
- 20:00Speaker 2: Actually, it's a huge issue. Are our models objectively learning
- 20:04Speaker 2: the truth about the world or are they just efficiently
- 20:07Speaker 2: mathematically learning the biases we hardcoded into the system the
- 20:12Speaker 2: moment we decided what to measure.
- 20:13Speaker 1: That completely flips the script. We spent this whole time
- 20:17Speaker 1: demystifying the machinery inside the factory. We learned how the
- 20:20Speaker 1: boxes work, how the chain rule connects them. But maybe
- 20:23Speaker 1: the real question we should be asking isn't how the
- 20:25Speaker 1: factory processes the materials.
- 20:27Speaker 2: Who is deciding what materials are allowed on the conveyor
- 20:30Speaker 2: belt in the first place.
- 20:31Speaker 1: Exactly something for you to ponder until next time.