Large Language Models explained briefly — Transcript
Full transcript
- 0:01[Submit subtitle corrections at criblate.com] Imagine you happen across a short movie script that
- 0:03describes a scene between a person and their AI assistant.
- 0:07The script has what the person asks the AI, but the AI's response has been torn off.
- 0:13Suppose you also have this powerful magical machine that can take
- 0:16any text and provide a sensible prediction of what word comes next.
- 0:21You could then finish the script by feeding in what you have to the machine,
- 0:25seeing what it would predict to start the AI's answer,
- 0:28and then repeating this over and over with a growing script completing the dialogue.
- 0:33When you interact with a chatbot, this is exactly what's happening.
- 0:37A large language model is a sophisticated mathematical function
- 0:40that predicts what word comes next for any piece of text.
- 0:44Instead of predicting one word with certainty, though,
- 0:47what it does is assign a probability to all possible next words.
- 0:51To build a chatbot, what you do is lay out some
- 0:54text that describes an interaction between a user
- 0:56and a hypothetical AI assistant, you add on whatever
- 0:59the user types in as the first part of
- 1:02the interaction, and then have the model repeatedly predict the next word that such a
- 1:07hypothetical AI assistant would say in response, and that's what's presented to the user.
- 1:13In doing this, the output tends to look a lot more natural if
- 1:16you allow it to select less likely words along the way at random.
- 1:20So what this means is even though the model itself is deterministic,
- 1:23a given prompt typically gives a different answer each time it's run.
- 1:28Models learn how to make these predictions by processing an enormous amount of text,
- 1:32typically pulled from the internet.
- 1:34For a standard human to read the amount of text that was used to train GPT-3,
- 1:39for example, if they read non-stop 24-7, it would take over 2600 years.
- 1:44Larger models since then train on much, much more.
- 1:48You can think of training a little bit like tuning the dials on a big machine.
- 1:52The way that a language model behaves is entirely determined by these
- 1:56many different continuous values, usually called parameters or weights.
- 2:01Changing those parameters will change the probabilities
- 2:04that the model gives for the next word on a given input.
- 2:07What puts the large in large language model is how
- 2:10they can have hundreds of billions of these parameters.
- 2:15No human ever deliberately sets those parameters.
- 2:18Instead, they begin at random, meaning the model just outputs gibberish,
- 2:22but they're repeatedly refined based on many example pieces of text.
- 2:27One of these training examples could be just a handful of words,
- 2:30or it could be thousands, but in either case, the way this works is to
- 2:34pass in all but the last word from that example into the model and
- 2:38compare the prediction that it makes with the true last word from the example.
- 2:43An algorithm called backpropagation is used to tweak all of the parameters
- 2:47in such a way that it makes the model a little more likely to choose
- 2:51the true last word and a little less likely to choose all the others.
- 2:55When you do this for many, many trillions of examples,
- 2:58not only does the model start to give more accurate predictions on the training data,
- 3:03but it also starts to make more reasonable predictions on text that it's never
- 3:07seen before.
- 3:09Given the huge number of parameters and the enormous amount of training data,
- 3:13the scale of computation involved in training a large language model is mind-boggling.
- 3:19To illustrate, imagine that you could perform one
- 3:22billion additions and multiplications every single second.
- 3:26How long do you think it would take for you to do all of the
- 3:29operations involved in training the largest language models?
- 3:33Do you think it would take a year?
- 3:36Maybe something like 10,000 years?
- 3:39The answer is actually much more than that.
- 3:41It's well over 100 million years.
- 3:45This is only part of the story, though.
- 3:47This whole process is called pre-training.
- 3:49The goal of auto-completing a random passage of text from the
- 3:52internet is very different from the goal of being a good AI assistant.
- 3:56To address this, chatbots undergo another type of training,
- 4:00just as important, called reinforcement learning with human feedback.
- 4:04Workers flag unhelpful or problematic predictions,
- 4:07and their corrections further change the model's parameters,
- 4:11making them more likely to give predictions that users prefer.
- 4:14Looking back at the pre-training, though, this staggering amount of
- 4:18computation is only made possible by using special computer chips that
- 4:23are optimized for running many operations in parallel, known as GPUs.
- 4:28However, not all language models can be easily parallelized.
- 4:32Prior to 2017, most language models would process text one word at a time,
- 4:36but then a team of researchers at Google introduced a new model known as the transformer.
- 4:43Transformers don't read text from the start to the finish,
- 4:46they soak it all in at once, in parallel.
- 4:49The very first step inside a transformer, and most other language models for that matter,
- 4:54is to associate each word with a long list of numbers.
- 4:57The reason for this is that the training process only works with continuous values,
- 5:02so you have to somehow encode language using numbers,
- 5:05and each of these lists of numbers may somehow encode the meaning of the
- 5:09corresponding word.
- 5:10What makes transformers unique is their reliance
- 5:13on a special operation known as attention.
- 5:16This operation gives all of these lists of numbers a chance to talk to one another
- 5:21and refine the meanings they encode based on the context around, all done in parallel.
- 5:27For example, the numbers encoding the word bank might be changed based on the
- 5:31context surrounding it to somehow encode the more specific notion of a riverbank.
- 5:37Transformers typically also include a second type of operation known
- 5:41as a feed-forward neural network, and this gives the model extra
- 5:44capacity to store more patterns about language learned during training.
- 5:49All of this data repeatedly flows through many different iterations of
- 5:53these two fundamental operations, and as it does so,
- 5:56the hope is that each list of numbers is enriched to encode whatever
- 6:00information might be needed to make an accurate prediction of what word
- 6:04follows in the passage.
- 6:07At the end, one final function is performed on the last vector in this sequence,
- 6:11which now has had a chance to be influenced by all the other context from the input text,
- 6:16as well as everything the model learned during training,
- 6:19to produce a prediction of the next word.
- 6:22Again, the model's prediction looks like a probability for every possible next word.
- 6:28Although researchers design the framework for how each of these steps work,
- 6:32it's important to understand that the specific behavior is an emergent phenomenon
- 6:37based on how those hundreds of billions of parameters are tuned during training.
- 6:42This makes it incredibly challenging to determine
- 6:45why the model makes the exact predictions that it does.
- 6:48What you can see is that when you use large language model predictions to autocomplete
- 6:53a prompt, the words that it generates are uncannily fluent, fascinating, and even useful.
- 7:05If you're a new viewer and you're curious about more details on how
- 7:08transformers and attention work, boy do I have some material for you.
- 7:12One option is to jump into a series I made about deep learning,
- 7:16where we visualize and motivate the details of attention and all the other steps
- 7:20in a transformer.
- 7:22Also, on my second channel I just posted a talk I gave a couple
- 7:25months ago about this topic for the company TNG in Munich.
- 7:29Sometimes I actually prefer the content I make as a casual talk rather than a produced
- 7:33video, but I leave it up to you which one of these feels like the better follow-on.
About this transcript
This page contains the full transcript of Large Language Models explained briefly by 3Blue1Brown, generated from the public captions YouTube serves with the video. The transcript has 1,305 words across 117 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to choose a caption track available on the video.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.