This is a masterclass in technical communication that elegantly demystifies the complex transition from raw data ingestion to human-aligned intelligence. It provides a rare, authoritative clarity on the iterative process of shaping modern AI behavior.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
How are large language models trained?
Added:You might have heard people say things like large language models are trained on massive amounts of text or large language models predict the next token in a sequence. But what does any of that actually mean? How were large language models trained in practice? In this video, we'll walk through the steps it takes to train large language models that behave as helpful assistants, follow instructions, use tools, and just generally respond with the right kind of vibe. Step one is pre-training. During this phase, the model is trained on a task called next token prediction.
This essentially means the model is given a sequence of text and its task is to predict what comes next.
One of the advantages of model pre-training is that it's a type of self-supervised learning, meaning you don't need to go through the effort of labeling the whole training data set.
Instead, you take a lot of data from publicly available sources and you create the pre-training data set by chunking this data into inputs and outputs. For example, if this document about house plants was part of your pre-training data set, you could chunk it into a data set that looks something like this.
The model's training task is to correctly predict the next word in the sequence.
In order to do this effectively across a diverse set of inputs, the LLM implicitly learns patterns about language, writing styles, and even some world knowledge, like how the Monstera is an easy-to-care-for house plant.
While the labeling strategy isn't super complicated, what is complicated about pre-training is doing this at scale.
This phase of LLM training is a massive engineering challenge.
Because models are too large for a single chip, engineers must use complex parallelism to split the model and data across thousands of interconnected GPUs.
They also need to implement strategies for automated recovery systems to handle crashes and massive pipelines to pre-process the petabytes of training data.
But, if you do all of that successfully, you have a model that can take any prompt and use its vast world knowledge, understanding of language, and sense of how different kinds of documents work to produce a response.
Now, unless you're a developer who actually trains LLMs, it's unlikely you've interacted directly with a model that's only gone through pre-training.
Even though pre-trained models, particularly the more recent and sophisticated ones, are fairly capable, they can also be unpredictable and unaligned.
So, there's still a lot of work that needs to happen to get the LLM to be ready for use in a production environment. And that is where model post-training comes in.
Post-training is the phase where we refine model quality and focus on alignment so that the generated answers are safe, well-formatted, helpful, more accurate, and pleasant to engage with.
Often, post-training involves two different training strategies, supervised fine-tuning or SFT, and reinforcement learning or RL.
In SFT, we train the model on gold-standard interactions that demonstrate the behavior we want it to learn.
During RL, the model generates many answers and a separate reward model grades them.
The reward model gives points for helpful, safe, and accurate responses, pushing the model towards the behaviors we want, and penalizes responses we don't want. Let's dive into both of these in more detail. So, let's say you wanted the model to learn how to create a friendly, conversational response to a question like a helpful assistant. To do this, you might create a data set of prompts formatted as questions like, "How do I make gluten-free muffins and the corresponding answers that demonstrate the helpful assistant style.
During SFT, the model is fed the prompt, it produces a response, and then the loss is measured between the predicted response and the gold standard response, which is the label, and that's used to update the model's weights.
This is basically classic ML model training, and by showing the model these ideal examples, it learns how to produce responses in line with the behavior we care about.
You might follow a similar process for teaching the model how to use tools, creating a data set of prompts that require tools, and the syntax of the corresponding tool call.
Or you could use SFT for improving the model's ability to solve math problems or really any other capability you want the model to improve on.
Now, SFT is a good starting place, but it teaches the model to memorize what good looks like and doesn't always generalize to new, unseen variations of a task.
To do that, we need a mechanism for the model to practice producing good responses and receiving feedback, iterating and improving over time. And that is where RL comes in.
In RL, you have the model generate responses to prompts that are salient to the task you want the model to learn.
The model's responses are scored by a separate model called the reward model.
And based on the scores, the LLM updates its weights and improves over time.
How you train this reward model is out of scope for now, but there are resources in the description below that provide some more details.
One way of thinking about the differences between SFT and RL is that SFT sets the floor. It ensures that the model is at least competent. It understands the basic format of a list, a code block, or an answer to a question. RL raises the ceiling. SFT can only ever be as good as the curated training data, but RL allows the model to surpass this data by exploring millions of different ways to answer a prompt and keeping only the ones that get the highest scores, the model can find more efficient or clearer ways of responding to prompts than what was in the original SFT training set. In practice, the balance between SFT and RL is still an open question, and there's no standard ratio of how much to do either step.
But while the exact training recipe will differ between different state-of-the-art models, the high-level components are the same. And at least for now, that means some combination of SFT followed by RL.
So far, we've talked through the core components of how LLMs are trained. But there's one missing piece. How do we measure any of this?
Anytime we train a model, we need to have some way of quantifying how good the model is at the task we care about.
Are the experiments we're running actually improving the model's ability or just wasting valuable compute?
Measuring success in pre-training is fairly straightforward.
All we care about is whether the model is getting better at predicting the next word.
But while pre-training focuses on how well does the model predict the next word, post-training focuses on questions of alignment, like how well does the model follow instructions and behave like a safe, friendly, and helpful assistant.
And all of that can be a little harder to measure. For closed-domain problems like math or coding, you might test the model's abilities on a data set of problems and check if the model produced a correct answer.
This is the score you track towards to see if SFT and RL are actually improving the model skills. The more questions in your test data set that the model gets right, the better it's doing.
For measuring things like is the model being collaborative or insightful or helpful or any other task that's hard to quantify, you first need to have a clear definition of what those terms mean and what would constitute a good response.
For example, here's how you might define what it means for a model to be helpful.
When you have that defined, you can use this criteria to evaluate the model's response.
First, you curate a test set of relevant prompts.
In the case of helpfulness, pretty much any prompt could be considered relevant because we always want a model to respond in a helpful way.
But for measuring something like, "How funny is this model?" you'd want to make sure that your test set is made of prompts where you actually expect the model to respond in a humorous way.
You're not going to get a great signal on how good the model is if the test prompts have nothing to do with humor.
Once you have this test set of prompts, you pass it to the model you're evaluating and you get back responses.
You then score those responses against the criteria that you defined earlier.
In practice, you probably wouldn't do this completely manually. Instead, you would scale the process using a second LLM that works as a judge and does the scoring for you and have human spot-check the results.
This judge model, known as an auto rater, evaluates the LLM's responses to a prompt and scores it according to your criteria.
As you try out different data sets and training strategies, you'll use this evaluation to help you determine if you're on the right path and if the model is indeed getting better over time.
You still definitely want to spot-check the results and do more robust testing before deploying the model in production, but using an auto rater with a set of relevant prompts and defined criteria gives you a number that quantifies the model's ability and can be computed relatively quickly so you can track progress through post-training. Putting all of this together, we start with model pre-training where we train LLMs to do next token prediction on large amounts of text.
This initial training phase equips the model with a broad understanding of patterns, features, and relationships within the data.
Then, we take this pre-trained model and we apply post-training techniques where we refine the quality, consistency, and alignment of the model so that it responds as a conversational pleasant assistant with improved skills in areas such as reasoning or using tools. A lot of data, experiments, and compute later and we have a trained large language model.
Let me know in the comments what you want to learn about next. I'll read the research papers so you don't have to.
>> [music]
Related Videos

Expanding Stikbot thumbnails
leopoldshorts
2K views•2023-09-24

Digital Discrimination: Cognitive Bias in Machine Learning
redmonktechevents2974
4K views•2019-12-18

Evolutionary Approach to Clustering by Ujjwal Maulik
ICTStalks
279 views•2019-06-26

Rose Yu "Learning from Large-Scale Spatiotemporal Data"
networkscienceinstitute
2K views•2019-03-04

Stanford Seminar - Generalization through Task Representations with Foundation Models
stanfordonline
4K views•2025-07-14

Satellite-Based Wheat Yield Forecasting using GEE & Transformer Neural Network
gisrsinstitute
634 views•2025-06-15

Paradigm Shifts in Data Processing for the Generative AI Era: Robert Nishihara of Anyscale & Ray.io
GradientFlow
2K views•2025-01-02

How to Build Your Own GenAI-Based Knowledge Management System
2150GmbH
360 views•2025-06-03
Trending

2.4 BILLION Records Got Leaked...
DeepHumor
15K views•2026-07-22

Playstation NO DISC/NO BUY Fight Is Over...
DavidJaffeGames
4K views•2026-07-23

Should I buy a Sawmill?
essentialcraftsman
29K views•2026-07-22

Americans Confused in Australia for 17 Minutes Straight
IWrocker
17K views•2026-07-23