IContinualLearningStrategy<T>

Interfaces · AiDotNet.Interfaces

Defines a strategy for continual learning that helps neural networks learn multiple tasks sequentially without forgetting previously learned knowledge.

Known implementations: AveragedGEM<T>, ExperienceReplay<T>, GenerativeReplay<T>, OnlineEWC<T>, VariationalContinualLearning<T>

For Beginners

Continual learning addresses a fundamental challenge in neural networks called “catastrophic forgetting.” When a neural network learns a new task, it often forgets how to perform previous tasks. This happens because the network’s weights are modified to optimize for the new task, overwriting the knowledge from earlier tasks.

How It Works

Continual learning strategies help networks learn multiple tasks sequentially while preserving knowledge from previous tasks. Common approaches include:

Typical Usage Flow:

Properties

Property Summary
bool AccumulatesAcrossTasks { get; } Whether this strategy accumulates regularization strength across tasks.
double Lambda { get; set; } Gets the regularization strength parameter (lambda) for loss-based continual learning.

Methods

Method Summary
T ComputeLoss(INeuralNetwork<T> network) Computes the regularization loss to prevent forgetting previous tasks.
Vector<T> ModifyGradients(INeuralNetwork<T> network, Vector<T> gradients) Modifies the gradient to prevent catastrophic forgetting.
void AfterTask(INeuralNetwork<T> network, ValueTuple<Tensor<T>, Tensor<T>> taskData, int taskId) Processes information after completing training on a task.
void BeforeTask(INeuralNetwork<T> network, int taskId) Prepares the strategy before starting to learn a new task.
void Reset() Resets the strategy, clearing all stored task information.