The user wants a plan for a meta-learning benchmark harness.
This harness needs to cover three specific areas:
Few-shot splits: How to handle data division for meta-training, meta-validation, and meta-testing (specifically N-way K-shot tasks).
Metrics: How to evaluate performance (accuracy, confidence intervals, speed, etc.).
Reproducibility: How to ensure experiments can be repeated reliably (seeds, versioning, logging).
I need to structure this plan logically, likely starting with the high-level architecture, then diving into each component (Data, Models, Evaluation, Infrastructure).
1. High-Level Architecture:
A modular design is best. We need a DataHandler, a TaskSampler, a MetaLearner (the model), a Trainer, and an Evaluator.
It should be framework-agnostic (or support PyTorch/JAX) but generally implies a Python-based stack.
2. Component 1: Data & Splits (The "Few-Shot" aspect)
Standard Datasets: Omniglot, Mini-ImageNet, Tiered-ImageNet, Meta-Dataset, CUB-200.
Splitting Logic:
Episodic splitting: Unlike standard ML, we split classes, not just instances.
Standard splits: 64/16/20 (Mini-ImageNet) or 96/12/17 (Tiered).
Cross-validation: Ensure no data leakage between support and query sets.
Task Sampling:
N-way K-shot configuration.
Support set vs. Query set construction.
Imbalanced settings (optional but good for robustness).
3. Component 2: The Meta-Learning Algorithms (The "Learner")
The harness should standardize the interface (e.g., forward(support, query)).
4. Component 3: Metrics & Evaluation
Primary Metric: Accuracy (Top-1).
Statistical Significance: Standard Deviation, Confidence Intervals (95% CI).
Convergence: Learning curves (meta-training steps vs. validation accuracy).
Generalization: In-domain vs. Out-of-domain (cross-domain few-shot).
Efficiency: Inference time, parameter count, FLOPS, Backprop steps.
5. Component 4: Reproducibility (The "Science" aspect)
Seeding: Global random state setting (numpy, torch, python random).
Configuration: Use Hydra or YAML/JSON configs. Version control configs.
Logging: Weights & Biases (W&B), TensorBoard, or MLFlow.
Docker/Environment: Containerization or requirements.txt with strict versioning.
6. Proposed Project Structure (Directory Layout)
data/: Downloading and processing.
samplers/: N-way K-shot logic.
models/: Algorithm implementations.
engine/: Training loops (episodic vs. batch).
utils/: Logging, metrics.
7. Implementation details / Pseudocode:
Show a generic Task object structure.
Show the evaluation loop logic.
Refining the Plan:
The user asked for a "benchmark harness." This implies code structure + methodology. I should present it as a design document or a blueprint.
Key challenges to address:
Data Leakage: The most common error in few-shot learning (e.g., double dipping classes between splits).
Variance: Few-shot results are notoriously high variance due to small sample sizes. The harness must run hundreds of episodes to get a stable mean. I need to emphasize this.
MAML vs. ProtoNet: Optimization-based methods require different training loops (meta-update) compared to metric-based (standard gradient descent). The harness needs an abstract Trainer class.
Drafting the Response Structure:
Executive Summary: Goal and Scope.
Core Architecture: The "Engine" design.
Data Pipeline (The Splits): Class splitting, episodic batching.
Let's flesh out the "Splits" section. It's crucial to distinguish between the "Meta-Split" (Train/Val/Test classes) and the "Episode-Split" (Support/Query images).
Let's flesh out "Reproducibility". Deterministic algorithms in CuDNN are important here.
Self-Correction during thought process:
Should I write code? Yes, a skeleton is helpful.
Should I list specific datasets? Yes, as examples.
Focus on meta-learning specific issues, not just general ML benchmarking. The "Episodic" nature is the defining feature.
Final check of the prompt: "Plan a meta-learning benchmark harness covering few-shot splits, metrics, and reproducibility."
Okay, I will structure the response as a comprehensive design specification.
Outline:
Architecture Overview
Data Module (Splits & Sampling)
Evaluation Protocol (Metrics)
Reproducibility & Infrastructure
Project Structure
Code Interface Example
Let's write it.
This plan outlines the architecture for a robust, extensible Meta-Learning Benchmark Harness. This system is designed to evaluate Few-Shot Learning (FSL) algorithms (like MAML, Prototypical Networks, or Matching Networks) rigorously.
The harness prioritizes three pillars: Episodic Data Integrity, Statistical Rigor, and Full Reproducibility.
1. High-Level Architecture
The system is composed of four decoupled modules:
Data Curator: Handles dataset downloading, preprocessing, and class-wise splitting.
Evaluation Engine: Runs the training/test loops and collects metrics.
Experiment Manager: Handles seeding, logging, and configuration.
2. Data Module: Few-Shot Splits
In meta-learning, data leakage occurs if classes (not just images) overlap between training and testing. The harness must enforce strict class separation.
A. The Split Strategy (Meta-Split)
Standard machine learning splits images; Meta-Learning splits classes.
Mechanism:MetaSplit(ClassSplit)
Logic:
Meta-Train: Contains classes Ctrain and all associated images.
Meta-Val: Contains classes Cval (disjoint from ). Used for hyperparameter tuning (e.g., learning rates, inner-loop steps).
B. The Episodic Sampler (Task Construction)
The core unit of meta-learning is the Episode, not the batch.
Configuration:
$N$-way: Number of classes per episode.
$K$-shot (Support): Number of examples per class for the inner loop (training).
$Q$-query: Number of examples per class for the outer loop (testing).
Algorithm:
Sample N classes from the current split (e.g., Meta-Test).
For each class, sample K+Q images without replacement.
Split into Support SetD and .
3. Evaluation Module: Metrics & Protocols
Standard accuracy is insufficient. We need confidence intervals and robustness checks.
A. Core Metrics
Mean Episode Accuracy: The primary scalar metric.
Acc=M1∑i=1 (where is total test episodes).
B. Evaluation Protocols
The harness should support multiple testing scenarios:
Transductive: The model sees the Support Set and the unlabelled Query Set simultaneously (common in Semi-Supervised FSL).
Inductive: The model only sees the Support Set during adaptation.
Cross-Domain: Train on source domain (e.g., MiniImageNet), test on target domain (e.g., CUB-200) without meta-training on the target.
4. Reproducibility Module
The "Reproducibility Crisis" in FSL often stems from different data augmentation or floating-point non-determinism.