Andrej Karpathy on Software 2.0: Scaling Autonomy at Tesla

Conference keynote, 2019 · October 2019
Video thumbnail: Andrej Karpathy on Software 2.0: Scaling Autonomy at Tesla
33 mintalk586 views across 1 upload6,797-word transcriptWatch on YouTube ↗

What Karpathy talks about

Andrej Karpathy gave this conference keynote in October 2019 on scaling machine learning for Tesla’s autonomous driving program, focusing on Software 2.0, data, labeling, and rare edge cases.

Also known as: Software 2.0: Scaling Autonomy at Tesla.

Andrej Karpathy argues that modern machine learning is moving from hand-coded “Software 1.0” toward “Software 2.0,” where neural networks and optimization discover the program from data rather than explicit code. He uses examples from vision, AlphaZero, and Tesla Autopilot to show why scaling compute and data changes what is possible.

He then applies that framework to autonomous driving at Tesla, where the hardest problems are often not model architecture but dataset creation, labeling policy, class imbalance, and rare edge cases. His message is that making autonomy work depends on building the infrastructure to find, label, and retrain on the long tail of driving scenarios.

Karpathy gives the talk, with audience Q&A at the end.

In his words

“Software 1.0 is things like C++.”
at 5:12
“The code is now written in the weights of a neural network.”
at 5:12
“Let's forget about all that stuff that humans have designed with all their ingenuity, and let's try to just have a single kind of blob of compute”
at 3:43
“There's really nothing that helps you write the 2.0 code”
at 22:46

Key points

  • Software 1.0 is hand-written code; Software 2.0 is learned code embedded in neural network weights.
  • As compute and data grow, the best results come from handing more of the design problem to optimization.
  • Pattern-recognition problems like vision and chess have increasingly shifted toward learned systems.
  • Tesla’s autonomy stack combines neural networks with legacy pre- and post-processing, but the trend is toward more of the stack becoming Software 2.0.
  • The biggest practical challenge is data: sourcing, labeling, cleaning, balancing, and mining rare edge cases.
  • Autonomy requires careful handling of ambiguous labels, rare classes, and unusual events like ladders, birds, and odd traffic signs.
  • The right tooling for Software 2.0 is not an IDE for code, but infrastructure for building better training datasets.

Full transcript: Andrej Karpathy, Scaled Machine Learning for Autonomous Driving at Tesla (2019)

Yes, so I thank you for the introduction, Reza. So I'm going to talk a little bit about programming the 2.0 stack, and as some of you who have read my blog post on Software 2.0 might know what this might refer to. And some of you who haven't, I might not, but it will become clear very, very soon. Okay, so I actually want to start by telling a story. The story starts 1 million years ago, and this is us a million years ago, and we're kind of mostly preoccupied with gathering, hunting, and smashing rocks and making sounds at each other and things like that. That's what your daily life is about, and then a bit later, we kind of like develop fire, and I promise this will make sense, by the way, in just a bit. Mm-hmm. So we develop the fire, and then

we developed agriculture, and then we started building pretty amazing mechanical machines. So here's a mechanical machine. This is an early steam engine, and then we started to miniaturize things, so we started to actually develop computers, first mechanical, and these are mechanical computers, and then electrical. And so things were going along quite nicely, and here we are about 50,000 generations later, and we're actually writing code and doing pretty amazing things. So we're kind of on a roll here, but under the hood, it's actually like kind of a similar, still kind of like monkey brain from 1 million years ago. Only 50,000 generations, it's kind of incredible how far we've come. Like we've actually built some pretty amazing things, so really good job everyone. So we're just

ingenious, right? We've broken down all the problems. We've figured them out. We've engineered the heck out of them, and things are actually working really well. And so we were really on a roll until we met our match. At one point, humanity has decided that it's useful to try to recognize things inside images, and for example, I've detected cats. And the tried and true approach of designing and engineering and breaking down problems and kind of taking this giant array of pixels after Geralt ended has become kind of intractable. So people have tried in the early, early days and tried to engineer our way around it. So this is a lot of like Lisp schemas. This is taken from Fruitloop, which is, by the way, an amazing project from the 1980s. Then we

try to kind of, okay, we're going to break down the problem. We're going to figure out, okay, well, first we have to detect these small pieces. Then we have to write code for detecting maybe small ear pieces or eye pieces. Then we're going to stitch them together. We're going to come up with all kinds of elaborate schemes for how we're going to decompose the problem of visual recognition, and we're going to write a kind of code for every one of those pieces independently, and then we're going to plug them together, and we're going to recognize everything in the world and just fully invert graphics and things like that. And this kind of like didn't work very well for a while, and it was really difficult to get this to work on just arbitrary images. So then a bit later, we started to realize that if you just put a tiny bit of machine learning instead of kind of like writing all these programs from scratch—something that worked for us in the past—instead, we're going to write all these feature extractors, and we're going to develop them, and then we're going to

have just a tiny bit of machine learning on top there. So we're going to have a small linear classifier, and that started to work a little bit better. And so we designed some of those features, and then we handed off a little bit of that to the optimization. And so then we went kind of wild to try to design all kinds of features. So this is from a paper in 2011, computer vision paper kind of describing a number of features that you would extract from an image, so things like hogs, and I don't know, I don't know actually half of these now, but basically there are three pages in the paper just devoted to the feature design. And that worked okay for a while, and then we figured out that actually if you take humans and human design and human ingenuity out of the system, and you just devote—you just do more computation, and you hand off more to the optimization,

things almost always work a bit better. So let's forget about all that stuff that humans have designed with all their ingenuity, and let's try to just have a single kind of blob of compute, like a comet architecture, and let's try to hand off more of the design to the optimization so the optimization finds the feature extractors, not just the final layer on the top, but actually all the feature extractors in between. And this trend has not stopped, right? So when you look at some of the most recent architectures and some of the things that are working best now on image recognition, we haven't stopped at, you know, we've been hand-coding architectures because we're trying to be clever again. There's this, you know, and actually if you step away again, things can work better. So now we're actually thinking about, okay, this architecture should not be designed by humans. We're not very good at designing things. Let's kind of step back again, and we have

bigger computers, bigger data sets, and let's hand off even more to the optimization. So now we're also optimizing over the architectures. And so really the trend has been, it's kind of like, I would say that image recognition and more generally any kind of problem that is, you know, complex kind of pattern recognition, we try to, you know, design our way into it. And what we're finding is that with more compute and with more data, the trend is towards, you know, less designing and more computing. So in the beginning, we can afford to hard-code images, to hard code some solutions for small problems, but that's not going to get you to Google, Facebook, Tesla scale. And then we're actually untying the optimization, giving more into the optimization, and things are

Working a bit better. So, as part of this trend, this is what I can describe: the software 1.0 versus software 2.0. Software 1.0 is things like C++. A domain expert sits down and writes down the algorithm for, say, recognizing cats or something like that. You decompose the problem, design algorithms one by one, you compose them into a system, and you could measure the performance, and you do your best trying to engineer the system. And software 2.0 is kind of this—this is basically neural networks. You're not writing code in C++. The code is now written in the weights of a neural network, but we're not writing that code. We are—the optimization is writing the code. We are massaging the data sets for the most part and coming up with the infrastructure for optimization, but for the most part, we can measure some

objective like classification error. And then we're paying a large price in compute to try to find—try to find programs really that are doing a very good job according to the performance metric. So this is not only working very well in image recognition, it's also working well across many other disciplines. One of my favorites, of course, is AlphaZero or AlphaGo. Again, say we're playing chess. Again, human ingenuity—we always have, we always have this urge to try to design a solution. And Stockfish, for example, is a pretty, pretty amazing program for salt—for basically, it's an AI for chess that's been written over time, and it's a giant code base, and it incorporates a huge amount of heuristics from domain experts in chess, and then

we've seen if you just put a giant convolutional neural network on it and run it for a very, very long time, because you have an objective that you can measure, you can just pay in compute to search the program space for solutions that actually play chess extremely well. And so it's actually kind of humbling to look at some of these results from AlphaZero. It's just, you know, you're looking at the performance of this neural network and this con that—over time. And, you know, we've been playing this game for, you know, thousands of years—I'm not sure exactly how long. Okay, so Go for a pretty long time. And we've been writing these algorithms for years, and then, you know, AlphaZero basically—you have to write the infrastructure for maybe a year or two or three, and a number of people have to work at that, but once you're at that spot, you can actually learn to play chess in just a matter of days on these computers. And these

computers are not only getting faster. So, we see this not just in chess but we're also seeing it across many other kinds of disciplines. When you look at state-of-the-art results in many kinds of disciplines that look like pattern recognition, you'll see that most of the state-of-the-art papers is just comment and return on that architectures all over the place. It's really taking over this transition from 1.0 to 2.0. I have to add an asterisk to this, by the way. The asterisk is that one of the most impressive robots, which I think is probably Boston Dynamics right now—they have super amazing robots. And they recently came to give a talk at NeurIPS, and the person from Boston Dynamics was making fun of all the machine learning people because they're like, "This is all fully software 1.0. There's no—forget deep learning, there's no machine

learning in the system." So this is really the—it's pretty amazing that this works at all. It's actually almost like an asterisk to my thesis here. What I'm trying to—I'm trying to get a point across here, so I would, of course, try to argue that this will is amazing, but it will top out, and that when we put the infrastructure in place to actually learn all of this, I think it is going to be overcome. There are a few benefits to tough software 2.0 SEC I wanted to point out briefly just that this transition actually has a lot of fruit. So, first of all, a lot of these neural network architectures that we're building out are extremely computationally homogeneous. So, this is not a sprawling C++ code base. This is just lots of calm and relative stacked up at inference time, which is pretty amazing because these are so

computationally ingenious. They're very easy to make silicon, and we're seeing some of the first ASICs coming out recently that really take advantage of this property because it's not too difficult to actually put this on hardware. Then, these stacks in this code have beautiful properties in that it has a constant running time and constant memory use. So think about your C++ code base—you know, you can run into infinite loops and things take more or less time at different points in time depending on the inputs. This thing always runs to the same amount of time and uses the same amount of resources, and it's completely kind of deterministic. So that's a really nice property to have, for example, in systems like, for example, the autopilot where we actually want to make guarantees about this and performance in

various ways. And another kind of nice property of the system is that it's extremely agile. So, if I come to you and I say I'd like the exact same functionality, but you have to run at exactly half the time because I have some kind of a resource constraint, so I want exactly half the running time—in case of C++ code base, if the autopilot is written in C++, this would be an extremely difficult effort. You have to bring up your profiler, and you try to, like, shave off, you know, pieces of code until you're at half time. If the whole thing is a giant combat, then I'm going to remove half of my channels, or I'm going to take out some layers, and I have something that works a bit worse but runs at exactly half the time faster. So that's kind of amazing that we can just do this, which is retrain for arbitrary, you know, demands from the system.

And finally, of course, say it works really well. So that's an easy one. So I want to talk a little bit about this transition going on from 1.0 to 2.0 that is, under this, is happening at Tesla as well since I joined. So Tesla has, is kind of a robotics company to some extent, and when it comes to autopilot, I mean the car itself is basically a robot. It receives inputs and it has to act in the world and act intelligently. In this case, we have two actuators: we have the steering and the acceleration. But a lot of things kind of stream into the stack, and at Tesla we actually have a larger deployment of robots in the world. We have about a quarter million robots out there in the world, which is kind of cool. And our task is to make them autonomous.

Now, what I kind of joined, of course, the stack as AI mission takes in a number of—but only two scalars come out: steering and acceleration. And when I kind of joined, there was, you know, of course, there was some kind of a commercial neural network doing a lot of the base visual recognition, but there was a lot of pre-processing, a lot of robotics C code, a lot of post-processing. So kind of a meld of 2.0 at one point, a stack in the system, and kind of, uh, you know, this has kind of been happening over time. And so the supernova stack has been kind of growing. I'm going to give some examples in a bit. And of course, it's so tempting for a deep learning person to come into this kind of a problem, just look at this and be like, oh man, two numbers are coming out, things are coming in, oh man, this is like expanding, it's just like so—

Tempting to just color the whole thing in green and you have infinite data because people are driving and they're showing you what the outputs should be. In any case, it's just so tempting, right? But for now, we're taking a kind of a measured approach just to give you a sense of what an example of how of this expansion and what that looks like. To make this slightly more concrete, suppose you want to recognize parked cars, which we actually want to do quite often. With a 1.0 approach, again, human ingenuity approach, you would try to, for example, design a parked car detector. So, of course, we have a detector for cars, and suppose we have these detection x's and we know that their cars come, that gives this to us. And then we say, okay, well a car is parked if, suppose we track it for a while, and a parked car will probably not move for a while because it's parked. So a car is parked if we're tracking it—

And doesn't seem to move, and maybe there's some kind of a particular pattern of arrangement of cars, and maybe it's on a side of a lane and, like, you know, something like that. So we can try to write some post-processing code to actually detect this, or you can be like, this is all kind of not right, and cars parked if they come, that's us, so. And just based on a lot of data, so humans can annotate a lot of this data quite easily, and then we can actually just fold this into the ComNet. And that's an example of taking one panel code, putting into 2.0 code. And of course, it's probably not too hard to believe that this would work better because the comm has so much more context than what we're seeing in this reduced representation, because the comm has all the raw pixels and it sees all of the context of all the lane line markings, and it sees that they're lined up here, it looks like a parking lot. I mean, there's so much more context in—

The pixels than any of this high-level representation. So this transition has really borne some fruit and it's going quite nicely. We actually shipped a product, we shipped an update to the autopilot just recently, like a week or two ago, and it's going really nicely. And people kind of left the update because it drives much better, and there's a lot of people who posted a lot of YouTube videos, and it's very rewarding to kind of see a lot of the feedback because people kind of love the update. So you can also try to look it up a bit later. Now I wanted to talk a little bit about programming the 2.0 stack and really being efficient at it. So in practice, when you want to get this stuff to work, I had to kind of like learn a lot of—

Things on spot because I'm coming from a PhD background. So what I'm kind of used to is, you know, you're given Imagenet dataset and you have to design a model and algorithm, and so you spend a lot of time kind of thinking about what's the better, what's a better model, what's a better algorithm, what's a better training regime, etc. If you actually try to get this to work in practice it looks very different. So here's my PhD dataset, is given to me, usually it's Imagenet or something like that, and I'm mostly worrying about the models. And when I came to Tesla, I mean, we still worry about the models, but oh man, is just like the things I lose sleep over, it's just like significantly more. The dataset, accumulating it, massaging it, cleaning it, sourcing it is just a complete disaster. Not even just massaging dizzy dust and—

Getting a good set of it, but even, okay, so some lessons to dive into this a little bit. First of all, as I found out the hard way, even the data labeling itself is like super non-trivial. So coming up with what you should be labeling in images. So for example, of course, we have a salt drawing car and we, of course, want to stay inside lane lines. So, well, okay, so it makes sense to actually recognize the lane line markings in the image, right? So how hard could that be? Let's just label, okay, there's the lane line, there's a lane line. Okay, that's great, and then you try to launch this and you try to annotate lane lines, and all these kind of edge cases kind of start streaming and it just makes your head hurt. So for example, what do you do in cases like that? This is somewhere in Europe. It's actually pretty common. We see this quite often because autopilot—

Is a global product. Do you follow the link line markings, or do you just like interpolate? I don't know. I don't know. Look, I'm not sure what to do there. What the hell is that? I don't know what the hell that was. Did someone tape with it or through it, or... I don't know. Just imagine these kinds of philosophical conundrums for like hundreds of cases for every single thing you want to annotate. It just makes my head hurt because, of course, like, I'm not sure: should the control stack after us take care of this, or should the vision stack take over it and just say, "Okay, well, this is like, you should just go through, and not obvious," right? Suppose you want to detect objects, so we put bounding boxes around objects. How hard could this be? Like, we want to put bounding boxes around these vehicles, right there.

It can be very hard. So, I don't know, you come across stuff like this and now it's not obvious as such. Is this for objects? Is this like two objects? Is this one object? And I have to be consistent and I have to put this into your labeling documentation. And now the labeling documentation is 100 pages, and now people annotate it incorrectly because it's so messed up and confusing. You want to try to annotate traffic lights? How hard could that be? It's like in a red, green, orange. I don't know, but bounding boxes around traffic lights or some find that it can be really, really hard. So, like, what? I don't even—I don't know what that is. I don't know what that is. There's a blue traffic light? I don't even know this. So, our labeling documentation for a while didn't even have like blue as an

option. So people came across this and they're like, "I don't know what to do," and I'm like, "Me neither. I guess we have to add the blue color." I'm not sure. You want to do speed limits? How hard could that be? It's just, you know, a number you should move at that speed. It can actually be like very, very difficult. So this just becomes a I complete very, very fast, because speed limit is like 25, you know, after 6:00 p.m. if you're a truck during the full moon. Like, I don't know. This one, I hope it's a joke, but I wouldn't even be surprised if it wasn't. I'm not sure. Lots of problems, like for example, I'm somewhere in Europe. We saw this traffic light which said like 60

ends here. So basically you have a default speed limit, I think of—I don't know what—and then they're letting you know that the zone of exception is 60. Like ends there. So from now on, you revert back to the default. And of course, our car was driving by and recognizes 60. It's just going to exactly do the wrong thing. So, anyway, so that's okay. So that's what I lose sleep over. That's one thing I learned the hard way. Number two: in a lot of these cases, these label data imbalances can be huge, and they actually matter. And if you're going to put software 2.0 stack on top of them, you have to really worry about it. So, for example, in our dataset, if you look at the bounding boxes and their classes, you'll notice that 90% of all objects—moving objects—are cars. There's

a huge amount of cars, and for example, there are not too many trolleys or streetcars. So, become that is not very good at recognizing those because it has like a thousand examples, and we have like a zillion examples of that. So now you have to really worry about that class imbalance. Speed limits are similar. 45 is the most common speed limit, as it turns out; about 10 percent of our signs are 45. And then you have many others that are significantly more rare. Where this gets actually interesting is, suppose I want to annotate, say, we're interested in detecting turn signals, right? Because we need to control to that. So, of course, you want to potentially detect that red blinker might be on, but the problem is that most of the data, of course, people do not have the blinker on. It's such a rare event. So now I need a

huge data set of that, and it just happens once every, like, now and then, pretty rarely. I'm going to end up with 100 examples of it, and now I'm in trouble. The same problem we have with orange traffic lights. Orange traffic lights are pretty rare. They just kind of appear for like one second. And so we have a zillion of red and a zillion of green, but we have very, very little of orange. And then the network just, like, this gives up. It doesn't really like to predict orange traffic lights because it never occurs in the training data. So that makes a lot of sense. So now you have to worry about that. It's not just a class distribution but also the data distribution. If you just sample uniformly at random from the fleet, you will notice that most of it looks like this: it's a straight highway. This is where most people drive. That's just what you're going to get; and then when you try to train on top of this data, and then you try to use the autopilot in

some pretty rare situation, then of course that's not going to work very well. We don't have too many snowy scenes with, you know, very—not very good lane line markings—and so on. And we don't have very, very many scenes where the slope is like extreme, and the car will not like it. So now you need to massage the data distribution to get this to work well. And what's even harder is that in these self-driving cases, it is precisely these rare examples that are so critical to get right. Like, you can't just have a rare example in your test set and just get a zero-zero accuracy on it because some of these could actually be like critical, right? So here's an example: we're driving down the highway, and there's this thing that extends into our lane. I don't actually know what this is; it's just we grabbed this from an

Intervention clip. So I don't know what this is, but now you have to kind of like worry about, okay, how do I annotate this? How do I label it? How do I avoid it? How do I get 10,000 examples of it at the very least, or a hundred thousand, and make sure that we train on it to make sure we recognize and then deal with it appropriately? I saw this bird attack the camera, just swoops in from the sky, attacks the camera. That's a lot of fun. How do you make sure the camera doesn't kind of like freak out or something like that? Make sure it's robust to it. This car over there dropped a ladder, and of course you're driving here and suddenly there's a ladder on your way, so the person just like takes over and does, it's a pretty unsafe maneuver, right? To actually avoid the ladder, which is completely necessary in this case. So now if you're driving an autopilot, and of course we can potentially recognize that.

There's something in the way, but you know, if it's a ladder, then of course you want to try to do this maneuver to evade it. But if it's a plastic bag, then maybe you recognize that that's actually something you could drive through, and suddenly you don't want to actually risk this pretty risky swerving maneuver to put other people in danger. So suddenly, you have to actually recognize, okay, is this something I can drive through or not? And now, how are you going to get, like, a dataset of a million things where there are things in your way, and some of them are safe or not safe? Or how do you deal with this, right? And these are such rare cases, so this happens maybe once, you know, in a blue moon. Luckily, at Tesla, we have, as I mentioned, a quarter million cars on the road, so we actually get stuff like this pretty frequently, much more frequently than probably the other players. And so we can actually have some hope of addressing some of these questions as

Long as we're careful and as long as we write the stack around making sure we catch all those things and that they end up in the training data set. And the last thing I kind of wanted to briefly talk about is that the toolchain, basically — as I mentioned — a huge amount of fight is not just over the modeling and the algorithm system but creating a robust training set, sourcing all the hard examples, massaging the data, cleaning it, maintaining it, etc. And this is what you do when you try to get the Software 2.0 stack to work in practice. And it seems to me that we've developed pretty elaborate tools to help us in the Software 1.0 setting. We have, for example, IDEs that are pretty complex, you have a debugger, a profiler, syntax highlighting, go to definition, lots of things that help you write the Software 1.0.

Code, but there's really nothing that helps you write the 2.0 code, or rather, we don't write the code, but the code is implied by the data set. And we have no tools to help us build and massage these training sets. So, you know, what does an IDE for a software 2.0 stack look like? It probably helps you with a lot of the tasks that I see on a daily basis that really I lose sleep over in terms of massaging this training set and getting that to work. So we have our own guests, and we're designing our own thing, and I'm kind of hesitant to go into too many details at this point, but yeah, we just are building a lot of back-end infrastructure for creating these data sets and making sure that in any case, that is pretty rare. How do we find it? How do we source it from the fleet automatically? How do we annotate it? How

Do we make sure it's all clean? How do we have a uniform distribution over all the cases that we were worried about? And just putting all of this in place is a pretty elaborate effort. So that's extremely important, and I don't think that people are, kind of as I mentioned briefly here, it's kind of not in the spotlight. Because what is in the spotlight is how do I train giant crya—like, NASA net at scale? And that's important, and, you know, we do a lot of that too at Tesla, so we have computing clusters and we worry a lot about, you know, training these networks, iterating on the architectures, and getting them to work really well. But really, a lot of it is learning about the dataset. But if we do our job well, then we're going to make these beautiful cars and all its friends drive really well. And if that—

Works really well. People want to buy the Autopilots, and people want to buy the Tesla cars. And then we might have a beautiful future. This beautiful future is electric, it's autonomous, it's sexy, and it's just exciting. This is the future that we want to be part of, and really the sky's the limit if we get this to work. So if some of these problems excite you, and if you want to help us out and build the software to point of stack for these extremely important problems in the world, then I encourage you to get in touch with us. One of the ways is to email vision@tesla.com. That kind of hits my team. And yeah, that's it. Thank you.

You, for questions, please come up to the mic and I... Under, thank you very much for the presentation. Yeah, two things. I don't know if you can answer, but even before anything related to adversarial examples in the physical world, even just the example with the letter—let's say it was just a, you know, a truck with the signs, right? That does road rippers and stop signs fails, and the camera recognizes the texture. It's a real stop. Sorry, I know what dresser. How do you deal with?

It, for instance, like, you know, and also with everything related to things like, you know, the basic catastrophic forgetting, right? To keep learning, and etc. Assert. So your first question was about unnatural examples. No, no, I said even before adversary, you have a truck that does road repair. His signs, stop sign, fails. Yes, it's a real sign, no adverse. How can you deal with such real-world example? And second, like, same thing in the same sense, because obviously you're destroying a very huge, to the moon effort of annotation and etc. But for instance, even things problems, you know, as you said, the basics.

Of data, it's not really basic, even catastrophic forgetting, right? Things it already learned, but now things change over time. Yeah, so I guess for the first question, one of the things that we take a lot of advantage of is the shadow mode, and this is really helpful because we basically, we recognize all these stop signs, and then we part of the control that recommends that we should be started, we should start stopping right now, and then we can see what humans do. And some of the humans might just disagree with that assessment, and whenever they do, that's a really good trigger and make sure we capture it, make sure it streams in, and make sure, again, that we have this really elaborate back-end that allows us to analyze these issues and make sure that they end up in a training data. And then you have a slightly less chance of screwing up in that particular case in the future. So turning that crank over and over. And I like your question with respect to even.

Before you get to adversarial examples, because that's a good framing, because a lot of people ask me about the adversarial examples, and it's like, you know, I'm mostly trying to stay in the lane, mostly trying to not, you know. So it's like we haven't even gotten there, I think. But yeah, at some point this will become really, really interesting to talk about. I guess this is like overlap with this question, but you're young enough to remember that you went to statistics class, they told you that the training set has to absolutely represent the exact same distribution as the test set. So when the system is deployed, if there is a statistical shift, you're in trouble. And then if you, that was the statistics professor with a long beard, and then there's a machinery professor says you have to find all the right examples. We.

Have to reach for the tragic cases. Do you think that, like, one day, machine learning says that the station will sit around the table and decide that if it's still true that you need what distribution do you need? Yeah, so the problem is we don't want to work in the average case, we're going to work in like the worst case, right? And that's kind of like where this discrepancy comes in, is that, you know, if 90% of my driving is on the highway going straight, I'm probably at some point going to, you know, at some point to come that gets it, and it's really not helpful to get a zillion examples of it. So that's why we kind of have to over-sample these rare situations that, as I mentioned, are perform is critical. So if you're chasing the average performance, then it probably makes sense to actually have your training data be exactly what you see at test time. But what we care about is.

Making sure that we work really well in all the rare cases as well, and that's, I think, where some discrepancy comes in. So going back to your early slide where you showed the evolution of computer, computer vision, you have this sort of code gen portion and go to the upward projection. How do we know, like, learning the weights is something that we can scale even if we have enough data? Is there any evidence, evidence of that? Or how do we know that? So I could, the cogent pirate, like, you basically, you know, you know, develop a system that can learn the weights. Is that something like the projection goes straight up? Standard, you say, do you think is this something that we know will scale even if there’s enough data? Is there something like maybe threshold, like some.

Complexity that could prevent it? Oh yeah, I'm pretty optimistic about the wide trend. It just seems like with a small amount of compute, you can't afford to search a very large program space. So in the beginning, we just searched the space of linear classifiers on top of features, and now I have more compute, so I can extend the search space and I can still find a good solution. There's our comments, and then now that I have even larger compute, so I can actually expand that space again and still hope to actually for this to work. I can find good solutions, so it's just a trend I'm seeing kind of evolve. I guess we haven't seen it break. I'm not sure. Yeah, I really, this will certainly work. We still hard code a lot of things. We still hard code the gradient as the credit assignment mechanism, backpropagation, and so on, and we still hard code the fact that we're.

Using cast in gradient descent. But really, at some point, you have a training set, then you do a number of some compute, and then you're supposed to work well. And some compute right now has a pretty specific structure of like, okay, I take patches, I do forward backward, I do update. And this thing, you can unroll, and you can just see as a single tester for low computational graph on top of your training dataset. So at some point, we might potentially just, you know, get rid of even that structure, and that's probably what's gonna happen. Sure, thanks. Hey, on the topic of massaging your data and picking or datasets, how do you deal with bias in the case that the right action isn't clearly defined? For example, I have the choice of hitting either two children or three adults or like two Black people, two white people. How do you deal with bias and that kind?

Of situation, yeah, it's kinda like a trolley problem or statement, or yeah, yeah, for a lot of this. So we don't currently deal with it, I guess explicitly, because we're not even at a point where we can actually, like, detect, say, some of these things. I anticipate that probably what will end up happening is we're going to adopt, because releases will be machine learning systems that will inherit human driving behavior. So they'll probably end up inheriting some kind of distribution about how humans behave in these cases, and hope to, you know, start off from that and try to make it, of course, better. But it will probably, you end up probably will be the behavior that is kind of like the average.

Human, or of those humans, that would—how they would behave in those kinds of scenarios. Hopefully, some of the better humans. There are ways of imposing, basically, these reward functions. You don't just have to take these demonstrations and learn on all of them, but you can prefer some demonstrations over others. So, like, for example, the acceleration should not be too high and, of course, you should not be hitting things. So, you can prefer some human rollouts over others. So, you can hope to basically at best imitate some of the best human drivers, and I think that's kind of how it's going to turn out. What, take into account anything about, like, how many passengers the driver has inside of the car, for example, figuring out what would be the best case by four people in the car versus hitting one person? Yeah. So, currently, we can't.

Even like detect that, I guess. Okay, so we haven't really written these kinds of super explicit rules. This is absent from the stack. We're kind of, you know, driving forward and trying not to hit things. So, thank you, thank you. Thanks. Let's thank Andre one more time. (applause)

From YouTube captions, lightly punctuated for readability. Timestamps link to the video above. Errors are possible.

Cite this recording

Andrej Karpathy, “Scaled Machine Learning for Autonomous Driving at Tesla (2019)”, Conference keynote, October 2019. Transcript and video: Thinkers Archive, https://thinkersarchive.com/andrej-karpathy/software-2-0-tesla-talk-2019/

Quoting a passage? Link to its exact moment: every timestamp above has its own anchor (for example https://thinkersarchive.com/andrej-karpathy/software-2-0-tesla-talk-2019/#t-135).

Search every transcript
Open the full search page →