Course contentsShow
← Machine Learning and Deep Learning
Lesson 2586 of 3,53856. Few-Shot and Meta-LearningFree lesson

Episode-Based Training

Learning how few-shot models are trained using episodes that simulate few-shot scenarios.

Episode-Based Training

What you'll learn: How few-shot learning models are trained by simulating the same few-shot scenarios they'll face at test time.

The Core Idea

In traditional supervised learning, you train on a large dataset with fixed classes. But few-shot models need to learn how to learn quickly from limited examples. Episode-based training solves this by structuring each training batch as a mini few-shot problem—called an "episode."

During each episode:

  1. Randomly sample N classes from your training set
  2. For each class, randomly pick K examples as the support set
  3. Pick additional examples from the same N classes as the query set
  4. Train the model to classify the query set using only the support set

This happens thousands of times with different random episodes, forcing the model to develop a general strategy for learning from few examples rather than memorizing specific classes.

Why This Works

Think of it like training a doctor: you don't just have them memorize diseases from textbooks. Instead, you give them hundreds of unique clinical cases where they must diagnose patients based on just a few similar examples. Each case (episode) teaches them the process of diagnosis, not just the diseases themselves.

The beauty is that at test time, when the model sees entirely new classes, it applies the same learned strategy: compare the query example to the support examples and make an informed prediction.

Training vs Testing Alignment

Episode-based training ensures meta-train and meta-test conditions match. If your model will do 5-way 1-shot classification at deployment, you train it on 5-way 1-shot episodes. This alignment is critical for few-shot success.

Key Takeaway: Episode-based training transforms few-shot learning into a meta-learning problem by repeatedly simulating few-shot scenarios during training, teaching models to generalize from limited examples rather than memorizing classes.