text
stringlengths
142
207
llm_intro_0.wav|So here we go, the busy person's intro to large language models, Director Scott. Okay, so let's begin. First of all, what is a large language model really?|
llm_intro_1.wav|So for example, working with the specific example of the LLAMA270B model, this is a large language model released by Meta.ai.|
llm_intro_2.wav|And this is basically the LLAMA series of language models, the second iteration of it, and this is the 70 billion parameter model of of this series.|
llm_intro_3.wav|So there's multiple models belonging to the Lama 2 series. 7 billion, 13 billion, 34 billion, and 70 billion is the biggest one.|
llm_intro_4.wav|So in this case, the Lama270b model is really just two files on your file system, the parameters file and some kind of a code that runs those parameters.|
llm_intro_5.wav|Because this is a 70 billion parameter model, every one of those parameters is stored as two bytes. And so therefore, the parameters file here is 104 gigabytes.|
llm_intro_6.wav|And it's two bytes because this is a float 16 number as the data type. Now, in addition to these parameters, that's just like a large list of parameters for that neural network.|
llm_intro_7.wav|But C is sort of like a very simple language, just to give you a sense. And it would only require about 500 lines of C with no other dependencies.|
llm_intro_8.wav|You can take these two files, you compile your C code, you get a binary that you can point at the parameters, and you can talk to this language model.|
llm_intro_9.wav|So for example, you can send it text, like, for example, write a poem about the company Scale.ai, and this language model will start generating text.|
llm_intro_10.wav|I'm slightly cheating here because this was not actually, in terms of the speed of this video here, this was not running a 70 billion parameter model.|
llm_intro_11.wav|A 70B would be running about 10 times slower, but I wanted to give you an idea of sort of just the text generation and what that looks like.|
llm_intro_12.wav|So not a lot is necessary to run the model. This is a very small package. But the computational complexity really comes in when we'd like to get those parameters.|
llm_intro_13.wav|Because whatever's in the run.c file, the neural network architecture and sort of the forward pass of that network, everything is algorithmically understood and open and so on.|
llm_intro_14.wav|So to obtain the parameters, basically the model training, as we call it, is a lot more involved than model inference, which is the part that I showed you earlier.|
llm_intro_15.wav|So because LLAMA270B is an open source model, we know quite a bit about how it was trained because Meta released that information in paper.|
llm_intro_16.wav|So these are some of the numbers of what's involved. You basically take a chunk of the internet that is roughly, you should be thinking, 10 terabytes of text.|
llm_intro_17.wav|This typically comes from like a crawl of the internet. So just imagine just collecting tons of text from all kinds of different websites and collecting it together.|
llm_intro_18.wav|And this would cost you about $2 million. And what this is doing is basically it is compressing this large chunk of text into what you can think of as a kind of a zip file.|
llm_intro_19.wav|And in this case, what would come out are these parameters, 140 gigabytes. So you can see that the compression ratio here is roughly like 100x, roughly speaking.|
llm_intro_20.wav|And that's why these training runs today are many tens or even potentially hundreds of millions of dollars, very large clusters, very large data sets.|
llm_intro_21.wav|And this process here is very involved to get those parameters. Once you have those parameters, running the neural network is fairly computationally cheap.|
llm_intro_22.wav|OK, so what is this neural network really doing? I mentioned that there are these parameters. This neural network basically is just trying to predict the next word in a sequence.|
llm_intro_23.wav|And these parameters are dispersed throughout this neural network. And there's neurons, and they're connected to each other, and they all fire in a certain way.|
llm_intro_24.wav|the next word will probably be a mat with, say, 97% probability. So this is fundamentally the problem that the neural network is performing.|
llm_intro_25.wav|Because if you can predict the next word very accurately, you can use that to compress the dataset. So it's just a next word prediction neural network.|
llm_intro_26.wav|You give it some words, it gives you the next word. Now, the reason that what you get out of the training is actually quite a magical artifact is that|
llm_intro_27.wav|So here I took a random webpage at the time when I was making this talk. I just grabbed it from the main page of Wikipedia, and it was about Ruth Handler.|
llm_intro_28.wav|And so think about being the neural network, and you're given some amount of words and trying to predict the next word in a sequence. Well, in this case, I'm highlighting here in red|
llm_intro_29.wav|And so, in the task of next word prediction, you're learning a ton about the world, and all this knowledge is being compressed into the weights, the parameters.|
llm_intro_30.wav|Now, how do we actually use these neural networks? Well, once we've trained them, I showed you that the model inference is a very simple process.|
llm_intro_31.wav|So on the left, we have some kind of a Java code dream, it looks like. In the middle, we have some kind of what looks like almost like an Amazon product dream.|
llm_intro_32.wav|Focusing for a bit on the middle one as an example, the title, the author, the ISBN number, everything else, this is all just totally made up by the network.|
llm_intro_33.wav|The network is dreaming text from the distribution that it was trained on. It's mimicking these documents. but this is all kind of like hallucinated.|
llm_intro_34.wav|The model network just knows that what comes after ISBN colon is some kind of a number of roughly this length, and it's got all these digits, and it just like puts it in.|
llm_intro_35.wav|On the right, the black nose dace, I looked it up, and it is actually a kind of fish. And what's happening here is this text verbatim is not found in the training set documents.|
llm_intro_36.wav|But this information, if you actually look it up, is actually roughly correct with respect to this fish. And so the network has knowledge about this fish.|
llm_intro_37.wav|It knows a lot about this fish. It's not going to exactly parrot documents that it saw in the training set. But again, it's some kind of a lossy compression of the internet.|
llm_intro_38.wav|It kind of remembers the gestalt. It kind of knows the knowledge. And it just kind of like goes. And it creates the form. It creates kind of like,|
llm_intro_39.wav|And you're never 100% sure if what it comes up with is as we call hallucination or like an incorrect answer or like a correct answer necessarily.|
llm_intro_40.wav|Okay, let's now switch gears to how does this network work? How does it actually perform this next word prediction task? What goes on inside it?|
llm_intro_41.wav|The problem is that these 100 billion parameters are dispersed throughout the entire neural network. So basically, these billions of parameters are throughout the neural net.|
llm_intro_42.wav|And all we know is how to adjust these parameters iteratively to make the network as a whole better at the next word prediction task. So we know how to optimize these parameters.|
llm_intro_43.wav|We know how to adjust them over time to get a better next word prediction. But we don't actually really know what these 100 billion parameters are doing.|
llm_intro_44.wav|So we kind of understand that they build and maintain some kind of a knowledge database, but even this knowledge database is very strange and imperfect and weird.|
llm_intro_45.wav|So as an example, if you go to chat GPT and you talk to GPT-4, the best language model currently available, you say, who is Tom Cruise's mother?|
llm_intro_46.wav|So this knowledge is weird and it's kind of one-dimensional. And you have to sort of like, this knowledge isn't just like stored and can be accessed in all the different ways.|
llm_intro_47.wav|Long story short, think of LLMs as mostly inscrutable artifacts. They're not similar to anything else you might build in an engineering discipline.|
llm_intro_48.wav|But right now we kind of treat them mostly as empirical artifacts. We can give them some inputs and we can measure the outputs. We can basically measure their behavior.|
llm_intro_49.wav|And so that's the first stage of training. We call that stage pre-training. We're now moving to the second stage of training, which we call fine-tuning.|
llm_intro_50.wav|And this is where we obtain what we call an assistant model, because we don't actually really just want document generators. That's not very helpful for many tasks.|
llm_intro_51.wav|We want to give questions to something, and we want it to generate answers based on those questions. So we really want an assistant model instead.|
llm_intro_52.wav|And the way you obtain these assistant models is fundamentally through the following process. We basically keep the optimization identical, so the training will be the same.|
llm_intro_53.wav|It's just a next word prediction task. But we're going to swap out the data set on which we are training. So it used to be that we are trying to train on internet documents.|
llm_intro_54.wav|We're going to now swap it out for data sets that we collect manually. And the way we collect them is by using lots of people. So typically, a company will hire people.|
llm_intro_55.wav|So there's a user, and it says something like, can you write a short introduction about the relevance of the term monopsony in economics, and so on.|
llm_intro_56.wav|And the IELTS response and how that is specified and what it should look like all just comes from labeling documentations that we provide these people.|
llm_intro_57.wav|Once you do this, you obtain what we call an assistant model. So this assistant model now subscribes to the form of its new training documents.|
llm_intro_58.wav|And it will do that. So it will sample word by word again, from left to right, from top to bottom, all these words that are the response to this query.|
llm_intro_59.wav|So roughly speaking, pre-training stage trains on a ton of internet and is about knowledge, and the fine-tuning stage is about what we call alignment.|
llm_intro_60.wav|So roughly speaking, here are the two major parts of obtaining something like ChatGPT. There's the stage one pre-training, and stage two, fine-tuning.|
llm_intro_61.wav|So these are special purpose computers for these kinds of parallel processing workloads. This is not just things that you can buy in Best Buy. These are very expensive computers.|
llm_intro_62.wav|And then you compress the text into this neural network, into the parameters of it. Typically, this could be a few millions of dollars. And then this gives you the base model.|
llm_intro_63.wav|So for example, Scale.ai is a company that actually would work with you to actually basically create documents according to your labeling instructions.|
llm_intro_64.wav|You collect 100,000, as an example, high quality, ideal Q&A responses. And then you would fine tune the base model on this data.|
llm_intro_65.wav|This is a lot cheaper. This would only potentially take like one day or something like that instead of a few months or something like that. And you obtain what we call an assistant model.|
llm_intro_66.wav|Then you run a lot of evaluations, you deploy this, and you monitor, collect misbehaviors. And for every misbehavior, you want to fix it, and you go to step on and repeat.|
llm_intro_67.wav|And the next time you do the fine-tuning stage, the model will improve in that situation. So that's the iterative process by which you improve this.|
llm_intro_68.wav|The Lama 2 series actually, when it was released by Meta, contains both the base models and the assistant models. So they release both of those types.|
llm_intro_69.wav|If you give it questions, it will just give you more questions, or it will do something like that, because it's just an internet document sampler. So these are not super helpful.|
llm_intro_70.wav|And so you can go off and you can do your own fine-tuning. And that gives you a ton of freedom. But Meta, in addition, has also released assistant models.|
llm_intro_71.wav|So if you just like to have a question-answerer, you can use that assistant model and you can talk to it. Okay, so those are the two major stages.|
llm_intro_72.wav|The reason that we do this is that in many cases it is much easier to compare candidate answers than to write an answer yourself if you're a human labeler.|
llm_intro_73.wav|From the perspective of a labeler, if I'm asked to write a haiku, that might be a very difficult task, right? Like I might not be able to write a haiku.|
llm_intro_74.wav|Well, then as a labeler, you could look at these haikus and actually pick the one that is much better. And so in many cases, it is easier to do the comparison instead of the generation.|
llm_intro_75.wav|And there's a stage three of fine-tuning that can use these comparisons to further fine-tune the model. And I'm not going to go into the full mathematical detail of this.|
llm_intro_76.wav|And this is kind of this optional stage three that can gain you additional performance in these language models, and it utilizes these comparison labels.|
llm_intro_77.wav|So this is an excerpt from the paper InstructGPT by OpenAI. And it just kind of shows you that we're asking people to be helpful, truthful, and harmless.|
llm_intro_78.wav|These labeling documentations, though, can grow to tens or hundreds of pages and can be pretty complicated. But this is roughly speaking what they look like.|
llm_intro_79.wav|And so for example, you can get these language models to sample answers, and then people sort of like cherry pick parts of answers to create one sort of single best answer.|
llm_intro_80.wav|Or you can ask these models to try to check your work, or you can try to ask them to create comparisons, and then you're just kind of like in an oversight role over it.|
llm_intro_81.wav|Okay, finally, I wanted to show you a leaderboard of the current leading large language models out there. So this, for example, is the Chatbot Arena.|
llm_intro_82.wav|So you can go to this website, you enter some question, you get responses from two models, and you don't know what models they were generated from, and you pick the winner.|
llm_intro_83.wav|They are usually behind a web interface. And this is GPT series from OpenAI and the Cloud series from Anthropic. And there's a few other series from other companies as well.|
llm_intro_84.wav|So these are currently the best performing models. And then right below that, you are going to start to see some models that are open weights. So these weights are available.|
llm_intro_85.wav|A lot more is known about them. There are typically papers available with them. And so this is, for example, the case for Lama 2 series from Meta.|
llm_intro_86.wav|And all of this stuff works worse, but depending on your application, that might be good enough. And so currently I would say the open source ecosystem is trying to boost performance|
llm_intro_87.wav|Okay, so now I'm going to switch gears and we're going to talk about the language models, how they're improving, and where all of it is going in terms of those improvements.|
llm_intro_88.wav|So if you train a bigger model on more text, we have a lot of confidence that the next word prediction task will improve. So algorithmic progress is not necessary.|
llm_intro_89.wav|And we are very confident we're going to get a better result. Now, of course, in practice, we don't actually care about the next word prediction accuracy.|
llm_intro_90.wav|And you see that if you train a bigger model for longer, for example, going from 3.5 to 4 in the GPT series, all of these tests improve in accuracy.|
llm_intro_91.wav|And instead of speaking in abstract terms, I'd like to work with a concrete example that we can sort of step through. So I went to ChessGPT and I gave the following query.|
llm_intro_92.wav|I said, collect information about ScaleAI and its founding rounds, when they happened, the date, the amount, and evaluation, and organize this into a table.|
llm_intro_93.wav|So if you and I were faced with the same problem, you would probably go off and you would do a search, right? And that's exactly what ChachiPT does.|
llm_intro_94.wav|It works very similar to how you and I would do research using browsing. And it organizes this into the following information. And it sort of responds in this way.|
llm_intro_95.wav|So it collected the information. We have a table. We have series A, B, C, D, and E. We have the date, the amount raised, and the implied valuation in the series.|
llm_intro_96.wav|On the bottom, it said that, actually, I apologize, I was not able to find the series A and B valuations. It only found the amounts raised.|
llm_intro_97.wav|So I said, okay, let's try to guess or impute the valuation for series A and B based on the ratios we see in series C, D, and E.|
llm_intro_98.wav|Well, if we're trying to impute not available, again, you don't just kind of like do it in your head. You don't just like try to work it out in your head.|
llm_intro_99.wav|That would be very complicated because you and I are not very good at math. In the same way, ChachiPT, just in its head sort of, is not very good at math either.|