iCaRL (Incremental Classifier and Representation Learning) is a class-incremental learning algorithm that enables a model to learn new classes over time from a stream of data while maintaining performance on all previously seen classes. It combines a nearest-mean-of-exemplars classification rule with bounded rehearsal and a knowledge distillation loss to mitigate catastrophic forgetting. This makes it a seminal rehearsal-based method for continual learning.
Glossary
iCaRL (Incremental Classifier and Representation Learning)

What is iCaRL (Incremental Classifier and Representation Learning)?
iCaRL is a foundational algorithm for class-incremental learning, enabling models to learn new visual categories sequentially without forgetting old ones.
The algorithm operates by maintaining a fixed-size exemplar set (replay buffer) for each learned class, storing representative images. During training on new classes, it interleaves these exemplars with new data. A distillation loss penalizes changes to the network's outputs for old classes, while a classification loss learns the new ones. For inference, it uses a nearest-mean classifier in the feature space defined by the network's representation layer, allowing it to distinguish among all seen classes without task identity.
Key Components of the iCaRL Algorithm
iCaRL is a seminal class-incremental learning algorithm that enables a model to learn new classes sequentially without catastrophic forgetting. Its core innovation is the combination of a nearest-mean-of-exemplars classifier, a bounded exemplar memory, and a distillation-based training loss.
Nearest-Mean-of-Exemplars (NME) Classifier
The Nearest-Mean-of-Exemplars (NME) classifier replaces the standard linear output layer in incremental learning. For each learned class, iCaRL computes and stores a prototype vector—the mean feature representation of that class's exemplars in memory. At inference, a new sample is classified by comparing its extracted features to all stored class prototypes using a distance metric (e.g., L2 distance) and assigning the label of the nearest prototype.
- Key Benefit: Decouples the classification rule from the fixed-size output layer, allowing the model to scale to an arbitrary number of classes over time.
- Contrast with Softmax: Unlike a softmax classifier, which requires retraining the final layer for each new class set, NME is inherently extensible.
- Example: After learning 100 classes, the model holds 100 prototype vectors. To add class 101, it simply computes and stores a new prototype without modifying the classification architecture.
Exemplar Set Management & Bounded Rehearsal
iCaRL maintains a fixed-capacity exemplar memory (replay buffer) to store a small, representative subset of data from previously learned classes. This enables bounded rehearsal, where old and new data are interleaved during training.
- Memory Budget (m): The total number of exemplars is fixed (e.g., 2,000 images). This budget is divided equally among all classes learned so far.
- Exemplar Selection: For each class, iCaRL uses herding to select exemplars. Herding iteratively chooses images whose feature vectors best approximate the class's mean feature vector, creating a representative snapshot.
- Dynamic Redistribution: When a new class is added, exemplars from old classes may be reduced to free up space, maintaining the fixed total budget. This ensures memory use remains constant regardless of the total number of classes.
Knowledge Distillation Loss
To preserve knowledge of old classes, iCaRL employs a knowledge distillation loss alongside the standard classification loss for new data. Before learning a new set of classes, the model's parameters are saved as θ_old. During training on new data, the loss function penalizes deviations from the old model's predictions.
- Loss Function: L = L_classification(y_new, p_new) + λ * L_distillation(p_old, p_new)
- Distillation Term: L_distillation is typically the Kullback-Leibler (KL) divergence between the probability outputs of the old model (p_old) and the current model (p_new) for the new data samples. This encourages the new model to retain the same mapping for features associated with old classes.
- Role of λ: A hyperparameter that balances learning new concepts (plasticity) against retaining old ones (stability).
Feature Representation Learning
A deep convolutional neural network (e.g., ResNet) serves as the shared feature extractor φ(x; θ). This backbone is trained end-to-end across all incremental steps. Its objective is to learn a discriminative and stable embedding space where:
- Samples from the same class cluster tightly.
- The mean of a class's exemplars (its prototype) is a reliable class representative.
- The geometry of old class clusters is preserved when new classes are added.
The quality of this representation is critical for the NME classifier's accuracy. The distillation loss and rehearsal with exemplars directly regularize the updates to θ to prevent representation drift—where the feature space changes so drastically that old class prototypes become meaningless.
Incremental Learning Protocol
iCaRL operates under a strict class-incremental learning (CIL) protocol, which defines the sequence of training and evaluation phases.
- Training Phase (Step t): The model receives data only for a new set of classes C_t. It has access to its exemplar memory P (containing data from classes C_1...C_{t-1}) and the new data. Training uses the combined distillation and classification loss.
- Evaluation Phase: The model must classify test samples into the union of all classes seen so far (C_1 ∪ C_2 ∪ ... ∪ C_t) without being given the task identity. This is the core challenge of CIL.
- Comparison to Task-Incremental Learning: Unlike easier settings where the task ID is provided at test time, iCaRL's protocol requires the model to autonomously distinguish between all learned classes, making the NME classifier essential.
Herding for Exemplar Selection
Herding (or mean-of-exemplars selection) is the algorithm iCaRL uses to populate the exemplar set for each class. Its goal is to select a subset of images whose average feature vector is as close as possible to the average feature vector of the entire class.
Algorithm Steps for a class with N images and memory budget k:
- Compute the class mean vector μ from all N images using the current feature extractor.
- Initialize an empty exemplar set M.
- Iteratively select k exemplars. In each step, choose the image x_i not in M that minimizes the distance between μ and the average feature vector of the set M ∪ {x_i}.
- Result: The selected exemplars form a representative "core-set" that approximates the class distribution in feature space.
- Computational Property: Herding produces a deterministic, ordered list of exemplars. If the memory budget for a class is later reduced, the first m exemplars from this list are retained.
iCaRL vs. Other Continual Learning Methods
A feature comparison of iCaRL against representative methods from the primary continual learning families, highlighting its design for class-incremental learning on edge devices.
| Method / Feature | iCaRL (Incremental Classifier and Representation Learning) | Regularization-Based (e.g., EWC) | Pure Rehearsal (e.g., Experience Replay) | Architectural (e.g., Progressive Nets) |
|---|---|---|---|---|
Core Mechanism | Hybrid: Nearest-mean exemplar classification + bounded rehearsal + distillation | Regularization penalty on important past-task parameters | Interleaving stored past data with new data | Dynamic network expansion or parameter isolation |
Data Storage Requirement | Bounded exemplar set (e.g., 20 images per class) | None (only model parameters) | Substantial raw data buffer | Minimal to none (task-specific parameters) |
Handles Class-Incremental Learning | ||||
Task Identity Required at Inference | ||||
Mitigates Catastrophic Forgetting | ||||
On-Device Suitability (Memory) | Medium (stores exemplars, fixed model size) | High (minimal overhead) | Low (large raw data buffer) | Low (growing model size) |
On-Device Suitability (Compute) | Medium (nearest-neighbor search, distillation) | High (standard forward/backward pass) | Medium (rehearsal forward/backward) | High (but model grows) |
Forward/Backward Transfer Potential | Limited by exemplar quality | High for related tasks | High, depends on buffer | None by design (isolated) |
Key Limitation | Exemplar management complexity; performance degrades with many classes | Difficulty scaling to many tasks; sensitive to regularization strength | Memory buffer size limits task history; privacy concerns | Model size grows linearly with tasks; no parameter sharing |
iCaRL for Edge Deployment: Challenges and Adaptations
iCaRL (Incremental Classifier and Representation Learning) is a foundational algorithm for class-incremental learning. Deploying it on resource-constrained edge devices requires specific adaptations to its core mechanisms of exemplar management, distillation, and nearest-mean classification.
Core iCaRL Algorithm
iCaRL is a class-incremental learning algorithm that enables a model to learn new classes sequentially without forgetting old ones. Its three core components are:
- Exemplar Management: A fixed-size memory stores a representative subset of data (exemplars) from each learned class.
- Nearest-Mean-of-Exemplars Classification: At inference, a sample is classified by comparing its feature vector to the mean feature vector of each class's stored exemplars.
- Knowledge Distillation Loss: When learning a new task, a distillation loss penalizes changes to the model's output logits for old classes, preserving prior knowledge. This combination allows iCaRL to learn new classes over time while maintaining a bounded memory footprint.
Exemplar Management on Edge
The replay buffer is iCaRL's most memory-intensive component. Edge deployment forces critical trade-offs:
- Fixed Memory Budget: The total number of stored exemplars is strictly bounded, often to just a few per class. This requires intelligent selection.
- Exemplar Selection Strategies: Simple herding (selecting samples closest to the class mean) is common, but edge systems may use coreset selection or prototype-based methods to maximize representativeness with fewer samples.
- Storage vs. Compute: Storing raw images consumes memory; storing extracted feature vectors is more compact but requires running the feature extractor during rehearsal, trading storage for compute.
Adapting the Distillation Loss
The knowledge distillation component, which compares new and old model outputs, must be optimized for edge training cycles.
- Loss Simplification: The full softmax distillation over all old classes can be computationally heavy. Adaptations may distill only over a subset of classes or use a mean-squared-error loss on feature representations.
- Efficient Logit Storage: To compute the distillation loss, the algorithm needs the old model's logits for new data. This requires either storing them (increasing memory) or recomputing them with a frozen old model (increasing compute). Edge implementations carefully balance this trade-off.
- Temperature Scaling: The distillation temperature hyperparameter, which controls output smoothing, may be tuned or fixed to reduce hyperparameter search on devices.
Nearest-Mean Classification Overhead
iCaRL's inference rule replaces a standard classifier layer with a nearest-mean-of-exemplars calculation in the feature space. On edge devices, this has implications:
- Dynamic Class Addition: Adding a new class requires calculating and storing its new mean feature vector. This is a lightweight O(1) update if exemplars are stored as features.
- Inference Cost: Classification requires computing the distance from the input's feature vector to every class mean. For many classes, this linear scan can become slower than a single matrix multiplication in a standard classifier. Optimizations like approximate nearest neighbor search may be introduced for large class counts.
- Feature Consistency: The effectiveness of this rule depends on a stable, well-trained feature extractor. Feature drift during incremental training can degrade performance.
Memory and Compute Constraints
Edge hardware imposes strict limits that challenge iCaRL's vanilla assumptions.
- Bounded Rehearsal Compute: The interleaving of new data and old exemplars during training increases the number of training steps. On edge devices, training time and energy are limited, forcing reductions in rehearsal frequency or batch size.
- Model Size: The base neural network (e.g., ResNet) must itself be small enough for on-device inference. This often means using a mobile-optimized architecture (e.g., MobileNetV3, EfficientNet-Lite) as the feature extractor, which may have lower representational capacity.
- On-Device Optimization: Training steps may utilize mixed-precision arithmetic or leverage hardware-specific neural processing unit (NPU) kernels to accelerate the backward pass and distillation loss calculation.
Federated iCaRL for Edge Networks
iCaRL can be extended to a federated learning setting, creating Federated Continual Learning (FCL). This is highly relevant for networks of edge devices (e.g., smartphones, IoT sensors).
- Local Exemplar Buffers: Each device maintains its own small replay buffer with private data.
- Distilled Model Aggregation: Devices perform local iCaRL training (new task + rehearsal) and send model updates to a server. The server must aggregate these updates while preserving knowledge across all devices. Techniques like Federated Distillation may be used.
- Heterogeneous Task Streams: Different devices may encounter new classes in a different order (non-i.i.d. task distribution). This requires robust aggregation algorithms that handle client drift in a continual learning context.
Frequently Asked Questions
iCaRL (Incremental Classifier and Representation Learning) is a foundational algorithm for class-incremental learning, enabling models to learn new visual classes sequentially without forgetting previous ones. These FAQs address its core mechanisms, practical implementation, and role in edge AI systems.
iCaRL is a class-incremental learning algorithm that enables a neural network to learn new object categories over time without catastrophic forgetting of previously learned classes. It works by combining three key components: a nearest-mean-of-exemplars classification rule, bounded exemplar rehearsal, and a knowledge distillation loss. During training on a new set of classes, the algorithm stores a limited number of representative images (exemplars) per old class in a fixed-size memory buffer. It then trains the model on a mixed batch containing new class data and these stored exemplars. The distillation loss penalizes changes in the network's output logits for old classes, helping to preserve prior knowledge. For inference, classification is performed by comparing the feature vector of a new input to the mean feature vector (prototype) of each class's stored exemplars, selecting the nearest class.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
iCaRL operates within the broader field of continual learning, specifically addressing the challenge of learning new classes sequentially. These related concepts define the mechanisms, scenarios, and trade-offs central to its operation.
Catastrophic Forgetting
Catastrophic Forgetting is the phenomenon where a neural network abruptly and drastically loses previously learned information when trained on new data. It is the core problem that continual learning algorithms like iCaRL are designed to solve. The issue arises because gradient-based optimization adjusts network parameters to minimize loss on the new task, which often overwrites the representations needed for old tasks. This is a direct manifestation of the stability-plasticity dilemma.
Experience Replay
Experience Replay is a rehearsal-based continual learning technique where a subset of past training data (or their feature representations) is stored in a replay buffer. During training on new tasks, these stored examples are interleaved with new data, allowing the model to 'rehearse' old tasks. iCaRL employs a bounded version of this strategy, storing a fixed number of exemplars per class. Key buffer management strategies include:
- Reservoir Sampling: A probabilistic algorithm for maintaining a uniform random sample from a data stream.
- Core-Set Selection: Choosing representative samples that minimize the distance to the full dataset.
Knowledge Distillation
Knowledge Distillation is a technique for transferring knowledge from a large, complex model (the teacher) to a smaller, more efficient one (the student). In continual learning, it is repurposed to combat forgetting. Methods like Learning without Forgetting (LwF) and iCaRL use a distillation loss. This loss penalizes changes in the model's output logits for new data compared to the outputs generated by the model's previous parameters, thereby preserving the decision boundaries for old classes even as the network adapts to new ones.
Class-Incremental Learning (CIL)
Class-Incremental Learning is the specific continual learning scenario addressed by iCaRL. In CIL, a model learns new classes sequentially over time and, during inference, must discriminate among all classes seen so far without being given the task identity. This is more challenging than task-incremental learning, where the task ID is provided at test time. iCaRL's combination of exemplar storage and a nearest-mean-of-exemplars classifier is a seminal solution designed explicitly for the CIL setting.
Stability-Plasticity Dilemma
The Stability-Plasticity Dilemma is the fundamental trade-off in continual learning and adaptive systems. Stability refers to a model's ability to retain previously acquired knowledge (resisting catastrophic forgetting). Plasticity refers to its capacity to efficiently learn new information from incoming data. All continual learning methods, including iCaRL, navigate this tension. iCaRL balances them by using rehearsal (for stability) and a distillation loss that allows careful updating of shared representations (for plasticity).
On-Device Training
On-Device Training is the process of updating a machine learning model's parameters directly on an edge device (e.g., smartphone, IoT sensor) using locally generated data. For continual learning algorithms like iCaRL to be deployed on the edge, they must be compatible with the severe memory, compute, and energy constraints of these devices. This necessitates research into Edge-CL, which focuses on efficient replay buffer management, optimized distillation losses, and minimizing the computational overhead of the exemplar-based classification rule used in iCaRL.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us