CAMLOptions<T, TInput, TOutput>

Options & Configuration · AiDotNet.MetaLearning.Options

Configuration options for CAML (Context-Aware Meta-Learning) (Fifty et al., NeurIPS 2023).

Inheritance: ModelOptions → CAMLOptions<T, TInput, TOutput>

Implements: IMetaLearnerOptions<T>

For Beginners

CAML leverages powerful pretrained models:

  1. Uses a large pretrained model (e.g., CLIP, DINO) to extract features
  2. No fine-tuning of the backbone at all - features are frozen
  3. A lightweight context module adapts features based on the support set
  4. Classification is done by comparing adapted query features to prototypes

The key insight is that modern pretrained models produce such good features that complex meta-learning is unnecessary - just adapt the classifier.

How It Works

CAML uses a frozen, large-scale pretrained vision transformer as a universal feature extractor and adapts to few-shot tasks using non-parametric, context-aware classification.

Reference: Fifty, C., Duan, D., Junkins, R.G., Amid, E., Leskovec, J., Re, C., & Thrun, S. (2023). Context-Aware Meta-Learning. NeurIPS 2023.

Constructors

Constructor Summary
CAMLOptions(IFullModel<T, TInput, TOutput> metaModel) Initializes a new instance of CAMLOptions.

Properties

Property Summary
IEpisodicDataLoader<T, TInput, TOutput> DataLoader { get; set; } Gets or sets the episodic data loader.
IFullModel<T, TInput, TOutput> MetaModel { get; set; } Gets or sets the feature extractor model.
IGradientBasedOptimizer<T, TInput, TOutput> InnerOptimizer { get; set; } Must stay null: this algorithm takes no plain gradient inner step (it adapts without one, or by its own update rule), so a supplied optimizer is rejected when the learner is built.
IGradientBasedOptimizer<T, TInput, TOutput> MetaOptimizer { get; set; } Optimizer for the meta-update.
ILossFunction<T> LossFunction { get; set; } Loss function for meta-training; null uses the default multi-class classification loss.
bool EnableCheckpointing { get; set; }
bool FreezeBackbone { get; set; } Gets or sets whether to freeze the backbone during meta-training.
bool UseFirstOrder { get; set; }
double InnerLearningRate { get; set; }
double OuterLearningRate { get; set; }
double? GradientClipThreshold { get; set; }
int AdaptationSteps { get; set; } Number of gradient steps taken on each task’s support set (0: this algorithm adapts without gradient steps).
int CheckpointFrequency { get; set; }
int ContextDimension { get; set; } Gets or sets the context embedding dimension.
int EvaluationFrequency { get; set; }
int EvaluationTasks { get; set; }
int MetaBatchSize { get; set; }
int NumMetaIterations { get; set; }
int? RandomSeed { get; set; } Gets or sets the random seed.

Methods

Method Summary
IMetaLearnerOptions<T> Clone()
bool IsValid()