How does Active Learning pick which data to label?
- Authors
- Name
- Amit Shekhar
- Published on
Active Learning picks which data to label by letting the model choose the examples it is most unsure about, so we label only the most useful data instead of everything.
In this blog, we will learn about how Active Learning picks which data to label. We will also see why labeling everything is wasteful, how the model itself helps choose the most useful examples, the exact strategies used to pick them, and when to use it.
We will cover the following:
- What is Active Learning?
- The problem Active Learning solves
- How the picking loop works
- Strategy 1: Uncertainty Sampling
- Strategy 2: Margin Sampling
- Strategy 3: Entropy Sampling
- Strategy 4: Query by Committee
- Strategy 5: Diversity Sampling
- A simple walkthrough with numbers
- When to use Active Learning
I am Amit Shekhar, Founder @ Outcome School, I have taught and mentored many developers, and their efforts landed them high-paying tech jobs, helped many tech companies in solving their unique problems, and created many open-source libraries being used by top companies. I am passionate about sharing knowledge through open-source, blogs, and videos.
I teach AI and Machine Learning at Outcome School.
Let's get started.
What is Active Learning?
A model learns from examples that already have the correct answer attached. That correct answer is called a label.
A normal model learns in a passive way. We hand it a big pile of labeled data, and it simply learns from whatever we gave it. The model has no say in what it learns from.
Active Learning is different. Here, the model actively chooses which examples it wants labeled next.
Let's say the model raises its hand and says, "Please label this example for me, because this one will help me learn the most." It points at the most useful examples and asks a human to label only those.
This way, a human labels far fewer examples, and the model still becomes very good.
The problem Active Learning solves
Adding labels is slow and expensive, because a human has to look at each example and write down the answer.
Suppose we have one million photos. We want a strong cat-versus-dog model. Labeling all one million photos by hand would take a team many months and cost a lot of money.
Not every photo is equally useful for learning.
Some photos are very clear. A photo of an obvious cat sitting in good light teaches the model almost nothing new, because the model already gets these right.
Some photos are confusing. A blurry photo of a fluffy animal that could be either a cat or a dog is very useful, because the model is unsure about it. When a human labels this confusing photo, the model learns a lot.
So, the naive idea is to pick random photos to label.
The problem with this naive idea is that most random photos are the easy, clear ones. We would waste human effort labeling examples the model already understands.
We needed a better idea, and Active Learning was created to solve this problem.
The better idea is this. We must label the examples that the model is most confused about, because those are the examples it learns the most from.
Now, the question is: how does the model know which examples it is confused about? Let's see.
How the picking loop works
Active Learning works as a loop that repeats again and again. Let's walk through the loop step by step.
Step 1: We start with a small set of labeled examples. We label just a few hundred examples by hand to begin.
Step 2: We train a model on this small labeled set. The model will not be great yet, but that is fine.
Step 3: We let this model look at all the unlabeled examples. For each unlabeled example, the model makes a guess and also tells us how confident it is about that guess.
Step 4: We pick the examples the model is most unsure about. This picking is the heart of Active Learning, and we will study the exact strategies next.
Step 5: We send only those picked examples to a human to label.
Step 6: We add these freshly labeled examples to our labeled set.
Step 7: We go back to Step 2 and train again with the bigger labeled set.
We repeat this loop until the model is good enough or until we run out of budget.
Let's see the loop as below:
+-------------------------------+
| Small set of labeled data |
+-------------------------------+
|
↓
+------------------+
| Train the model |
+------------------+
|
↓
+-------------------------------+
| Model looks at unlabeled data |
| and gives guess + confidence |
+-------------------------------+
|
↓
+-------------------------------+
| Pick the most confusing ones |
+-------------------------------+
|
↓
+-------------------------------+
| Human labels only those |
+-------------------------------+
|
↓
+-------------------------------+
| Add them to the labeled set |
+-------------------------------+
|
+------> go back to "Train the model"
Here, we can see that the picking and the training keep going round and round. Each time, only the most confusing examples are sent to a human, and the labeled set slowly grows. Round after round, the model gets better while a human labels as few examples as possible.
Planning your move into AI?
No matter which tech domain you work in today, with your effort, you can transition to these roles:
- AI Engineer
- Forward Deployed Engineer
- AI Agent Engineer
- Harness Engineer
- Voice AI Engineer
- AI Architect
- LLM Engineer
- LLM Inference Engineer
- Gen AI Engineer
- MLOps Engineer
- ML Engineer
- Deep Learning Engineer
Our AI and Machine Learning Program at Outcome School takes you there.
Now, the key part is Step 4. How exactly do we pick the most confusing examples? Let's learn the strategies one by one.
Strategy 1: Uncertainty Sampling
This is the simplest and most popular strategy.
Before we explain it, we must understand one thing about how a model answers.
When a model looks at a photo, it does not just say "cat". It gives a number for each possible answer. This number is called a probability, and it tells us how likely the model thinks each answer is. All the probabilities add up to 1, which means 100 percent. We have a detailed blog on the Softmax Function that explains how a model turns its raw scores into these probabilities.
For example, the model may say "70 percent cat, 30 percent dog". This means the model is fairly sure it is a cat.
Or the model may say "52 percent cat, 48 percent dog". This means the model is almost flipping a coin. It is very unsure.
Uncertainty Sampling picks the examples where the model's top answer has the lowest confidence.
So, we look at the highest probability for each example, and we pick the examples where even that highest probability is low.
A model that says "52 percent cat" is barely confident. That is exactly the example we want a human to label, because the model clearly needs help with it.
So, Uncertainty Sampling picks the examples where the model's best guess is still a weak guess.
Strategy 2: Margin Sampling
Uncertainty Sampling only looks at the single highest probability. But sometimes that is not enough information.
Margin Sampling looks at the gap between the top two answers.
We take the probability of the most likely answer and subtract the probability of the second most likely answer. That difference is called the margin.
A small margin means the top two answers are very close, so the model is torn between them. A large margin means the top answer wins clearly, so the model is confident.
Let's see this with two examples.
Example A: 60 percent cat, 38 percent dog, 2 percent rabbit. The margin is 60 minus 38, which is 22.
Example B: 45 percent cat, 44 percent dog, 11 percent rabbit. The margin is 45 minus 44, which is 1.
Here, we can see that Example B has a tiny margin. The model can barely tell cat from dog here. So, Margin Sampling picks Example B for labeling.
This strategy is very useful when there are more than two possible answers, because it focuses on the two answers that are actually competing.
A quick note for you
No matter which tech domain you work in, get familiar with these topics:
- LLM
- RAG
- MCP
- Agent
- Fine-tuning
- Quantization
We put it all together in one video:
AI Engineering Explained: LLM, RAG, MCP, Agent, Fine-Tuning, and Quantization
No need to stop reading - bookmark it and watch later when you get time. Future you will thank you.
Now, let's get back to the topic.
Strategy 3: Entropy Sampling
Now, let's say we have many possible answers, not just two or three. For example, a model that sorts animals into ten different types.
Margin Sampling only looks at the top two answers. But when there are many answers, we want a measure that looks at all of them together.
So, here comes Entropy to the rescue.
Entropy is a number that measures how spread out the probabilities are. We need only the idea here, not the math.
When the model is very sure, almost all the probability sits on one answer. The probabilities are not spread out. Entropy is low.
When the model is very confused, the probability is spread evenly across many answers. The probabilities are very spread out. Entropy is high.
Entropy Sampling picks the examples with the highest entropy, which means the examples where the model spread its bets across many answers.
Let's compare two examples with three possible answers.
Example A: 90 percent cat, 7 percent dog, 3 percent rabbit. The model is sure. Entropy is low.
Example B: 34 percent cat, 33 percent dog, 33 percent rabbit. The model is totally confused. Entropy is high.
Here, Entropy Sampling picks Example B, because the model's confusion is spread across all three answers.
So, entropy is a single number that captures total confusion across all answers.
Strategy 4: Query by Committee
So far, we used a single model to decide what is confusing. But one model can be wrong about its own confusion. We can do better.
Query by Committee uses several models instead of one. This group of models is called the committee.
The idea is simple. We train a few different models on the same labeled data. Because they are trained slightly differently, they will not always agree with each other.
For each unlabeled example, we ask every model in the committee to vote.
If all the models agree, the example is easy. There is nothing to learn from it.
If the models disagree strongly, the example is confusing and valuable. The disagreement itself is a signal that this example is hard.
So, Query by Committee picks the examples where the committee members disagree the most.
Let's say we have five models. For one photo, three say cat and two say dog. That is heavy disagreement. We send this photo to a human to label.
For another photo, all five say cat. There is full agreement. We skip it.
This way, disagreement among models points us to the most useful examples.
Strategy 5: Diversity Sampling
All the strategies above focus only on confusion. But focusing only on confusion can create a hidden problem.
Suppose all the confusing examples look almost the same. For example, the model is confused about a hundred blurry photos that are all very similar to each other.
If we label all hundred, we are basically labeling the same kind of example a hundred times. That is wasteful. The model does not need a hundred copies of the same lesson.
So, here comes Diversity Sampling into the picture.
Diversity Sampling tries to pick examples that are different from each other. It spreads the picks across many different kinds of data, so the model sees variety.
Instead of picking a hundred similar confusing photos, we pick a smaller mix that covers many different situations. We may pick a few blurry indoor photos, a few outdoor photos, a few photos with strange lighting, and so on.
This way, every labeled example teaches the model something new.
In real systems, we often combine Diversity Sampling with the confusion strategies above. We want examples that are both confusing and different from each other. This combination gives us the most learning for the least labeling effort.
Stay updated: Subscribe to our newsletter to get our latest AI and Machine Learning blogs straight to your inbox.
A simple walkthrough with numbers
Let's tie everything together with a small example.
Suppose we have 10,000 photos and a labeling budget for only 1,000 of them. We want the best possible cat-versus-dog model.
Round 1: We label 200 photos by hand. We train a first model on these 200. This model is weak but usable.
Round 2: We let the model look at the remaining 9,800 unlabeled photos. For each one, the model gives probabilities like "61 percent cat, 39 percent dog".
Now, we apply a strategy. Let's use Margin Sampling. We compute the margin for every photo. A photo with "51 percent cat, 49 percent dog" has a margin of 2, which is tiny. A photo with "97 percent cat, 3 percent dog" has a margin of 94, which is large.
We sort all photos by margin, from smallest to largest. The smallest margins sit at the top, because those are the most confusing photos.
We pick the top 200 most confusing photos and send them to a human to label. We now have 400 labeled photos, the first 200 plus the 200 new ones. We train the model again on all 400. The model improves, especially on the kind of photos it was confused about.
Rounds 3 to 5: We repeat this loop. Each round, the model picks the next 200 most confusing photos, a human labels them, and the model retrains.
After five rounds, we have labeled 1,000 photos, and our budget is finished.
Let's see how the labeled set grows each round as below:
Round 1: label 200 by hand -> total labeled = 200
Round 2: pick 200 confusing -> total labeled = 400
Round 3: pick 200 confusing -> total labeled = 600
Round 4: pick 200 confusing -> total labeled = 800
Round 5: pick 200 confusing -> total labeled = 1000 (budget done)
Here, we can see that after the first round, every new batch of 200 photos is chosen by the model itself. The model always picks the most confusing photos, so each batch teaches it the most.
These 1,000 photos were not random. They were chosen by the model itself as the most useful ones. A model trained on these carefully chosen 1,000 photos is often better than a model trained on 1,000 random photos. We spent the same labeling budget but got a stronger model.
To learn Supervised and Unsupervised Learning, Model Development and Training, and Evaluation and Testing in depth, check out our AI and Machine Learning Program at Outcome School.
When to use Active Learning
Now, let's see when Active Learning is the right tool to use.
Active Learning is most useful when we have a large amount of unlabeled data but labeling is expensive or slow.
Here are some good situations:
- Labeling needs an expert. For example, a doctor labeling medical scans. Expert time is costly, so we must label only the most useful scans.
- We have millions of unlabeled examples but only a small budget to label them.
- New, confusing data keeps arriving, and we want the model to focus on the parts it does not understand yet.
Active Learning is not the best choice in a few cases:
- If labeling is cheap and fast, we can just label a lot of data and skip the extra effort.
- If our dataset is already small and fully labeled, there is nothing to pick.
So, when labels are expensive and unlabeled data is plentiful, Active Learning helps us spend our labeling effort where it matters the most. We have a detailed blog on Semi-Supervised Learning that covers another way to make the most of a little labeled data and a lot of unlabeled data.
Frequently Asked Questions
Why not just pick random examples to label?
Because most random examples are the easy, clear ones that the model already gets right, so labeling them wastes human effort. Active Learning picks the examples the model is most confused about instead. A model trained on 1,000 photos chosen this way is often better than a model trained on 1,000 random photos, for the same labeling budget.
What is the difference between Uncertainty Sampling and Margin Sampling?
Uncertainty Sampling looks only at the single highest probability and picks the examples where even that top answer has low confidence. Margin Sampling looks at the gap between the top two answers and picks the examples where that gap is tiny. Margin Sampling is very useful when there are more than two possible answers, because it focuses on the two answers that are actually competing.
Why combine Diversity Sampling with the confusion strategies?
Because the most confusing examples can all look almost the same. Labeling a hundred similar blurry photos teaches the model the same lesson a hundred times, which is wasteful. Diversity Sampling spreads the picks across many different kinds of data, so we get examples that are both confusing and different from each other, which gives the most learning for the least labeling effort.
When do we stop the Active Learning loop?
We stop the loop when the model is good enough or when we run out of labeling budget. Each round, the model picks the most confusing examples, a human labels them, and the model retrains on the bigger labeled set. For example, with a budget of 1,000 labels and 200 labels per round, we stop after five rounds.
That's it for now.
Thanks
Amit Shekhar
Founder @ Outcome School
You can connect with me on:
Follow Outcome School on:
