Abstract
Catastrophic forgetting remains a significant hurdle in continual learning, where neural networks lose previously acquired knowledge when trained on new tasks. This paper identifies the standard linear softmax classifier as a primary driver of this issue. By replacing the linear layer with a non-linear $k$-nearest neighbor ($k$-NN) classifier and utilizing metric learning to create stable, clustered embeddings, the authors demonstrate significantly improved knowledge retention. Evaluations on CIFAR-10 and ImageNet show that this approach allows models to learn new categories without disrupting the feature space of existing ones, outperforming established methods like EWC and DGR.
Introduction: The "Linearity Trap"
Deep neural networks typically struggle with continual learning—the ability to learn new tasks sequentially without forgetting prior ones. This "catastrophic forgetting" occurs because standard fine-tuning forces global weight updates to accommodate new data.
The authors pinpoint the linear classifier (softmax layer) at the end of most networks as a key culprit. Linear classifiers require features in the penultimate layer to be linearly separable. When new data arrives that isn't linearly separable from old data using current features, the network is forced to overhaul its internal representations, destroying the patterns used for previous tasks. This paper proposes a task-agnostic solution that avoids this "linearity trap" by shifting from global decision boundaries to local similarity-based classification.
Methodology: Metric Learning and $k$-NN
The core of the proposed method is replacing the final softmax layer with a $k$-nearest neighbor ($k$-NN) classifier. To ensure the embedding space is suitable for $k$-NN, the authors employ a modified triplet loss for metric learning.
As shown in Figure 1, the "tight-triplet" loss ($L_{\text{tight-triplet}}$) serves two primary functions:
- Separation: It pushes embeddings of different classes apart by a minimum margin ($M$).
- Clustering: It applies an $L_2$ penalty to pull embeddings of the same class closer together, ensuring high intra-class density.
The model uses dynamic margins and normalized embeddings (effectively using cosine similarity) to maintain stability. Because $k$-NN relies on local clusters rather than global hyperplanes, the network can integrate new data points into the embedding space with minimal disruption to existing clusters.
Experimental Setup
The method was evaluated across several benchmarks designed to test retention in task-agnostic settings:
- MNIST: Split into odd and even digits.
- CIFAR-10: Evaluated in both 2-task (Animals vs. Objects) and 5-task (sequential pairs) scenarios.
- ImageNet: Tested on a random split and a specialized "Dog Split" (120 non-dog vs. 120 dog breeds) to test semantic overlap and feature stability.
Key Results and Insights
The proposed metric learning approach demonstrated superior resilience to forgetting compared to popular regularizers like Elastic Weight Consolidation (EWC) and generative methods like Deep Generative Replay (DGR). On CIFAR-10, the method reduced forgetting by a factor of 2.3x to 6.9x.
As seen in Figure 6, on the challenging ImageNet "Dog Split," the proposed method maintained 44.7% accuracy on the original task after learning the new task. In contrast, even an "oracle" baseline dropped significantly to 30.4%. This highlights the method's ability to remain adaptive (learning new tasks well) while being not forgetful (retaining old knowledge).
Conclusion and Future Work
By moving away from linear separability requirements, this research provides a path toward truly continuous, task-agnostic learning. While the $k$-NN approach introduces some computational overhead and memory requirements for storing embeddings, its performance gains in knowledge retention are substantial. Future work may involve combining this metric learning framework with parameter-biasing or model-expansion techniques to further enhance stability in even longer task sequences.
Summary updated