WEBVTT
Kind: captions
Language: en

00:00:00.080 --> 00:00:04.880
A few weeks ago, I knew pretty much nothing about&nbsp;
AI. But here I am about to unveil my handbuilt&nbsp;&nbsp;

00:00:04.880 --> 00:00:10.240
and hand-trained AI model to the godfather&nbsp;
of machine learning on YouTube, Seth Bling,&nbsp;&nbsp;

00:00:10.240 --> 00:00:14.720
and ask him to rate my work on a scale from 1 to&nbsp;
10. Seth, thank you for being here. Is it okay&nbsp;&nbsp;

00:00:14.720 --> 00:00:18.320
if I call you Seth or should I call you Seth?&nbsp;
No, Seth is great. It's a neural network that&nbsp;&nbsp;

00:00:18.320 --> 00:00:22.960
I've been trying to teach to play video games&nbsp;
better than a human can. It mimics the same&nbsp;&nbsp;

00:00:22.960 --> 00:00:27.600
principles as actual evolution to improve over&nbsp;
time. And it has a structure that's inspired by&nbsp;&nbsp;

00:00:27.600 --> 00:00:33.280
the neuron connections in an actual human brain.&nbsp;
But the craziest part of this project is not the&nbsp;&nbsp;

00:00:33.280 --> 00:00:39.120
simple math that at scale can create surprising&nbsp;
levels of intelligence. It's something much more&nbsp;&nbsp;

00:00:39.120 --> 00:00:44.000
subtle that I only ever would have learned from&nbsp;
walking this incredible path of self-study. And&nbsp;&nbsp;

00:00:44.000 --> 00:00:48.800
I will share that subtle thing with you and we'll&nbsp;
find out what Seth Bling thinks of the project.&nbsp;&nbsp;

00:00:48.800 --> 00:00:53.280
I think that's like one of the biggest bottlenecks&nbsp;
of I guess evolutionary training. You need a lot.&nbsp;&nbsp;

00:00:53.280 --> 00:00:58.080
Yeah. But I need to show you this other really&nbsp;
cool thing first. A couple weeks ago, I decided it&nbsp;&nbsp;

00:00:58.080 --> 00:01:03.040
was time to take a stab at this dream project that&nbsp;
I've wanted to make way before I ever even learned&nbsp;&nbsp;

00:01:03.040 --> 00:01:07.360
to code. And after some initial research, I&nbsp;
started to think that if I could just wrap my head&nbsp;&nbsp;

00:01:07.360 --> 00:01:13.120
around a handful of key principles and concepts, I&nbsp;
might actually be able to build my own AI model. A&nbsp;&nbsp;

00:01:13.120 --> 00:01:19.040
few hours later, I found myself reading this free&nbsp;
textbook on coding principles. And in chapter 9,&nbsp;&nbsp;

00:01:19.040 --> 00:01:24.480
I learned to build something super cool that&nbsp;
low-key blew my mind. Say you want to create a&nbsp;&nbsp;

00:01:24.480 --> 00:01:29.600
program that guesses a simple hidden phrase that's&nbsp;
18 characters long. I'm going to keep this secret&nbsp;&nbsp;

00:01:29.600 --> 00:01:33.840
from you for now as well. You could just create&nbsp;
an infinite loop that guesses at random until&nbsp;&nbsp;

00:01:33.840 --> 00:01:39.600
all 18 characters in the string are correct. But&nbsp;
there are 27 possible characters for every one&nbsp;&nbsp;

00:01:39.600 --> 00:01:46.320
of those 18 slots. That's 27 to the 18th power of&nbsp;
possible strings, which is a lot. Don't worry, I'm&nbsp;&nbsp;

00:01:46.320 --> 00:01:51.520
going to write some very inefficient programs in&nbsp;
this video, but not that inefficient. A somewhat&nbsp;&nbsp;

00:01:51.520 --> 00:01:56.480
more efficient and a very much more interesting&nbsp;
approach is to evolve towards the correct string&nbsp;&nbsp;

00:01:56.480 --> 00:02:01.840
over time by creating an environment that mimics&nbsp;
natural selection in the real world. In nature,&nbsp;&nbsp;

00:02:01.840 --> 00:02:06.000
the creature best fit for their environment are&nbsp;
the ones that survive long enough to reproduce.&nbsp;&nbsp;

00:02:06.000 --> 00:02:10.480
And when they do reproduce, their offspring&nbsp;
inherit a mix of their parents' genes. Repeat this&nbsp;&nbsp;

00:02:10.480 --> 00:02:15.920
cycle for a few million years and throw in a bit&nbsp;
of mutation to spice things up and you get things&nbsp;&nbsp;

00:02:15.920 --> 00:02:22.400
like camouflage, echolocation, and whatever the&nbsp;
hell this thing is. All of these incredible traits&nbsp;&nbsp;

00:02:22.400 --> 00:02:28.080
in nature just emerged from these three simple&nbsp;
rules. The fittest survive, genes get passed down,&nbsp;&nbsp;

00:02:28.080 --> 00:02:32.480
and there's a small chance for mutation. That&nbsp;
keeps things a little spicy. What does this have&nbsp;&nbsp;

00:02:32.480 --> 00:02:37.680
to do with guessing a string? Well, to start,&nbsp;
we create a population of completely random&nbsp;&nbsp;

00:02:37.680 --> 00:02:43.200
strings of length 18. Every string or element&nbsp;
in the population gets measured based on the&nbsp;&nbsp;

00:02:43.200 --> 00:02:48.320
percentage of characters that are correct. Out&nbsp;
of all of these randomly generated strings, maybe&nbsp;&nbsp;

00:02:48.320 --> 00:02:55.280
one randomly landed an E in the right spot. That&nbsp;
5.6% correct string gets rewarded with a higher&nbsp;&nbsp;

00:02:55.280 --> 00:03:00.320
chance to breed from my fitness function. And yes,&nbsp;
strings can breed in this program at least. Two&nbsp;&nbsp;

00:03:00.320 --> 00:03:05.040
parent strings make a child string. And the child&nbsp;
string takes a random chunk of its characters&nbsp;&nbsp;

00:03:05.040 --> 00:03:10.160
from parent A and the rest from parent B. So,&nbsp;
let's make a breeding pool from our winners,&nbsp;&nbsp;

00:03:10.160 --> 00:03:15.520
generate a new population, and sprinkle in a small&nbsp;
chance for random mutation. This is actually all&nbsp;&nbsp;

00:03:15.520 --> 00:03:21.040
we need to create the circle of life. The cool&nbsp;
thing is that any modern computer CPU can do this&nbsp;&nbsp;

00:03:21.040 --> 00:03:26.080
almost instantly. And if we repeat the process&nbsp;
for hundreds and hundreds of generations, we'll&nbsp;&nbsp;

00:03:26.080 --> 00:03:32.160
slowly start to watch our message emerge from the&nbsp;
randomness. Look at that. What a nice message. A&nbsp;&nbsp;

00:03:32.160 --> 00:03:36.240
ton of work went into this video. It would mean a&nbsp;
lot to me if you would consider subscribing. The&nbsp;&nbsp;

00:03:36.240 --> 00:03:41.200
textbook then went on to apply the same mechanic&nbsp;
to a population of rockets trying to reach a&nbsp;&nbsp;

00:03:41.200 --> 00:03:46.480
target. After a little bit of honest coding time,&nbsp;
boom, the rockets evolve over time to get closer&nbsp;&nbsp;

00:03:46.480 --> 00:03:50.880
and closer to the target. The best part, you can&nbsp;
watch the rockets slowly accumulate knowledge&nbsp;&nbsp;

00:03:50.880 --> 00:03:55.520
over dozens and dozens of generations, inching&nbsp;
closer and closer to the only goal that they've&nbsp;&nbsp;

00:03:55.520 --> 00:03:59.760
ever had to work towards. And then, right when&nbsp;
they're about to ascend and achieve everything&nbsp;&nbsp;

00:03:59.760 --> 00:04:05.840
they've ever wanted, you just move the target&nbsp;
and watch their entire species lose everything.&nbsp;&nbsp;

00:04:05.840 --> 00:04:10.640
Keep this evolution system in mind. By the way,&nbsp;
I eventually found myself using it at a much&nbsp;&nbsp;

00:04:10.640 --> 00:04:15.360
more complex scale. But anyways, I was stoked&nbsp;
that in just a few hours, I went from knowing&nbsp;&nbsp;

00:04:15.360 --> 00:04:20.800
pretty much nothing about machine learning&nbsp;
to making this. If things stayed this simple,&nbsp;&nbsp;

00:04:20.800 --> 00:04:27.520
I would have this whole project done in no time.&nbsp;
I actually already had a pretty good idea that&nbsp;&nbsp;

00:04:27.520 --> 00:04:32.160
the next thing I needed to learn about was neural&nbsp;
networks. And that's because I've had a particular&nbsp;&nbsp;

00:04:32.160 --> 00:04:37.200
project in mind ever since I was 15 years old.&nbsp;
when one of my favorite Minecraft YouTubers took&nbsp;&nbsp;

00:04:37.200 --> 00:04:43.040
a lefthand turn in his content and uploaded this&nbsp;
video. It was about a program he made that could&nbsp;&nbsp;

00:04:43.040 --> 00:04:48.240
actually play through an entire difficult level&nbsp;
of Super Mario World all on its own. And not just&nbsp;&nbsp;

00:04:48.240 --> 00:04:54.800
play it, it was spin jumping, taking super tight&nbsp;
jumps, and beating the level fast. This blew my&nbsp;&nbsp;

00:04:54.800 --> 00:04:59.520
15-year-old mind, and ever since I saw it, I've&nbsp;
wanted to try to implement it for myself. So,&nbsp;&nbsp;

00:04:59.520 --> 00:05:02.960
that's the project. The goal was to make a&nbsp;
neural network and train it to beat a level&nbsp;&nbsp;

00:05:02.960 --> 00:05:08.400
in Super Mario. And the best part, the creator&nbsp;
of the original project himself, Seth Bling,&nbsp;&nbsp;

00:05:08.400 --> 00:05:12.960
agreed to check out my project and gave me some&nbsp;
honest feedback. But I only have 3 weeks until&nbsp;&nbsp;

00:05:12.960 --> 00:05:17.600
our call, so I have to hurry up and get this thing&nbsp;
working if I want to impress him. So naturally,&nbsp;&nbsp;

00:05:17.600 --> 00:05:22.080
I dove into learning the actual mechanics of&nbsp;
a neural network. As a beginner programmer,&nbsp;&nbsp;

00:05:22.080 --> 00:05:27.200
I'm still very careful about how and if I use AI.&nbsp;
I still code almost everything by hand because&nbsp;&nbsp;

00:05:27.200 --> 00:05:32.320
I'm just learning, you know. But code reviews&nbsp;
matter more than ever before because of AI.&nbsp;&nbsp;

00:05:32.320 --> 00:05:37.440
There's more lines of code being shipped than&nbsp;
ever before and less lines being actually read,&nbsp;&nbsp;

00:05:37.440 --> 00:05:41.920
which is why this portion of the video is being&nbsp;
sponsored by CodeRabbit. CodeRabbit is not an&nbsp;&nbsp;

00:05:41.920 --> 00:05:47.200
AI that writes code. It's a code review agent.&nbsp;
You open a poll request, it reads the context of&nbsp;&nbsp;

00:05:47.200 --> 00:05:51.920
your codebase, and it identifies problems, and&nbsp;
for a lot of issues, it offers you a one-click&nbsp;&nbsp;

00:05:51.920 --> 00:05:56.960
fix. CodeRabbit's new change stack actually&nbsp;
breaks down PRs into groups of related changes,&nbsp;&nbsp;

00:05:56.960 --> 00:06:01.280
puts the most important stuff first, and gives you&nbsp;
all sorts of helpful summaries and diagrams. It&nbsp;&nbsp;

00:06:01.280 --> 00:06:05.680
even learns and adapts to your coding style over&nbsp;
time. So, check this out. I opened a poll request&nbsp;&nbsp;

00:06:05.680 --> 00:06:10.080
on the repo for the project in this video, and it&nbsp;
found all sorts of issues. I definitely have all&nbsp;&nbsp;

00:06:10.080 --> 00:06:13.840
sorts of blind spots, and I would not have found&nbsp;
these myself. This is pretty sick. CodeRabbit is&nbsp;&nbsp;

00:06:13.840 --> 00:06:19.360
installed on over 3 million repos. It's used by&nbsp;
over 100,000 open source projects, including Bun,&nbsp;&nbsp;

00:06:19.360 --> 00:06:25.040
and it's doing 2 million PR requests every single&nbsp;
week. So, if you want to catch and fix issues in&nbsp;&nbsp;

00:06:25.040 --> 00:06:32.160
your codebase faster, check out CodeRabbit at&nbsp;
codrabbit.link/commonluke. Now, let's get back&nbsp;&nbsp;

00:06:32.160 --> 00:06:37.760
to the video. Your brain is a network of roughly&nbsp;
a whole lot of neurons. Each one is a little cell&nbsp;&nbsp;

00:06:37.760 --> 00:06:42.080
that listens to signals from its neighbors.&nbsp;
And if it gets excited enough, it fires off a&nbsp;&nbsp;

00:06:42.080 --> 00:06:47.120
signal of its own. A single neuron doesn't know&nbsp;
anything. But a whole brain's worth of neurons&nbsp;&nbsp;

00:06:47.120 --> 00:06:53.120
working together knows how to walk, talk, and even&nbsp;
leave mean YouTube comments. A neural network in&nbsp;&nbsp;

00:06:53.120 --> 00:06:58.800
machine learning borrows this idea. It's made up&nbsp;
of tons of fake neurons that are linked together.&nbsp;&nbsp;

00:06:58.800 --> 00:07:04.080
Except all of our programs neurons are going to be&nbsp;
doing math and actually some pretty simple math at&nbsp;&nbsp;

00:07:04.080 --> 00:07:09.040
that. But at scale, neural networks are capable of&nbsp;
learning incredible things. Time to code one from&nbsp;&nbsp;

00:07:09.040 --> 00:07:13.760
scratch. The textbook I was reading started me off&nbsp;
by coding a single neuron. It takes some inputs&nbsp;&nbsp;

00:07:13.760 --> 00:07:18.480
and each input gets multiplied by a weight. Add&nbsp;
up all the products and something called a bias&nbsp;&nbsp;

00:07:18.480 --> 00:07:22.720
and then run it through an activation function&nbsp;
of your choice and boom. That's literally all the&nbsp;&nbsp;

00:07:22.720 --> 00:07:28.000
math you need to get a neuron to learn a simple&nbsp;
pattern. This neuron looks at a random point on a&nbsp;&nbsp;

00:07:28.000 --> 00:07:32.960
graph and guesses whether it sits above or below&nbsp;
an unknown line. Every time it guesses wrong,&nbsp;&nbsp;

00:07:32.960 --> 00:07:37.360
the weight gets nudged in the direction that&nbsp;
would have made it less wrong. And a couple&nbsp;&nbsp;

00:07:37.360 --> 00:07:42.480
thousand guesses later, we're left with a trained&nbsp;
neuron that knows exactly where the line is, even&nbsp;&nbsp;

00:07:42.480 --> 00:07:47.200
though it's never seen it. By the way, all those&nbsp;
exercises were from The Nature of Code by Daniel&nbsp;&nbsp;

00:07:47.200 --> 00:07:51.440
Schiffman. It's a free textbook, and I recommend&nbsp;
that you check it out. Now, let's find something&nbsp;&nbsp;

00:07:51.440 --> 00:07:55.680
that'll teach me how to make a neural network from&nbsp;
scratch. How about this video series by my boy&nbsp;&nbsp;

00:07:55.680 --> 00:08:01.200
Sentex? Instead of focusing on single neurons,&nbsp;
this series jumped straight into coding entire&nbsp;&nbsp;

00:08:01.200 --> 00:08:06.160
layers of neurons. I've been using some pretty&nbsp;
simple terms like multiplication and addition.&nbsp;&nbsp;

00:08:06.160 --> 00:08:10.960
But what we're actually dealing with here is&nbsp;
linear algebra. Because when every neuron in one&nbsp;&nbsp;

00:08:10.960 --> 00:08:15.920
layer connects to every neuron in the next,&nbsp;
you can store all the weights in one big grid&nbsp;&nbsp;

00:08:15.920 --> 00:08:20.880
of numbers, a matrix, and compute an entire&nbsp;
layer in a single matrix multiplication. So,&nbsp;&nbsp;

00:08:20.880 --> 00:08:24.640
up until this point, I've learned how to make a&nbsp;
population that evolves towards a goal and how&nbsp;&nbsp;

00:08:24.640 --> 00:08:29.120
to write a neural network by hand. But there's&nbsp;
one more important ingredient before the magic&nbsp;&nbsp;

00:08:29.120 --> 00:08:33.920
really starts to happen. I need to find a way to&nbsp;
write some code that can control a Mario game,&nbsp;&nbsp;

00:08:33.920 --> 00:08:39.760
which is much easier said than done. I found&nbsp;
this Python library called Gym Super Mario Bros.,&nbsp;&nbsp;

00:08:39.760 --> 00:08:45.040
which spins up a real NES emulator and lets my&nbsp;
code create inputs for the game. I started by just&nbsp;&nbsp;

00:08:45.040 --> 00:08:50.000
testing a different random input for every frame&nbsp;
to make sure that it was working. Then I created&nbsp;&nbsp;

00:08:50.000 --> 00:08:54.720
10 games and ran them in tandem and gave them all&nbsp;
their own series of random inputs. Figuring out&nbsp;&nbsp;

00:08:54.720 --> 00:08:59.120
how to render multiple games dynamically was&nbsp;
so much harder than I thought it was going to&nbsp;&nbsp;

00:08:59.120 --> 00:09:03.520
be. But now I just need to give them all their own&nbsp;
neural network. The great thing about this package&nbsp;&nbsp;

00:09:03.520 --> 00:09:08.160
is that all the hard RAM scraping work is already&nbsp;
done for me. I won't need to go digging through&nbsp;&nbsp;

00:09:08.160 --> 00:09:13.440
thousands of rows of NES memory maps because I can&nbsp;
just pull everything from this built-in game info.&nbsp;&nbsp;

00:09:13.440 --> 00:09:18.240
Oh [&nbsp;__&nbsp;] Okay, so what I'm looking for actually&nbsp;
isn't in here. There's plenty of info about Mario,&nbsp;&nbsp;

00:09:18.240 --> 00:09:23.200
his position, his coin counts, but there's really&nbsp;
not that much about the world around him. This&nbsp;&nbsp;

00:09:23.200 --> 00:09:27.680
wouldn't be a problem if I was trying to create&nbsp;
a program that memorizes how to complete a Mario&nbsp;&nbsp;

00:09:27.680 --> 00:09:31.440
level by guessing randomly. But if we were&nbsp;
going that route, we wouldn't need to make a&nbsp;&nbsp;

00:09:31.440 --> 00:09:35.920
neural network at all. We could just crossbreed a&nbsp;
series of random inputs until we beat the level,&nbsp;&nbsp;

00:09:35.920 --> 00:09:41.120
like our rocket exercise from the textbook. But&nbsp;
I'm not trying to make Mario memorize the level.&nbsp;&nbsp;

00:09:41.120 --> 00:09:46.400
I want him to learn to play the game, to&nbsp;
actually understand obstacles and enemies.&nbsp;&nbsp;

00:09:46.400 --> 00:09:51.600
This will hopefully allow him to complete multiple&nbsp;
levels with one well-trained neural network. And&nbsp;&nbsp;

00:09:51.600 --> 00:09:55.360
that means that my boy needs to see. So, it turns&nbsp;
out we're going to have to dig through the RAM&nbsp;&nbsp;

00:09:55.360 --> 00:10:00.160
maps after all and build out a whole system that&nbsp;
translates what's loaded into the game's active&nbsp;&nbsp;

00:10:00.160 --> 00:10:06.000
memory into an easy to interpret grid for my Mario&nbsp;
bot. I was able to find a somewhat similar project&nbsp;&nbsp;

00:10:06.000 --> 00:10:11.120
on GitHub that found a way to translate RAM states&nbsp;
into a clean grid of numbers that represent tiles,&nbsp;&nbsp;

00:10:11.120 --> 00:10:16.400
enemies, and our boy Mario. So, between that&nbsp;
repo, public RAM maps, and a lot of trial and&nbsp;&nbsp;

00:10:16.400 --> 00:10:22.080
error, I slowly piece together a way to translate&nbsp;
the active RAM states into something digestible.&nbsp;&nbsp;

00:10:22.080 --> 00:10:26.880
And here it is. It's a big grid of numbers.&nbsp;
Wherever there's a one means that there's a&nbsp;&nbsp;

00:10:26.880 --> 00:10:32.400
solid ground or pipe or a block, and a negative&nbsp;
one means that there's an enemy. and the two is&nbsp;&nbsp;

00:10:32.400 --> 00:10:37.120
Mario himself. Setting this up was actually&nbsp;
one of the most tedious parts of the entire&nbsp;&nbsp;

00:10:37.120 --> 00:10:41.280
project. But struggling through this gave me a&nbsp;
new appreciation for the amount of work that all&nbsp;&nbsp;

00:10:41.280 --> 00:10:44.720
the creators of all these neural network&nbsp;
projects have had to go through to get it&nbsp;&nbsp;

00:10:44.720 --> 00:10:49.360
done. I wonder if Seth will be able to relate&nbsp;
to the struggle when he reviews my project,&nbsp;&nbsp;

00:10:49.360 --> 00:10:53.200
but that'll have to wait. The good news is that&nbsp;
now we can feed the environment surrounding&nbsp;&nbsp;

00:10:53.200 --> 00:10:59.040
Mario into our neural network cleanly. Since&nbsp;
this grid that we made has 208 total numbers,&nbsp;&nbsp;

00:10:59.040 --> 00:11:04.160
I made the first layer of our neural network have&nbsp;
208 inputs. And we already know that the final&nbsp;&nbsp;

00:11:04.160 --> 00:11:08.720
layer of our network needs to have 12 possible&nbsp;
outputs since that's the amount of inputs that&nbsp;&nbsp;

00:11:08.720 --> 00:11:13.920
the gym Super Mario Bros. library recognizes.&nbsp;
Finally, I added in something called a hidden&nbsp;&nbsp;

00:11:13.920 --> 00:11:17.760
layer, which basically just means that it sits&nbsp;
somewhere between the input and the output&nbsp;&nbsp;

00:11:17.760 --> 00:11:22.480
layers. I decided to start it at 18 neurons. I had&nbsp;
no idea if this was an appropriate number, but I&nbsp;&nbsp;

00:11:22.480 --> 00:11:27.760
just rolled with it. I would end up tweaking this&nbsp;
a lot later on. In the simplest possible terms,&nbsp;&nbsp;

00:11:27.760 --> 00:11:32.640
this neural network takes the state of the game&nbsp;
as an input, runs it through dozens of neurons,&nbsp;&nbsp;

00:11:32.640 --> 00:11:38.560
and out the other side comes 12 numbers, one score&nbsp;
for each possible move. Whichever move scores&nbsp;&nbsp;

00:11:38.560 --> 00:11:43.040
the highest is the button that Mario presses&nbsp;
that frame. Finally, we just make our whole&nbsp;&nbsp;

00:11:43.040 --> 00:11:48.400
neural network a class, create a new one with&nbsp;
random weights for each of the 10 Mario games,&nbsp;&nbsp;

00:11:48.400 --> 00:11:53.200
plug them in, and bang. One of the coolest moments&nbsp;
of this project for me was when I initially got&nbsp;&nbsp;

00:11:53.200 --> 00:11:58.320
the neural networks linked up to the separate&nbsp;
games. Because even without any training, I saw my&nbsp;&nbsp;

00:11:58.320 --> 00:12:04.720
10 Mario emulators go from spamming random inputs&nbsp;
to spamming random behaviors. Some would run back&nbsp;&nbsp;

00:12:04.720 --> 00:12:09.760
and forth infinitely. Some would jump forever.&nbsp;
Some would hold right, but most of them just did&nbsp;&nbsp;

00:12:09.760 --> 00:12:15.360
nothing. This was my first time doing any of this,&nbsp;
and I just thought that it was so cool. Okay,&nbsp;&nbsp;

00:12:15.360 --> 00:12:19.840
now that we have game rendering and neural network&nbsp;
design figured out, I just need to build a fitness&nbsp;&nbsp;

00:12:19.840 --> 00:12:25.360
function and a breeding function. I settled on&nbsp;
three things. How far each Mario gets, a big bonus&nbsp;&nbsp;

00:12:25.360 --> 00:12:30.320
for beating the level, and extra points if they do&nbsp;
it fast. If a particular neural network does well,&nbsp;&nbsp;

00:12:30.320 --> 00:12:35.120
it'll have more chances to breed in a breeding&nbsp;
pool, and if it does breed, its weights will be&nbsp;&nbsp;

00:12:35.120 --> 00:12:40.080
mixed with another neural network's weights to&nbsp;
spawn a child neural network. It's just like our&nbsp;&nbsp;

00:12:40.080 --> 00:12:44.480
string evolution, but for a much more complex&nbsp;
system. So, I spawned a population of these&nbsp;&nbsp;

00:12:44.480 --> 00:12:50.080
networks, every single weight completely random,&nbsp;
and let them loose for a 24-hour training run. And&nbsp;&nbsp;

00:12:50.080 --> 00:12:54.880
when I came back to check on them the next day,&nbsp;
they hadn't learned anything. Yeah, it actually&nbsp;&nbsp;

00:12:54.880 --> 00:12:59.360
took me a ton of attempts to get this right. I had&nbsp;
to tweak the fitness function many, many times,&nbsp;&nbsp;

00:12:59.360 --> 00:13:04.400
change what conditions the individual emulators&nbsp;
run under, add more neurons to the hidden layers&nbsp;&nbsp;

00:13:04.400 --> 00:13:10.640
of networks, and a whole bunch of other stuff. I&nbsp;
spun my wheels trying to get a successful training&nbsp;&nbsp;

00:13:10.640 --> 00:13:18.240
run for like a whole week until I finally got&nbsp;
this beautiful result. Oh, did you hear that? Our&nbsp;&nbsp;

00:13:18.240 --> 00:13:23.040
training run is finished, but I'm out of time.&nbsp;
Seth Bling is literally calling me right now.&nbsp;&nbsp;

00:13:23.040 --> 00:13:26.320
Seth, thank you for being here. Is it okay if I&nbsp;
call you Seth or should I call you Seth? Yeah. No,&nbsp;&nbsp;

00:13:26.320 --> 00:13:30.800
Seth is great. All right, cool. I already&nbsp;
recognize this is Super Mario Brothers 1-1,&nbsp;&nbsp;

00:13:30.800 --> 00:13:35.920
right? He was super super nice and genuinely&nbsp;
seemed interested and just as excited about my&nbsp;&nbsp;

00:13:35.920 --> 00:13:40.560
project as I was. This was painfully slow on my&nbsp;
computer. Unfortunately, I didn't like kill the&nbsp;&nbsp;

00:13:40.560 --> 00:13:44.640
emulators if they died or anything. It all just&nbsp;
ran the whole time. I think that's like one of&nbsp;&nbsp;

00:13:44.640 --> 00:13:49.520
the biggest bottlenecks of I guess evolutionary&nbsp;
training. You need a lot of processing. Like in&nbsp;&nbsp;

00:13:49.520 --> 00:13:54.800
real life, you have massively parallel systems&nbsp;
in terms of we have a billion humans. Like those&nbsp;&nbsp;

00:13:54.800 --> 00:13:59.440
are all being I mean not simulated, they're you&nbsp;
know living life, but every organism has you know&nbsp;&nbsp;

00:13:59.440 --> 00:14:04.240
millions or billions instances running at the same&nbsp;
time. But once I was done walking them through it,&nbsp;&nbsp;

00:14:04.240 --> 00:14:10.160
it was time time for the Mario Gauntlet. I did all&nbsp;
this work with one goal in mind for my Mario AI,&nbsp;&nbsp;

00:14:10.160 --> 00:14:15.360
to have it learn to play Mario. And the best&nbsp;
way to test that is to pit it against a series&nbsp;&nbsp;

00:14:15.360 --> 00:14:19.360
of various levels from different parts of the&nbsp;
game to see if it could complete them. Okay,&nbsp;&nbsp;

00:14:19.360 --> 00:14:23.760
let's let it rip. Some incredibly tight movement&nbsp;
from Mario here. Barely missing the spikies at&nbsp;&nbsp;

00:14:23.760 --> 00:14:27.840
the start. Is this a deterministic simulation?&nbsp;
I would think it probably is. At this point,&nbsp;&nbsp;

00:14:27.840 --> 00:14:31.520
the neural network weights aren't changing at&nbsp;
all. So, we could have run this 10 times in a&nbsp;&nbsp;

00:14:31.520 --> 00:14:35.200
row and yeah, it's going to have the exact same&nbsp;
result. Okay, there we go. All right. Okay, now&nbsp;&nbsp;

00:14:35.200 --> 00:14:40.720
we're all in one. Done. And here's where territory&nbsp;
for it. Look at that. This is quick, too. Yeah,&nbsp;&nbsp;

00:14:40.720 --> 00:14:45.120
this is good. It's like avoiding a lot of blocks.&nbsp;
I wonder how much of that's intentional. Uh-oh.&nbsp;&nbsp;

00:14:45.120 --> 00:14:49.920
Yeah. Yeah. I don't think that structure appears&nbsp;
anywhere on 41. All right, here's 82. Look at this&nbsp;&nbsp;

00:14:49.920 --> 00:14:54.720
crazy staircase. Okay, it waits for the enemy&nbsp;
there. That's actually could be. It looks like&nbsp;&nbsp;

00:14:54.720 --> 00:14:59.920
he waits. He's never seen a spring. Oh, that is&nbsp;
a hard section to get past actually. Like even&nbsp;&nbsp;

00:14:59.920 --> 00:15:04.480
just playing casually. I think just running under&nbsp;
the enemy. I think it's all luck at that point. I&nbsp;&nbsp;

00:15:04.480 --> 00:15:08.320
think it's all luck. That is impressive. We'll&nbsp;
just call it impressive. Okay. Thank you. Thank&nbsp;&nbsp;

00:15:08.320 --> 00:15:13.680
you. But Seth, you are the godfather of Mario&nbsp;
AIs. Obviously, we have not dove into the code&nbsp;&nbsp;

00:15:13.680 --> 00:15:17.600
in this. We've only been looking at the highlight&nbsp;
reel of this entire project. And just based on&nbsp;&nbsp;

00:15:17.600 --> 00:15:22.960
the vibes here alone, I'm wondering if you'd be&nbsp;
willing to rate my project out of 10. I mean,&nbsp;&nbsp;

00:15:22.960 --> 00:15:26.800
honestly, like it sounds like it was a 10 out&nbsp;
of 10 project. I'm not saying that because I&nbsp;&nbsp;

00:15:26.800 --> 00:15:30.240
think this is like the greatest neural network&nbsp;
I've ever seen. Obviously, these days we have,&nbsp;&nbsp;

00:15:30.240 --> 00:15:35.440
you know, insane neural networks that do crazy&nbsp;
things. I'm saying that because I think that you&nbsp;&nbsp;

00:15:35.440 --> 00:15:41.040
got to experience like the entire gamut of what&nbsp;
it takes to make something like this. You you&nbsp;&nbsp;

00:15:41.040 --> 00:15:45.360
got to like learn about neural networks, learn&nbsp;
about activations and architectures. You told&nbsp;&nbsp;

00:15:45.360 --> 00:15:50.000
me about your architectural choices and like&nbsp;
you're aware of other architect architectural&nbsp;&nbsp;

00:15:50.000 --> 00:15:53.920
choices. You learned like all the ways that they&nbsp;
can fall down. you had to learn how to like dig&nbsp;&nbsp;

00:15:53.920 --> 00:15:58.640
into basically reverse engineer a game which this&nbsp;
is something that like I've spent a ton of time&nbsp;&nbsp;

00:15:58.640 --> 00:16:03.360
doing and all of the all the problems that you&nbsp;
had. I also had probably also when working on&nbsp;&nbsp;

00:16:03.360 --> 00:16:09.680
Mario. Um so like the amount of like experience&nbsp;
you gained doing all this is it's just like really&nbsp;&nbsp;

00:16:09.680 --> 00:16:15.680
valuable and it's stuff that you can apply to&nbsp;
a lot of other very different context. So yeah,&nbsp;&nbsp;

00:16:15.680 --> 00:16:20.080
10 out of 10. Could not have put it any better&nbsp;
myself. Yeah, the craziest part of the project&nbsp;&nbsp;

00:16:20.080 --> 00:16:24.240
was just how much freaking fun it was. Huge&nbsp;
thank you to Seth again for participating in&nbsp;&nbsp;

00:16:24.240 --> 00:16:31.920
this video and thank you so much for watching.&nbsp;
See you. Oh, the the pillow has nothing to do&nbsp;&nbsp;

00:16:31.920 --> 00:16:37.680
with this. It just helps with the audio. It&nbsp;
reduces the the echo in here. See you later.

