Hmm, the user is asking for a comprehensive meta-learning benchmark harness design. This is a technical request requiring structured thinking about evaluation frameworks. The user likely needs this for research or system development, so precision and reproducibility are key.
I should break this down into core components: dataset handling, few-shot splits, metrics, and reproducibility protocols. The response needs to be systematic but not overly verbose—just enough detail to be actionable.
Meta-learning benchmarks are notoriously tricky because of their stochastic nature and dataset biases. The user might be struggling with inconsistent results across papers, so emphasizing standardization and statistical rigor is important.
I recall popular frameworks like Meta-Dataset and LEOPARD, but the user wants a custom harness, not just a summary of existing ones. The response should blend best practices with flexible design principles. Reproducibility sections must include random seeds, logging, and hardware tracking—researchers often overlook these.
Metrics should distinguish between classification/regression and handle both within- and cross-domain performance. The user might not have considered hierarchical splits (e.g., by semantic similarity), so I should include that as an advanced option.
Finally, the implementation plan should balance simplicity with extensibility. A modular Python package with clear interfaces (like get_loader(), evaluate()) would help adoption. Open-sourcing the harness code is non-negotiable for reproducibility.
Excellent. Designing a robust meta-learning benchmark harness is crucial for fair, reproducible, and meaningful progress. Here is a comprehensive plan covering the core pillars you requested: Few-Shot Splits, Metrics, and Reproducibility, structured as a blueprint for a benchmark suite (akin to Meta-Dataset, LEOPARD, or Cross-Lingual NLI benchmarks).
Meta-Learning Benchmark Harness: "MetaHarness"
Core Philosophy: Standardize the entire experimental pipeline from data to reported metrics, isolating the algorithm as the only variable. Enforce rigorous statistical reporting and full code/data provenance.
1. Few-Shot Splits & Episode Construction
This defines the fundamental "tasks" the meta-learner must adapt to.
Split Type
Definition
Purpose
Implementation in Harness
N-way K-shot
Standard. N classes, K examples per class for support, Q query examples.
Support set from Dataset_A, query set from Dataset_B (unseen during base training).
Test domain generalization and out-of-distribution adaptation.
Pre-defined splits: (miniImagenet support → CUB query). Harness auto-generates episodes from disjoint domain sets.
Hierarchical / Fine-Grained
Classes defined by a fine-grained taxonomy (e.g., animal species). Episodes can be: - Intra-cluster: Same superclass (e.g., all birds).- Inter-cluster: Different superclasses.
Test ability to use semantic structure and avoid superficial bias.
Harness requires a class hierarchy file (e.g., ImageNet-WEB). Episodes sampled to enforce/break cluster constraints.
Long-Tail / Imbalanced
Support set has a skewed class distribution (e.g., 1:10:100). Query is balanced.
Test robustness to distribution shifts in the support set.
Configurable imbalance parameter α (Dirichlet). Support class counts drawn from Dir(α * ones(N)).
Noisy Labels
A fixed percentage (p_noise) of support set labels are randomly flipped.
Test robustness to label noise in the few-shot context.
Episodes generated with corrupted support set labels. Clean query set.
Enable exact replication and qualitative analysis on identical tasks.
Harness includes a registry of fixed episode indices. episode_id=1234 always gives the same task.
Episodic Sampling Protocol:
Base Training Phase: Learner trains on D_base. Harness provides standard N-way K-shot episodes from D_base only.
Meta-Test / Evaluation Phase: Learner is not trained. For each episode, it is given a support set S (from D_support) and must predict on a query set Q (from D_query). D_support and D_query are defined by the split type (e.g., cross-domain).
Sampling: Harness provides an EpisodeSampler(dataset, split_config) that yields (support_set, query_set, task_id) tuples deterministically given a seed.
2. Metrics Suite
Go beyond simple accuracy. Report distribution of performance over tasks.
Metric Category
Specific Metrics
Why?
Harness Output Format
Primary Classification
Mean Accuracy (Ac) over all episodes.
The standard.
mean_accuracy, std_error (computed across episode accuracies).
Robustness & Confidence
Median Accuracy, IQR.Worst-Case (p10) Accuracy.
Mean can be skewed by easy tasks. Worst-case matters for safety-critical apps.
For meta-regression or generative models. NLL captures full distribution fit.
mean_nll, mean_mae, calibration curve data.
Efficiency
Inference Time / Episode.Memory Footprint.
Practical deployment considerations.
avg_inference_time_ms, peak_memory_mb.
Learning Curves
Accuracy vs. # of support examples (K).Accuracy vs. # of adaptation steps.
How quickly does the model learn? Sample efficiency.
Series of (k, acc) points from running same episode with variable .
Crucial Principle: All metrics are computed per-episode first, then aggregated (mean, median, etc.). Never aggregate predictions first and then compute accuracy (this mixes tasks).
3. Reproducibility & Protocol
The "gold standard" for claiming a meta-learning result.
A. Complete Experiment Configuration
A single, version-controlled config.yaml (or JSON) file per experiment that specifies:
yaml
experiment:
name: "proto_net_cross_domain"
seed: 42
version: "1.0"
meta_learner:
module: "models.protonet"
class: "ProtoNet"
args:
encoder: "resnet12"
distance: "euclidean"
dataset:
base_train: ["miniImagenet_train"]
meta_test:
split_type: "cross_domain"
support_dataset: "miniImagenet_val"
query_dataset: "CUB"
n_way: 5
k_shot: 1
n_query: 15
episode_sampler:
n_episodes: 600 # Number of test episodes
fixed_episode_set: null # or ID of fixed set
evaluation:
metrics: ["accuracy", "ece", "p10_accuracy"]
save_predictions: true # Save all (support, query, preds) per episode
B. Deterministic Episode Generation
EpisodeSampler(seed) uses a single, global seed for all randomness (class selection, example sampling).
For fixed canonical sets, the seed is ignored; episode_id maps to a pre-computed list of sampled class indices.
Log the exact list of task_ids used for the final evaluation run.
C. Mandatory Artifacts to Archive & Publish
Code: Full training & evaluation script with requirements.txt/environment.yml.
Model Checkpoints:Exactly the checkpoint used for final evaluation (not the best val checkpoint if not the one tested).
Evaluation Logs: The Harness outputs a structured JSONL log:
Aggregate Metrics Report: Final results.json with all metrics and their std errors.
Seed & Environment:seed used, GPU model, CUDA version, PyTorch/TensorFlow version.
D. Statistical Evaluation Protocol
Minimum Episodes:n_episodes >= 600 for primary results (stable estimates).
Error Bars: Report **Standard Error of the Mean (SEM) across episodes, not across multiple random restarts of training. This measures task variability.
Comparison: To compare Algorithm A vs B:
Run both on identical episode stream (same seed and episode_sampler).
Report paired metrics (difference per episode).
Provide p-value from appropriate test.
Ablations: Each ablation must be a full experiment with its own config.yaml and logs.
4. Harness Implementation & API Design
A minimal, functional Python package structure:
python
# Core API
class MetaHarness:
def __init__(self, config: dict):
self.base_loader = get_base_loader(config['dataset']['base_train'])
self.meta_test_sampler = EpisodeSampler(
datasets=config['dataset']['meta_test'],
n_way=config['n_way'],
k_shot=config['k_shot'],
seed=config['seed']
)
def run_meta_test(self, model: torch.nn.Module, n_episodes: int) -> dict:
""" Main evaluation loop. No gradient. """
all_metrics = defaultdict(list)
for episode in self.meta_test_sampler.generate_episodes(n_episodes):
with torch.no_grad():
# Adapt model on support
adapted_model = adapt_model(model, episode.support)
# Predict on query
preds = adapted_model(episode.query)
# Compute per-episode metrics
ep_metrics = compute_metrics(preds, episode.query.labels)
for k, v in ep_metrics.items():
all_metrics[k].append(v)
if self.config.save_predictions:
save_episode_predictions(episode, preds)
return {k: (np.mean(v), np.std(v)/np.sqrt(len(v))) for k,v in all_metrics.items()}
Integrations:
Datasets: Wrappers for torchvision, tensorflow_datasets, torchmeta, learn2learn. Standardized interface: dataset.get_class_images(class_id).
Algorithms: Adapter class for any model with forward(), and optional adapt() method.
Logging: Auto-generates config.yaml, results.json, and a predictions/ folder.
Goal: Find Pareto frontier of accuracy vs. efficiency.
Leaderboard Rules:
Must submit: config.yaml, final results.json, git commit hash of code.
One submission per algorithm/hyperparameter set.
No training on any part of the meta-test datasets (including their base training splits) must be declared.
Leaderboard shows full distribution (box plots of per-episode accuracy), not just mean.
Summary: What Makes This Harness "Meta"?
Split Standardization: Clear, configurable definitions of what a "task" is (cross-domain, noisy, hierarchical).
Metric Integrity: Aggregation happens after per-episode computation. Reports distribution (median, IQR, worst-case) and calibration.
Reproducibility by Design: Single config.yaml controls everything. Fixed episode sets for exact replication. Mandatory artifact archiving.
Statistical Rigor: Paired testing on identical episode streams. SEM error bars from episode distribution.
Extensible & Composable: New datasets, splits, and metrics can be added via registered interfaces without breaking core.
By adopting this harness, the community can move from "my algorithm gets X% on a slightly different 5-way split" to "Algorithm A significantly outperforms B (p<0.01) on cross-domain generalization, with better worst-case robustness, as measured on the standard MetaHarness-Cross suite." This is the foundation for genuine scientific progress.
K
Statistical Significance
Paired t-test / Wilcoxon between Algorithm A and B on the same set of episodes.