Active Learning: Train Good Models with Less Data

Which examples should you label when you can't label them all? Active learning lets the model pick its most informative examples. This guide covers uncertainty and diversity sampling, hybrid strategies like BADGE, the practical human-in-the-loop cycle, cold-start handling, and the random baseline you must beat.

Written by Projectech6 min readPublished
For B.E./B.Tech Computer Science and AI/ML students with large unlabeled datasets and limited labeling time who want maximum model quality per labeled example Topics: Active Learning, modAL, PyTorch, scikit-learn
Illustration of active learning showing a model selecting the most uncertain unlabeled examples from a large pool for a human to label, in a feedback loop.
Illustration generated for this guide.
In this guide

You have 50,000 unlabeled images and time to label 2,000. Which 2,000? Random sampling is the default answer — and it wastes most of your budget on examples the model would have gotten right anyway. Active learning is the systematic alternative: let the model tell you which examples it is most uncertain about, label those, and retrain. Each label then carries maximum information.

This guide explains the core strategies (uncertainty, diversity, and hybrids), the practical loop, when active learning actually helps, and the pitfalls that make naive implementations fail.

The core idea

Not all labeled examples are equally valuable. A model already 99% confident on easy examples learns almost nothing from their labels; an example where it is torn 51/49 between two classes teaches it the decision boundary. Active learning exploits this:

  1. Train on a small initial labeled set.
  2. Score the unlabeled pool by informativeness.
  3. Label the top-k most informative examples.
  4. Retrain, repeat.

Well-executed active learning routinely reaches a target accuracy with a fraction of the labels random sampling needs — published results commonly show 30–60% label savings on standard benchmarks, though your mileage depends on the task and strategy.

Note: Active learning optimizes which examples to label. It does not improve the labeling process itself — pair it with the discipline in the data labeling guide.

Strategy 1: uncertainty sampling

Query the examples the current model is least sure about. Three common uncertainty measures:

Measure Formula intuition Character
Least confident 1 − max class probability Simple; can favor outliers
Margin Difference between top-2 probabilities Focuses on the decision boundary
Entropy −Σ p log p over classes Considers the full distribution
import numpy as np

probs = model.predict_proba(unlabeled_X)   # shape (n_samples, n_classes)
entropy = -(probs * np.log(probs + 1e-10)).sum(axis=1)
query_idx = np.argsort(entropy)[-batch_size:]  # most uncertain first

Uncertainty sampling is easy to implement and often effective. Its weakness: it can fixate on outliers and noisy examples — the model is "uncertain" about garbage inputs too, and labeling garbage teaches little.

Strategy 2: diversity sampling

Query examples that cover the data space well — representative of different regions, not just the uncertain ones. Methods include clustering the unlabeled pool (k-means on embeddings) and sampling from each cluster, or core-set selection (pick points that cover the space most evenly).

Diversity avoids the outlier trap and the redundancy trap (uncertainty sampling can query 50 near-identical uncertain examples). Its weakness: it may spend labels on easy, already-understood regions.

Strategy 3: hybrids (what works most reliably)

In practice, the winners combine both:

  • Uncertainty + diversity: cluster uncertain examples and pick one per cluster — uncertain AND non-redundant.
  • BADGE: selects examples with diverse, high-magnitude gradient embeddings — uncertainty and diversity in one criterion. A strong default for deep learning.
  • Expected model change: query examples that would change the model most. Principled, expensive to compute.

For a student project, start with margin-based uncertainty sampling on top of embedding-space clustering. It is simple, fast, and captures most of the benefit.

The practical loop

Initial: label 200-500 random examples (seed set)
Repeat:
  1. Train model on labeled set (or fine-tune from previous checkpoint)
  2. Score unlabeled pool with your strategy
  3. Label the top 100-300 (human in the loop)
  4. Evaluate on a FIXED held-out test set
  5. Stop when accuracy plateaus or budget runs out

Critical details:

  • The test set must be fixed and representative — labeled once, upfront, by your most careful process. If you evaluate on actively-selected examples, you are measuring the wrong thing.
  • Batch size matters. Querying one example at a time is optimal but impractical; batches of 100–300 balance efficiency and human workflow.
  • Retrain from scratch periodically. Fine-tuning from the previous checkpoint is faster but can accumulate bias; a fresh train every few rounds keeps results honest.
  • Track the learning curve (accuracy vs number of labels) against a random-sampling baseline. This curve is your evidence that active learning helped — log it in MLflow.

When active learning helps — and when it does not

Helps most when:

  • Labeling is expensive relative to training (medical images, expert annotation, video).
  • The unlabeled pool is large and redundant (surveillance footage, scraped images).
  • Classes are imbalanced — uncertainty sampling naturally surfaces rare-class examples.

Helps little when:

  • The dataset is small enough to label fully anyway — just label it.
  • Labels are cheap (simple image classification by anyone) — random sampling plus more labels wins on simplicity.
  • The model is badly miscalibrated early — uncertainty scores are meaningless from a random model, so the seed set must be large enough to train something reasonable first.
  • You need a fixed, auditable dataset — active learning produces a biased sample by design, which complicates some evaluation claims.

Note: Active learning introduces sampling bias by construction — your labeled set is not representative of the data distribution. That is fine for training, but be careful about claims like "accuracy on the labeled set" as a deployment estimate. Always evaluate on an independently sampled test set.

Cold start: the seed set problem

The first model trains on the seed set, and a bad seed set poisons everything after. Guidelines:

  • 200–500 examples, randomly sampled but stratified by class (use cheap heuristics or clustering to ensure rare classes appear).
  • Verify the seed model beats chance comfortably before starting the loop. If it does not, the uncertainty scores are noise — grow the seed set.
  • For deep learning, start from a pretrained backbone (transfer learning) so even the seed model is reasonable.

Common mistakes

  • No random baseline. Without comparing against random sampling, you cannot claim active learning helped. Always run the baseline.
  • Evaluating on the queried set. The actively selected examples are the hardest ones — accuracy on them understates true performance. Use the fixed test set.
  • Querying outliers. Pure uncertainty sampling on noisy real-world data burns budget on unlabelable junk. Add a diversity filter or a quick human "is this labelable" check.
  • Tiny batches, constant retraining. Retraining a deep model for every 10 labels wastes compute; batch queries in the hundreds.
  • Forgetting the human loop cost. Active learning needs a labeler on standby each round. If labeling happens in one big push anyway, the loop structure may not fit your timeline — consider doing 2–3 large rounds instead of 20 small ones.
  • Stopping too early. The curve often jumps in later rounds as the boundary sharpens. Budget for at least 4–5 rounds before judging.

Libraries that implement this

Library Notes
modAL scikit-learn compatible, clean API for classic ML
ALiPy Research-oriented, many strategies
Hand-rolled For deep learning, the loop above with your own scoring is often simplest

For deep image/text projects, hand-rolling the loop around your existing training code is usually less work than adapting a library to your pipeline.

Where to go from here

Active learning sits inside the broader labeling workflow — read data labeling strategies for schema design and agreement measurement. For the modeling side, see fixing overfitting (small labeled sets overfit easily) and data augmentation to multiply what you label. Track the label-efficiency curve in MLflow. More training-efficiency topics in the AI & Machine Learning branch hub.