License YOLO
Back to Ultralytics Glossary

Continual Learning

Continual learning, or lifelong learning, trains a model on a stream of new tasks or data without forgetting earlier ones. Covers replay, EWC, and code.

Continual learning, also called lifelong or incremental learning, trains a model on a sequence of tasks or a changing stream of data while preserving what it learned before. Standard fine-tuning on new data overwrites the model weights that served earlier tasks, so performance on those tasks collapses, a failure known as catastrophic forgetting. Continual learning methods balance plasticity, the ability to learn new things, against stability, the ability to keep old knowledge, a trade-off called the stability-plasticity dilemma in both neural networks and biological brains.

Why Continual Learning Matters#

Deployed models face data that keeps changing: new object classes, new camera hardware, seasonal lighting, or gradual data drift. The simplest fix is to retrain from scratch on the full cumulative dataset, but that cost grows with every update, and older data may be unavailable because of storage limits, licensing, or data privacy rules. Continual learning updates the model incrementally instead, which suits edge AI devices and machine learning operations pipelines that retrain deployed models on a schedule.

Types of Continual Learning#

Van de Ven, Tuytelaars, and Tolias distinguish three scenarios. In task-incremental learning, the model is told which task each input belongs to and can use a separate output head per task. In domain-incremental learning, the classes stay the same while the input distribution shifts, such as a detector moving from daytime to nighttime footage. In class-incremental learning, new classes keep arriving and the model must tell all classes seen so far apart without being told which task an input came from, which makes it the hardest of the three.

Strategies to Prevent Forgetting#

  • Replay: The model stores a small buffer of past examples, or generates synthetic ones with a generative model, and mixes them into each new round of training.
  • Elastic Weight Consolidation: Regularization methods such as EWC add a penalty to the loss for changing weights that were important to earlier tasks, estimating that importance from the Fisher information.
  • Parameter Isolation: Each task gets its own parameters, through frozen backbones, task-specific heads, or adapters such as LoRA, so updates for a new task cannot overwrite old ones.
  • Knowledge Distillation: The previous model's outputs on new data serve as soft targets while the model learns the new task, an approach known as Learning without Forgetting.

The snippet below runs a class-incremental experiment in PyTorch: a small network learns handwritten digits 0 to 4, then digits 5 to 9, with and without a replay buffer of 100 stored images from the first task.

import torch
from sklearn.datasets import load_digits
from torch import nn

X, y = load_digits(return_X_y=True)
X, y = torch.tensor(X / 16, dtype=torch.float32), torch.tensor(y)
task_a, task_b = torch.where(y < 5)[0], torch.where(y >= 5)[0]  # digits 0-4, then digits 5-9

for replay in [0, 100]:
    torch.manual_seed(0)
    model = nn.Sequential(nn.Linear(64, 64), nn.ReLU(), nn.Linear(64, 10))
    optimizer = torch.optim.Adam(model.parameters(), lr=0.01)
    # Train on task A, then on task B plus a replay buffer of stored task A images
    for task in [task_a, torch.cat([task_b, task_a[:replay]])]:
        for _ in range(200):
            optimizer.zero_grad()
            nn.functional.cross_entropy(model(X[task]), y[task]).backward()
            optimizer.step()
    accuracy = (model(X[task_a]).argmax(1) == y[task_a]).float().mean()
    print(f"Replay buffer of {replay} images: digits 0-4 accuracy after learning 5-9 = {accuracy:.0%}")

Without replay, the network forgets digits 0 to 4 completely and scores 0% on them after learning 5 to 9. Replaying 100 stored images, about 11% of the first task's 901 images, keeps that accuracy at 70%. Ultralytics YOLO26 supports the parameter-isolation side of this toolkit through its freeze training argument, which locks the first N layers, or named modules, while the model fine-tunes on new data.

Open Challenges#

Evaluating a continual learner takes more than one score: performance metrics must be tracked on every earlier task after each update, measuring backward transfer (how new learning changed old tasks) as well as forward transfer (how old knowledge sped up new ones). Long continual training also faces a quieter problem than forgetting. Dohare et al. showed that standard deep learning methods gradually lose plasticity, the ability to learn anything new, across long sequences of ImageNet-based tasks and reinforcement learning problems, and that continual backpropagation, which randomly reinitializes a small fraction of rarely used units, maintains it indefinitely.

Real-World Applications#

  • Robotics: A robot on a manufacturing line can learn to handle a new product variant without a full retraining run, while keeping its skill with the parts it already handles.
  • Medical Image Analysis: Hospitals change scanners and imaging protocols, and new findings appear over time. Domain-incremental updates let a diagnostic model adapt to the new images while keeping its accuracy on established conditions.
  • Large Language Models: Continual pretraining on newer text refreshes a model's knowledge, and parameter-efficient adapters add new skills without retraining the full model.
  • Transfer Learning: Transfer learning reuses a pretrained model as a starting point for a new task and judges success on that task alone. Continual learning is judged on the new task and every earlier one.
  • Online Learning: Online learning updates a model one example or mini-batch at a time as data streams in, usually for a single task, and need not address forgetting.
  • Curriculum Learning: Curriculum learning orders the examples of one fixed task from easy to hard, while continual learning faces a sequence of different tasks or distributions.
  • Machine Unlearning: Unlearning runs in the opposite direction, deliberately removing the influence of specific training data from a model, for example to honor erasure requests under the GDPR's right to be forgotten.

Explore solutions

Computer vision in sports

Computer vision in sports

Discover how Ultralytics YOLO powers sports vision with player and ball tracking, performance analytics, coaching insights, and athlete rehabilitation.
Learn more
Computer vision for aerial imagery

Computer vision for aerial imagery

Turn drone and aerial imagery into real-time insights for agriculture, aquaculture, conservation, and geospatial analysis with Ultralytics YOLO.
Learn more
Computer vision in aerospace

Computer vision in aerospace

Apply computer vision in aerospace with Ultralytics YOLO for aircraft inspection, runway FOD detection, airport ground operations, and composite defect detection.
Learn more
Computer vision in security

Computer vision in security

Protect every site with Ultralytics YOLO models. Vision AI powers perimeter monitoring, threat detection, license-plate recognition, and workplace safety.
Learn more
Computer vision in robotics

Computer vision in robotics

Power smarter machines with Ultralytics YOLO models. Vision AI in robotics drives autonomous navigation, perception, object tracking, and real-time control.
Learn more
Computer vision in logistics

Computer vision in logistics

Streamline logistics with Ultralytics YOLO models. Vision AI enables package inspection, sorting, vehicle tracking, and real-time warehouse safety monitoring.
Learn more
Computer vision in retail

Computer vision in retail

Reimagine retail with Ultralytics YOLO models. Vision AI powers inventory tracking, shelf monitoring, queue management, and smarter customer insights.
Learn more
Computer vision in healthcare

Computer vision in healthcare

Build healthcare solutions with Ultralytics YOLO models. Vision AI in healthcare powers faster medical imaging, smarter diagnostics, and patient monitoring.
Learn more
Computer vision in manufacturing

Computer vision in manufacturing

Optimize manufacturing with Ultralytics YOLO models. Vision AI drives quality control, defect detection, PPE compliance, and assembly line automation.
Learn more
Computer vision in automotive

Computer vision in automotive

Apply computer vision in automotive with Ultralytics YOLO models. Vision AI elevates road safety, driver assistance, and vehicle automation for smarter roads.
Learn more
Computer vision in agriculture

Computer vision in agriculture

Bring vision AI to smart agriculture with Ultralytics YOLO models. Power crop monitoring, livestock tracking, and precision farming for higher, smarter yields.
Learn more

Let's build the future of AI together!

Begin your journey with the future of machine learning