Building Large Language Models
Transcript
so let's get started uh so I'll be talking about building llms today um so I think a lot of you have heard of llms before uh but just as a quick recap uh llms standing for large language models are basically all the chat Bots uh that you've been hearing about recently so uh Chad GPT from open ey Claud from entropic Gemini and and lman other type of models like this and today we'll be talking about how do they actually work so it's going to be an overview because
it's only one lecture and it's hard to compress everything but hopefully I'll touch a little bit about all the components that are needed to train uh some of these llms uh also if you have questions please interrupt me and ask uh if you have a question most likely other people in the room or on Zoom have other have the same question so please ask um great so what matters when training llms um so there a few key components that matter uh one is the architecture so as you probably all know LMS are newal networks and when you think about new networks you have to think about what architecture you're using and another component which is really important uh is the training loss and the training algorithm um so how you actually train these models then it's data so uh what do you train these models on um the evaluation which is how do you know whether you're actually making progress towards the goal of of uh llms and then the system component so that is like how
do you actually make these models run on uh Modern Hardware which is really important because these models are really large um so now more than ever system is actually really an important topic um for llms so those five components um You probably all know that llms and if you don't know LMS are all based on Transformers or at least some version of Transformers uh I'm actually not going to talk about the AR lecture today uh one because I gave a SE lecture on um Transformers a few weeks ago and two because you can find so much information online on uh Transformers but I think you can it's there's much less information about the other four topics so I really want to talk about those um another thing to say is that most of Academia actually focuses on architecture and training algorithm and losses um as academics and I've done that for a lot big part of my career is simply we like thinking that this is uh like we make new architectures new
models and it it seems like it's very important but in reality honestly what matters in practice is mostly the three other topics so data evaluation and systems uh which is what of most of Industry actually focuses on um so that's also one of the reason why I don't want to talk too much about the architecture uh because really the rest is super important um great so overview of the lecture I'll be talking about pre-training so pre-training uh you probably heard that word this is the general word this is kind of the classical language modeling uh Paradigm uh where you basically train your language model to essentially model all of internet and then there's a post training which is a more recent Paradigm which is taking these large language models and making them essentially AI assistants um so this is more of a recent Trend since Chad GPT uh so if you ever heard of gpt3 or gpt2 that's really pre-training land uh if you heard of chat GPT which you probably have this is
really posttraining land uh so I'll be talking about both but I'll start with pre-training and uh specifically I'll talk about what is the task of pre-training llms and what is the laws that people actually use so language modeling this is a quick recap uh language models at a high level are simply models of probability distribution over sequences of tokens or of words so it's basically some uh model of P of X1 to XL where X1 is basically word one and Excel is the last one in
the sequence or in the sentence um so very concretely if you have a sentence like the mouse ate the cheese what the language model gives you is simply a probability of this sentence being uttered by a human or being found on on online uh so if you have another sentence like the the mouse at cheese uh here there's grammatical mistakes so the model should know that this uh should have some syntactic knowledge so it should know that this has less likelihood of appearing online uh if you have another sentence like the cheese ate the mouse uh then the model should hopefully know about the fact that usually cheese don't eat Mouse um so there's some semantic knowledge and this is less likely than the first sentence so this is basically at a high level what language models are um one word that you probably have been hearing a lot in the news are generative models uh so this is just something that can generate models that can generate
sentences or can generate some data uh the reason why we say language models are generative models is that once you have a model of a distribution you can simply sample from this model and now we can generate data uh so you can generate sentences uh using a language model so the type of models that uh people are all currently using are what we call Auto regressive language models and the key idea of autor regressive language models is that you take this distribution over words and you basically decompose it into the into the distribution of the first word multiply the by the distribution of or the likelihood of the distribution of the second word given the first word uh multiply by P of the third word given the first two words um so there's no approximation here this is just the chain rule of probability which you hopefully all know about uh really no approximation this is just one way of modeling a distribution uh so slightly more concisely you can write it as a product
of U of PS of the next word given everything which happened in the past so of the context and uh so this this is what we call Auto regressive language models again this is really not the only way of modeling distribution this is just one way uh it has some benefits and some downsides one downside of autoaggressive language models is that when you actually sample from this autoaggressive language model you basically have a for Loop which generates the next word then conditions on that next word and then regenerate an other word so basically if you have a longer sentence that you want to generate you it takes more time to generate it uh so there are some downsides of this current Paradigm but that's what we currently have so I'm going to talk about this one uh great so Auto regressive language models at a high level um what the task of autoregressive language model is is simply predicting the next word as I just said so if you have a sentence like
she likely prefers uh one potential next word might be dogs and the the way we do it is that we first tokenize so you take these words or subwords you tokenize them um and then you give an IDE for each token so here you have 1 2 three uh then you pass it through this black box as I already said we're not going to talk about the architecture you just pass it pass it through a model and you then get a distribution a probability distribution over the next word over the next token and then you sample uh from this distribution you get a new token and then you DET tokenize so you get a new ID you then DET toonize and that's how you basically sample from a language model uh one thing which is important to not is that the last two TS uh two steps are actually only need needed during inference uh when you do training you just need to predict uh the most likely token and you can just compare to the real token which happen in practice and
then you basically change the weights of your model to increase the probability of generating that token um great so autoaggressive neural language models so to be slightly more specific still without talking about the architecture uh the first thing we do is that we have all of these oh sorry yes on the previous slide when you're predicting the probability of the next tokens does this mean that your final like output VOR has to be the same dimensionality as the number of tokens that you have yes how do you deal with like if you have more to like if you're adding more tokens to your cor something yeah so we're going to talk about tokenization actually later uh so you will get some sense of this you basically can deal with adding new tokens I am I'm kind of exaggerating there are methods for doing it but essentially people don't do it um so it's really important to think about how you tokenize your text and that's why we'll talk about that later but it's a
very good point to notice that you basically the vocabulary size so the number of tokens that you have is essentially the output of your uh language model so it's actually pretty pretty large okay so autoaggressive new language models first thing you do is that you take every word or every token you embed them so you get a um some Vector representation for each of these tokens um you pass them through some ual Network as we said it's a Transformer then you get a representation for all the word in all the words in the context so it's basically representation of the entire sentence uh you pass it through a linear layer as you just said to basically map it to the number so that the output the number of outputs is the number of tokens uh you then pass it through some soft Max and you basically get uh probity distribution over the next words given every word in the context and the law that you use is basically it's essentially a task of classifying
the next token so it's a very simple kind of machine learning task so you use the cross entry P loss where you basically you look at the actual Target that happened which is a target distribution which is a one hot encoding which here in this in this case says I saw uh the real word that happened is cat so that's a one hot um distribution over cat and here this is the actual uh do you see my mouse oh yeah this is the distribtion that you generated and basically you do cross entropy which really just increases the probability of generating cat and decreases all the the probility of generating all the other tokens one thing to notice is that as you all know again uh this is just equivalent to maximizing the text log like the text log likelihood because you can just rewrite the the max over the probability of um this autoregressive language moding task as just being this minimum over I just added the log here and minus which is just the minimum of
the loss which is the cross enty loss so basically minimizing the loss is the same thing as maximizing the likelihood of your text any question questions okay tokenizer um so this is one thing that people usually don't talk that much about tokenizers are extremely important uh so it's really important that you kind of understand at least uh what they do at a high level so why do we need token in the first place uh first it's more General than words so one simple thing that you might think is oh we're just going to take every word that we will have you just say every word is a new is a token in its own um but then
what happens is if there's a typo in your word then you might not have any token associated with this this word with a typo and then you don't know how to actually pass this word with a typo into a large language model so what do you do next and also even if you think about words words is a very like words are fine with like Latin based languages uh but if you think about a language like taii you won't have a simple way of tokenizing by spaces because there are no spaces between words um so really uh tokens are much more General Than Words first thing second thing that you might think is that you might tokenize every sentence character by character you might say a is one token b is another token uh that would actually work and probably very well the issue is that then your sequence becomes super long and as you probably remember from the lecture on on Transformers uh the complexity uh grows quadratically with the length of sequences so you really
don't want to have a super long sequence um so tokenizers basically try to deal with those two problems and give common subsequences a certain token and usually how you should be think about is around uh an average every token is around three four letters um and there are many algorithm for tokenization I'll just talk about one of them to give you a high level which is what we call bite P en coding which is actually pretty common one of the two most common tokenizers and the way that
you train a tokenizer is that first you start with a very large Corpus of text and here I'm really not talking about training a large language model yet this is purely for the tokenization step uh so this is my large Corpus of text with these five words um then you associate every character in this Corpus of text a different token uh so here I just split up every character with a different token uh and I just color coded all of those tokens and then what you do is that you go through your text and every time you see pairs of tokens that are very common the most common pair of token you just merge them so here you see three times the the the tokens T and O next to each other so you're just going to say this is a new token and then you continue you repeat that so now you have to talk which happens three times to with an E that happens sorry two times and an token which happens twice and then ex which also happen twice so this is that if you were to
train a tokenizer on this Corpus of text which is very small that's how you would uh finish with a token with a pre like a trained tokenizer uh in reality you do it on on much larger corpuses of text um and this is the real tokenizer of uh actually I think this is gpt3 or chat GPT uh and here you see how it would actually separate these words so basically you see the same thing as what we gave in the previous example token becomes its own token so tokenizer is actually split up into two tokens token and iser um so yeah that's all about tokenizers any questions on that yeah how do you deal with spes and how do you deal with yeah so actually there's a a step before tokenizers which is what we call pre- tokenizers which is exactly what you just said uh so this is mostly in theory there's no reason to deal with spaces and punctuation separately you could just say every space gets its own token every um uh punctuation get its
own token and you can just do all the merging the problem is that so there's an efficiency question actually training these tokenizes takes a long time uh so you better off because you have to consider every pair of token so what you end up doing is saying if there's a space this is very like pre- tokenizes are very English specific you say if there's a space we're not going to start looking at the the token that came before and the token that came afterwards so you're not merging in between spaces but this is just like a optimiz like a computation optimization you could theoretically just deal with it um the same way as you deal with any other character and yeah when you merge tokens do you delete the tokens that you merged away or do you keep the the smaller tokens that merge um you actually keep the smaller tokens I mean in reality it doesn't matter much because um usually on large Corpus of text you will have actually everything uh but you usually keep the small ones
and the reason why you want to do that is because if in case there's as we said before you have some um some grammatical mistakes so some typos you still want to be able to represent these words by character um so yeah yes are the tokens unique so I mean say in this case T Ken is there only one occurrence or could do you need to leave multiple occurr so they could have take on different meanings or something oh oh I see what you say no no it's every token has its
own uh unique ID um so a usual this is a great question for example if you think about a bank which could be bank for like money or bank like water um it will have the same token but the model will learn the Transformer will learn that based on the words that are around it it should associate that I'm saying I'm being very high wavy here but associate that with the with a with a representation that is either more like the bank money side or the Bank water side um but that's a Transformer that
does that it's not a tokenizer yes yeah so you mentioned during tokenization keep the smaller tokens you started with right like if you start with a t you keep the T and then you build your tokenizer to the that you can now in token so let's say maybe you didn't train on token but like in your data you are trying to encode token so how does the tokenizer know to encode it with token or a great question you basically when you so when you tokenize so that's after training of the tokenizer when you actually apply the tokenizer you basically always choose the largest uh token that you can apply uh so if you can do token you will never do T you will always do token um but there's actually so people don't usually talk that much about tokenizers but uh there's a lot of of computational benefits uh or computational tricks that you can do for making these things faster uh so I really don't think we and honestly I think a lot of people think that we should just get away from
tokenizers um and just kind of tokenize character by character or bites by bites uh but as I said right now there's this issue of like length uh but maybe one day like in five or 10 years we will have different architectures that don't scale quadratically with the length of the sequence and uh maybe we'll um yeah move away from tokenizes so can you share with us the drawback why do people want to move away from the tokenizer oh um yeah so think one good example is uh math if you think
about math actually numbers right now are not tokenized so for example 327 might have its own token which means that models when they see numbers they don't see them the same way as we do and this is very annoying because what I mean the reason why we can kind of generalize with math is because we can deal with every every letter separately and we can then do composition where you know that basically if you add stuff it's just the same thing as adding every one separately plus like whatever the unit that you add so they can do that um so then you have to do like special tokenization and like one of the big changes that GPT 4 did uh is changing the way that they tokenize uh code so for example uh if you have code you know you have like often in Python these four spaces at the beginning those were dealt with uh kind of strangely before um and as a result like the model couldn't really understand uh how to deal with code uh so so toiz actually a lot um
okay so I'll move on right now but we can come back later on token Isis great so we talked about the task the L the tokenizer let's talk a little bit about evaluation uh so the way that LMS are usually evaluated is what we call is using what we call perplexity um at a high level it's basically just your validation loss uh the slight difference with perplexity is that we use something that is slightly more interpretable which is that we use the average per token loss and then you expon entiate it and the reason why you exponentiate it is because you want I mean the loss has a log inside and you like one humans are actually pretty bad at thinking in log space but two logs depend on the base of the log uh while when you exponentiate you basically have everything in the uh kind of the vocabulary size uh unit um and the average proten is just so that your your complexity is independent of the length of your sequence um so perplexity is just two to the power uh
average of the loss of the sequence um so perplexity is between one and the length of the vocabulary of your tokenizer uh one it's simply well if you predict perfectly the thing which uh every word then every word will have basically product of ones uh so the best perplexity you can have is one if you really have no idea you basically predict with one divided by uh size of vocabulary um and then you do simple math and you basically get perplexity of size of vocabulary uh so the intuition
of perplexity is that basically the number of tokens that your model is kind of hesitating between uh so if you if your model is perfect it doesn't hesitate it know exactly the word if it really has no idea then it hesitates between uh all of the vocabulary uh so perplexity really improved that's perplexity on a standard data set between 2017 and 2023 it it went from kind of 70 tokens to less than 10 tokens over these five six years so that means that the models were
previously as dating between 70 words every time it was generating a word and now it's as dating between like less than 10 words so that's much better perplexity is actually not used anymore in academic benchmarking mostly because it depends on the tokenizers that you use uh it depends on the actual data that people are evaluating on but it's still very important for development of llms so when you when you actually train your own llm people will still really look at the perplexity uh one common other way and now more common in Academia of evaluating these llms is just by taking all the classical NLP benchmarks and I'll give you a few examples later and just kind of aggregating everything um so collect as many automatically evaluatable benchmarks and just evaluate across all of them um so one such if uh or actually two such uh benchmarks of what we call uh Helm which is from Stanford and another one is the hugging face open LM leader board which are the
probably two two most common ones right now um so just to give you an idea in Helm there are all of these type of tasks which are mostly things that can be easily evaluated uh like question answering so think about many different question answering uh tasks um and the benefit with question answering is that you usually know what is the real answer um so you can the way that you evaluate these models and I'll give you a concrete example in one second um is that you can just look at How likely the language model is to generate the real answer compared to some other answers and that's essentially at a high level how you evaluate these models um so to give you a specific example mlu is probably the most common um academic Benchmark for llms uh and this is just a collection of many question and answers in all of those domains for example College medicine College physics astronomy and these type of topics and the questions are things like so this in astronomy
what is true for type 1 a supernova then you give uh four different potential answers and you just ask the model which one is more likely so there are many different ways of doing it either you can look at the likelihood of generating all these answers uh or you can ask the model which one is the most likely uh so there are different ways that you can promp the model but at a high level you know which one is correct and there are three other mistakes um yes kind creating is like unconstrained text as the output yeah how do you evaluate a model if it give something that's you know semantically completely identical but is not the exact token list that expect yeah so that's a great question I'll talk more about that later here in this case we don't do unconstrained so the way you would evaluate MML is basically either you you ask the first question and then you look at the likelihood of the model generating a the likelihood of the model generating b c
and d and you look at which one is the most likely or you can as the model out of ABC d which one is the most likely and you look at whe the to the most likely next token is A B C or D so uh you can strain the model to say it can only answer these four things you say you constraint the model you mean you constraint The Prompt or do you mean of its whole probability distribution outputs you only comparing the outputs like you're only comparing the a so uh in the second case I gave you you would do exactly the I actually you would do both you would prompt the model saying ABC or D plus you would constrain to only uh look at these two these four tokens in the first case you don't even need to generate anything so in the first case you literally just look given that it's a language model it can give a distribution over sentences you just look at what is the likelihood of generating all of these words what is the likelihood of generating the second
choice and you just look at whether the most likely sentence is actually the real answer so you don't actually sample from it you really just use P of x one to excel does that make sense uh that being said evaluation of open-ended questions is something we're going to talk about later and is actually really important and really challenging yes earlier you mentioned that um like um metrics like flexity are not are not like usually used because it depends on like how you do your terization some
design choices I was wondering if you could speak more to that oh um yeah so think about perplexity I told you perplexity is between one and vocabulary size so now imagine that Chad GPT uses a tokenizer that has like 10,000 tokens but Gemini from Google uses a tokenizer that had 100,000 uh potential tokens then actually the Gemini one will will have like the upper bound of the the perplexity that you can get is actually worse for Gemini than for Chad GPT does
that make sense so that's just an idea it's actually a little bit more complicated than that but that's just like one uh first or the bit of you can see that the tokenizer actually matters um great okay so evaluation challenges there are many I'll just talk about two really briefly uh one as I told you there are two ways of doing evaluation for these mlu actually there are many more than two but I give you two examples um and it happens that for a long time even though that was a very
classical Benchmark that everyone used uh actually different uh different companies and different um different uh uh different organization were actually using different ways of evaluating mlu and as a result you could you get completely different results for example Lama 65b uh which was the first model of meta in the Lama series uh had on Helm 63.7 accuracy but on this other um Benchmark had like 48.8 um so really the way that you evaluate and this is not even talking
about prompting this is really just kind of the the way that you evaluate the uh the models prompting is another issue so really there are a lot of inconsistencies it's not as easy as it looks uh first thing yeah sorry how can we make sure that all these models AR trained on The Benchmark okay second thing this is a great question uh chain test contamination uh this is something which I would say is really important in Academia in uh given that the talk is mostly about training large language
models uh for companies it's maybe not that important CU they know what they trained on uh for us we have no idea so for us it's a real problem uh so there are many different ways of trying to test whether uh the test set sorry whether the test set was actually in the training Set uh one kind of cute trick um that people uh in in the lab on T lab have found is that what you can do is that given that most of the data set online are not randomized you can just look at and in that
language models what they do is just predict the next word um you can just look at the entire test Set uh what if you generate all the examples in order versus all the examples in a different order and if it's more likely to generate a thing in order given that there's no real order there then it means that probably was in a training set does that make sense um so there are many that's like one of them there are many other ways of doing it train test contamination again not that important for development really important for academic benchmarking great so there are many other challenges but uh I'll move on for now great data um so data is another really big topic um at a high level people just say oh you basically train large language models on all of Internet what does that even mean um so or people sometimes say all of clean internet which is even less defined um so internet is very dirty and really not representative of what we want in practice if I download a random website
right now you would be shocked at what is in there it's definitely not your Wikipedia um so I'll go really briefly on like what people do um I can answer some questions but I mean data is on its own is a huge topic uh basically first what you do is download all of Internet what that means is that you use uh web crowlers that will go on every web page on Internet or every web page that is um on Google uh and that is around 250 billion pages right now um and that's
around one petabyte of of data so this is actually a common common C is one web crowler so people will usually write their own web crowlers what they do is that they use standard web crowlers and we common crawl is one of them uh that basically every month adds all the new websites that were added on uh internet that are found by by Google and they put it in a big uh basically a big data set um so that's on common call you have around 250 billion pages right now so 1 E6 gigabytes of data once you have this uh so this is a random web page like literally random uh from this common craw and what you see is that one it really doesn't look at type of things that you would usually see but actually so this is an HTML page uh it's hard to see but if you look through you will see some content for example here here uh tesing world is your ultimate source for the system X high performance server and then you have three dots so you don't
even the sentence is not even finished that's how a random internet looks like uh so of course it's not that useful if you just train a like large language model to generate things like this so what are some of the steps that are needed first one you extract the text from the HTML so that's what I just try to do by looking at uh basically the correct text uh there are a lot of challenges by through this for example extracting math is actually very complicated but pretty important for training large language models um or for example boiler plates a lot of your forums will have the same type of headers the same type of Footers uh you don't want to repeat all of this in your data um then you will filter undesirable content uh so not safe for work harmful content pii uh so usually every company has basically a a black list of websites that they don't want to train the models on that Black List is very long and you basically say if it comes from there we
don't train on this there are other ways of doing these things is that you can train a small model for classifying what is pii removing these things um it's hard every Point here that I'm going to show you is like a hard amount of work uh but I'm going to go go quickly through it so filter undesirable content second or fourth is the dup D duplication as I said um you might have things like headers and Footers in forums that are always the same you want to remove that another thing that you
might have is a lot of URLs that are different but actually show the same website um and you might also have a lot of like U um paragraphs that come from like common books that are basically duplicated a thousand times or 10,000 times on internet so you have to duplicate also very challenging uh because you have to do that at scale once you do duplication you will do some heuristic filtering you will try to remove low quality documents uh the way you do that are things like rules-based um filtering for example if you see that there are some outlier tokens if the distribution of tokens in the website is very different than the usual distribution of tokens then it's probably some outlier if you see that the length of the words in this website is super long there's something strange going on on that website if you see that the the website has only three words maybe is it worth training on it maybe not if it has like 10 million words maybe there's something also
wrong going on that page um so a lot of rules like this yes why we filter out undesirable content from our dat set instead of kind of putting it in is like a supervised loss right like can we not just say like you know here's this like hate speech website let's actively try to Let's actively penalize the for generating we'll do exactly that but not at this step that's where the posttraining will come from uh pre-training um the idea is just to say I want to model kind of how
humans speak essentially um and I want to remove all these like headers photos and and menus and things like this but it's a very good uh like idea that you just had and that's exactly what we'll do later Next Step modelbased filtering so once you filtered a lot of data what you will do uh that's actually a very cute trick uh you will take all of Wikipedia and you will look at all the links that are linked through Wikipedia p because probably if something is referenced by Wikipedia it's probably some high quality website and you will train a classifier to predict whether something comes from whether a document comes from one of these references uh from Wikipedia or whether it's from the random web and you will try to basically say I want more of the things that come from Wikipedia references does that make sense so yeah so you will train a a machine learning uh model usually also very simp simple models because you need to do that really at scale I mean just think about the 250 billion
Pages uh next one you will try to classify your data into different different um domains you will say okay this is entertainment this is books this is code this is like these type of domains and then you will try to either um up or down weight some of the domains uh for example you might say uh you might see that actually if you train more on code then actually your model becomes bettered on reasoning so that's something that people usually say in a very handwavy way if you train your
model more code actually it helps reasoning so you want to upweight the coding uh distribution because that helps for General language modeling skills uh books is usually also another one that people usually um upweight entertainment they usually downweight uh so things like this of course you want to do it so people used to do it maybe uh kind of theistically now there's entire pipelines that we'll talk about of how to do these things uh slightly more um automatically and then at the end of
training uh usually train um after training on all of this data that we saw usually train on very high quality data at the end of of training your large language model where you decrease your learning rate uh and that basically means that you're kind of overfitting your model on a very high quality data so usually what you do there is like Wikipedia you basically overfit on Wikipedia yeah and you overfit on like human uh data that was collected um the other things like continual pre-training
for getting longer context I'm I'm going to skip over all of these things uh but I just to give you a sense of how hard it is when people just say oh I'm going to train on internet that's a lot of work um and really we haven't figured it out yet so collecting World data is a huge part of practical large language model uh some might say it's actually the key yes about data so basic question so usually when you start with like the terabyte of data after I go through all that steps the typical amount of data you have in and then like how how large a team does it typically think to go through all the steps you talk about so how is the question how large is the data after you filter yeah after you filter and then to go through all the step how large a team do you need to go through like the the other fation sttion uh how slow is it or how like how how many people would you need to be able to do this uh okay that's a great question I'm going to
somewhat answer about the data uh how large is the data set uh at the end of this slide uh for number of people that work on it um that's a good question I'm actually not quite sure but I would say yeah I actually don't quite no but I would say it's probably even bigger than the number of people that work on kind of the two tuning of the pre-training of the model uh so the data is bigger than kind of the modeling aspect um yeah I I don't think I have a good sense I would
say probably in Lama's team which have like 70 years people I would say maybe 15 work on data uh I yeah all these things you don't need that many people you need a lot of computer so because for data you need a lot of CPUs um so yeah and I'll answer the second question at the end of this slide so as I just kind of alluded to really we haven't solved data at all for pre-training so there's a lot of research that that has to be done first how do you process these things super efficiently uh second how do you balance kind of like all of these different domains uh can you do synthetic data generation that's actually a big one right now uh and because we don't have uh we'll talk about that later we don't have enough data on the internet um can you use multimodal data instead of just text data and how does that improve even your text performance um there's a lot of seccy because really this is the key of most of the pre-train pre-trained large language models so for
competitive Dynamics uh usually these these um these companies don't talk about how they do the data collection and also there's a copyright liability issue they definitely don't want to tell you that they've trained on books even though they did um because if not you can uh sue them uh common academic benchmarks uh so that will kind of answer what you asked um it started so those are the smaller ones it's the names are not that important but it started from around 150 billion tokens which around uh 800 GB of data now it's around 15 trillion of to 15 trillion tokens which is also uh the size of the models that are right now the best models are probably trained on that amount of data so 15 trillion tokens uh which is probably I guess two order of manage bigger than that so 80 uh E3 gab so that would be around 100 to thousand times uh filtering of the common crawl if I'm not mistaken um so yeah one very one very uh famous one is the pile so this is
academic Benchmark of the pile and we can just look at what distribution of data they have it's things like um archive PBM Central uh which is all the the biology stuff uh here it's Wikipedia you see stack exchange um some GitHub and some books and things like this um again this is on the smaller side so this is if we look at here this is on 280b so in reality it's like 100 times bigger so you cannot have that much of GitHub and and of Wikipedia um in terms of close Source
models just to give you an idea uh Lama 2 um it was trained on 20 two trillion tokens lamb 3 15 trillion tokens which is currently the best model that we know on how much it was trained on which is the same thing as this the the the best academic or the biggest academic Benchmark which is 15 trillion tokens GPD 4 we don't really know but it's probably in the same water of magnitude or it's probably around that actually it's probably around 13 um from leaks if the leaks are true um great so scaling laws um any other questions on Data before you go to scaling laws sorry I know I'm giving you a lot of information but uh there's a lot into training at large language models great scaling laws so so the idea is that what people saw um around 2020 or at least from a long time but they've been able to kind of theoretically show it or impurely show it since 2020 is that the more data you train your models on and the larger the models the better the

Ask anything
We've read this whole study set, so questions about it get the best answers.