iCaRL (Incremental Classifier and Representation Learning) is a hybrid continual learning algorithm designed for the class-incremental learning scenario, where a model must learn new classes over time from non-stationary data streams. Its core innovation is a three-component system: a herding-based exemplar memory stores a limited number of representative past examples; a nearest-mean-of-exemplars classification rule replaces the standard softmax classifier to handle an expanding number of classes; and knowledge distillation is applied to the representation layer to preserve old knowledge. This combination allows iCaRL to learn new tasks while maintaining strong performance on old ones, directly addressing the stability-plasticity dilemma.
Glossary
iCaRL (Incremental Classifier and Representation Learning)

What is iCaRL (Incremental Classifier and Representation Learning)?
iCaRL is a seminal hybrid algorithm for class-incremental learning that combines exemplar replay, a nearest-mean-of-exemplars classification rule, and knowledge distillation to learn new classes sequentially without catastrophic forgetting.
The algorithm operates in distinct phases. When a batch of new class data arrives, iCaRL updates the feature extractor using a combined loss: a standard classification loss for the new data and a distillation loss that penalizes changes to the features produced for old exemplars. After training, it uses a herding algorithm to select and store the most representative examples for the new classes into its fixed-size memory, potentially removing older exemplars. During inference, classification is performed by computing the mean feature vector (prototype) for each class from its stored exemplars and assigning the label of the nearest prototype. This approach is a foundational replay-based method that set a benchmark for catastrophic forgetting mitigation in visual recognition tasks.
Core Components of iCaRL
iCaRL (Incremental Classifier and Representation Learning) is a hybrid algorithm for class-incremental learning. It combines three core mechanisms to learn new classes while maintaining performance on old ones without catastrophic forgetting.
Exemplar Management & Replay
iCaRL maintains a fixed-size memory buffer of real data samples, called exemplars, from previously learned classes. This is a herding-based selection process where exemplars are chosen to approximate the class mean in the feature space. During training on new classes, these stored exemplars are replayed—interleaved with new data—to approximately satisfy the i.i.d. data assumption and provide a direct signal to prevent forgetting. The algorithm uses a reservoir sampling strategy to manage the buffer under a strict, constant memory budget as the total number of classes grows.
Nearest-Mean-of-Exemplars (NME) Classifier
Instead of a standard linear output layer, iCaRL uses a non-parametric classification rule based on stored exemplars. For each class, it computes a prototype vector as the mean of that class's exemplar features in the learned embedding space. At inference, a new sample is classified by comparing its extracted features to all class prototypes using Euclidean distance (L2 norm) and assigning the label of the nearest mean. This decouples the classification mechanism from the model's output layer, allowing the system to seamlessly incorporate new classes without retraining the final classifier weights.
Knowledge Distillation Loss
To preserve knowledge in the feature extractor, iCaRL employs a knowledge distillation penalty. When learning a new task, a frozen copy of the model from the previous step is used as a teacher. The current model (student) is trained with a combined loss:
- A standard cross-entropy loss for the new classes.
- A distillation loss (e.g., Kullback-Leibler divergence) that encourages the model's output logits for all old classes to match the probabilities produced by the teacher model. This soft-label supervision acts as a regularizer, anchoring the network's representations for past data without requiring explicit old-class labels during new task training.
Hybrid Training Protocol
iCaRL's training proceeds in distinct phases for each new task (set of classes):
- Model Augmentation: The network's feature extractor is updated, and its classification layer is expanded with new units for the incoming classes.
- Joint Optimization: The model is trained on a combined dataset of new class data and replayed exemplars from the memory buffer. The loss function is a weighted sum of the cross-entropy and distillation terms.
- Exemplar Update: After training, the algorithm reduces the number of exemplars per old class to free space and then selects new exemplars for the just-learned classes using the herding algorithm, updating the memory buffer.
- Prototype Recalculation: The mean feature vector (prototype) for each class, old and new, is recomputed based on the updated exemplar set for the NME classifier.
Comparison to Key Alternatives
iCaRL occupies a specific point in the continual learning design space:
- vs. Regularization Methods (e.g., EWC): iCaRL uses explicit replay of data rather than implicit parameter importance penalties, often yielding stronger performance but requiring a memory buffer.
- vs. Pure Replay (ER): It enhances simple experience replay with a structured exemplar selection strategy and a specialized NME classifier.
- vs. Architectural Methods (e.g., Progressive Nets): iCaRL uses a fixed network architecture, growing only the final classification rule, avoiding the parameter explosion of methods that add new columns or masks per task.
- vs. Generative Replay: It replays real data instead of synthetic data, avoiding the complexity and potential fidelity issues of training a separate generative model.
Inherent Limitations & Challenges
Despite its effectiveness, iCaRL has defined constraints:
- Memory Budget Dependency: Performance is tightly coupled to the size of the exemplar buffer. A smaller budget leads to faster forgetting.
- Class-Incremental Focus: The algorithm is designed for the scenario where task boundaries are defined by new classes. It is less directly applicable to task- or domain-incremental settings.
- Computational Overhead: The herding algorithm for exemplar selection and the NME classification at inference introduce additional compute steps compared to a standard forward pass through a linear layer.
- Representation Drift: While distillation mitigates it, the feature extractor's representations can still drift over many tasks, potentially degrading the NME classifier's accuracy as prototypes become less representative.
iCaRL vs. Other Continual Learning Approaches
A comparison of iCaRL's hybrid design against core categories of continual learning methods, highlighting key mechanisms for mitigating catastrophic forgetting.
| Mechanism / Feature | iCaRL (Hybrid) | Replay-Based Methods (e.g., ER, GEM) | Regularization-Based Methods (e.g., EWC, SI) | Architectural Methods (e.g., Progressive Nets, HAT) |
|---|---|---|---|---|
Core Strategy | Exemplar replay + Knowledge distillation + Nearest-mean classification | Rehearsal on stored/generated past data | Penalizing changes to important parameters | Expanding or masking network structure |
Requires Stored Raw Data? | ||||
Fixed Model Capacity? | ||||
Explicit Task ID at Inference? | ||||
Classification Rule | Nearest-mean-of-exemplars | Standard softmax classifier | Standard softmax classifier | Task-specific heads/routes |
Mitigates Forgetting Via... | Data replay & output distillation | Approximate i.i.d. rehearsal | Parameter importance constraints | Parameter isolation |
Memory Overhead Type | Exemplar storage (raw data) | Exemplar or generative model storage | Importance matrix storage (~# parameters) | Network growth or mask storage |
Typical Use Case | Class-incremental learning | Task- or class-incremental learning | Task-incremental learning | Task-incremental learning |
Practical Implementation and Considerations
iCaRL's hybrid approach combines exemplar storage, a custom classifier, and knowledge distillation. Implementing it effectively requires careful engineering of its core components.
Exemplar Management Strategy
The exemplar memory is a fixed-size buffer storing a subset of past data. iCaRL uses herding for selection: after training on a task, it stores the examples whose feature vectors are closest to the class mean, iteratively refining the set to best approximate the original data distribution.
- Memory Budget: The total number of stored examples is fixed (e.g., 2,000). When new classes arrive, the budget is divided equally among all seen classes, meaning the per-class exemplar count shrinks over time.
- Implementation: Requires maintaining a data structure for the buffer and a deterministic selection algorithm. The herding process is computationally light but must be run after learning each new set of classes.
Nearest-Mean-of-Exemplars Classifier
iCaRL replaces the standard linear output layer with a nearest-mean-of-exemplars (NME) classification rule. This is a non-parametric, prototype-based classifier.
- How it works: For each class, a prototype vector is computed as the mean of the feature representations (from the penultimate network layer) of all its stored exemplars. At inference, a new sample is classified by finding the class prototype with the smallest Euclidean or cosine distance to its feature vector.
- Advantage: This decouples the classification mechanism from the network's parametric head, making it inherently adaptable to new classes without retraining a final layer. The classifier's complexity scales with the number of classes, not network parameters.
Hybrid Loss Function
Training combines a distillation loss to preserve old knowledge and a classification loss to learn new tasks.
- Distillation Loss: Uses a copy of the model from the previous step (
θ_{t-1}) as a teacher. For new data, the current model is trained to mimic the teacher's output logits for the old classes via a Kullback-Leibler (KL) divergence loss. This 'dark knowledge' transfer anchors behavior on past tasks. - Classification Loss: A standard cross-entropy loss is applied for the new classes on the current data.
- Total Loss:
L = L_{distill}(old_classes) + L_{cross-entropy}(new_classes). The model is trained on a mixed batch containing new data and exemplars replayed from memory.
Computational & Memory Trade-offs
iCaRL introduces specific overheads that must be accounted for in production systems.
- Memory Overhead: Requires persistent storage for the exemplar buffer and the previous model snapshot for distillation. The buffer size is a fixed hyperparameter that directly trades off retention quality against storage cost.
- Compute Overhead: Training involves forward passes through both the current and previous model for distillation. The herding-based exemplar selection adds a post-training step. The NME classifier requires computing distances to all class prototypes at inference, which is an
O(N * K)operation where N is batch size and K is total classes. - Latency: The non-parametric NME classifier can become a bottleneck as the number of classes grows into the thousands, potentially requiring optimized nearest-neighbor search.
Limitations and Failure Modes
While powerful, iCaRL has inherent constraints that affect its applicability.
- Class-Incremental Assumption: Designed explicitly for class-incremental learning where task boundaries are defined by new classes. It does not natively handle task-free or domain-incremental scenarios without modification.
- Exemplar Dependency: Performance degrades significantly if the memory buffer is too small to represent old class diversity, especially for complex, multi-modal data distributions.
- Representation Drift: Although distillation mitigates it, the shared feature extractor can still experience representation drift over many tasks, as it must accommodate new classes, potentially altering the space where old class prototypes reside.
- Fixed Architecture: Unlike architectural methods, iCaRL uses a fixed network capacity, which can lead to saturation when the number of tasks becomes very large.
Benchmarking and Evaluation
Properly evaluating an iCaRL implementation requires standardized metrics and benchmarks.
- Key Metrics:
- Average Accuracy: The average test accuracy across all tasks seen so far after learning the final task.
- Backward Transfer (BWT): Measures the impact of learning new tasks on old ones. iCaRL typically achieves slightly negative BWT, indicating minor forgetting.
- Standard Benchmarks:
- Split CIFAR-100/CIFAR-10: Incrementally learning 10 or 20 classes at a time.
- ImageNet-Subset (e.g., 100 classes split into 10 tasks): A larger-scale benchmark.
- Tools: Libraries like Avalanche (https://avalanche.continualai.org) provide ready-made benchmarks, training loops, and evaluation protocols for iCaRL, accelerating research and comparison.
Frequently Asked Questions
iCaRL (Incremental Classifier and Representation Learning) is a seminal algorithm in class-incremental learning. These questions address its core mechanisms, practical implementation, and its role within the broader field of continual learning.
iCaRL (Incremental Classifier and Representation Learning) is a hybrid continual learning algorithm designed for the class-incremental learning scenario, where a model must learn new classes over time without forgetting old ones. It operates through three coordinated mechanisms: exemplar replay, a nearest-mean-of-exemplars classification rule, and knowledge distillation. First, it maintains a fixed-size memory buffer of real data examples (exemplars) from past classes. During training on new classes, it interleaves these exemplars with new data. Second, it uses a nearest-mean classification rule at inference, comparing a new sample's feature vector to the mean vector of each class's stored exemplars. Third, it applies knowledge distillation loss, using the model's previous version as a teacher to preserve its output responses on new data, thereby anchoring the feature representation. This combination allows iCaRL to learn a unified feature space and classifier for all seen classes incrementally.
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 at the intersection of several key continual learning techniques. These related terms define the specific problems it solves and the mechanisms it employs.
Class-Incremental Learning
The specific continual learning scenario iCaRL is designed for. The model must learn new classes sequentially over time, with a unified classifier that must distinguish between all classes seen so far. This is more challenging than task-incremental learning, where a task identifier is provided at test time.
Key challenges:
- Maintaining a stable representation for old classes.
- Avoiding classifier bias toward newly learned classes.
- Making predictions without knowing the task boundary.
Exemplar Replay
The core memory mechanism of iCaRL. A small, fixed-size buffer stores a subset of real training examples (exemplars) from previously learned classes.
How it works in iCaRL:
- Exemplars are selected using herding, which chooses prototypes that best approximate the class mean in feature space.
- During training on new classes, these stored examples are interleaved with new data.
- This rehearsal directly combats catastrophic forgetting by periodically re-exposing the model to old data distributions.
Knowledge Distillation (for Retention)
A technique iCaRL uses to preserve existing knowledge without requiring excessive exemplar storage. The model being updated is trained to mimic the output (logit) distributions of a frozen copy of itself from the previous learning step.
Role in iCaRL:
- A distillation loss is applied to the data from new classes, encouraging the model to maintain its old classification behavior on these new inputs.
- This acts as a regularizer, anchoring the network's representation for old classes even as it adapts to new ones.
- It complements the direct rehearsal provided by exemplar replay.
Nearest-Mean-of-Exemplars Classification
iCaRL's novel classification rule that replaces the standard softmax output layer. This is crucial for a stable, non-biased classifier in a class-incremental setting.
Process:
- Compute and store a prototype vector (the mean feature representation) for each class using its exemplars.
- At inference, compute the feature vector for a new input.
- Classify by finding the class prototype with the smallest Euclidean (L2) distance.
Advantage: It naturally handles an expanding number of classes without retraining the final layer and avoids bias toward recently learned classes.
Catastrophic Forgetting
The core problem iCaRL is designed to mitigate. This is the tendency of a neural network to abruptly and drastically lose performance on previously learned tasks or classes when trained on new data.
Why it happens: Neural networks trained with standard stochastic gradient descent (SGD) assume independent and identically distributed (i.i.d.) data. Sequential learning on non-i.i.d. streams leads to parameter interference, where updates for a new task overwrite weights critical for old tasks.
iCaRL addresses this via its hybrid approach: exemplar replay for direct rehearsal and knowledge distillation for indirect regularization.
Stability-Plasticity Dilemma
The fundamental trade-off that all continual learning algorithms, including iCaRL, must navigate.
- Stability: The ability to retain knowledge and resist catastrophic forgetting of old tasks.
- Plasticity: The ability to flexibly learn new information and adapt to new tasks.
iCaRL's balance:
- Stability is provided by exemplar replay and knowledge distillation.
- Plasticity is provided by allowing the feature extractor and classifier to update with new class data. The fixed memory budget for exemplars is a direct embodiment of this dilemma, forcing a compromise between perfect retention and efficient new learning.

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