Leveraging Hierarchical Taxonomies in Prompt-based Continual Learning

Quyen Tran, Hoang Phan, Minh Le, Tuan Truong, Dinh Phung, Linh Ngo, Thien Nguyen, Nhat Ho, Trung Le

TL;DR

Prompt-based continual learning models often suffer from catastrophic forgetting because the latent space becomes crowded, causing new classes to overlap with old ones. This paper introduces Taxonomy-based Continual Learning (TCL), a framework that dynamically organizes classes into a hierarchical tree using LLMs and applies an optimal transport-guided contrastive loss to keep semantically similar classes distinct.

What Problem Does This Paper Address?

Continual Learning (CL) aims to train deep learning models on a sequence of tasks over time without forgetting previously acquired knowledge. A popular modern approach is prompt-based CL, which keeps a large pretrained backbone (like a Vision Transformer) frozen and only trains a small set of learnable prompts for each new task.

While effective at preventing parameter drift, the authors identify a subtle, overlooked cause of catastrophic forgetting: latent space crowding. As the model learns more tasks, the feature space fills up. When new classes arrive that are visually or semantically similar to older ones (e.g., introducing "willow tree" after already learning "oak tree"), their representations overlap. Because existing methods treat all classes equally during training, the model becomes confused, leading to severe performance degradation on older tasks.

Figure 2. Problem: When new classes arrive, the latent space of a model for all tasks so far becomes fuller, and class representa- tions tend to be overlapped, leading to performance degradation in old tasks. Our solution: We focus on separating easily confused classes whose concepts/labels lie in the same leaf group on a label- based hierarchical taxonomy, suggested by expert knowledge (i.e., ChatGPT - Figure 3). [Best viewed in color mode]

Methods

The authors introduce TCL, which mimics the human cognitive habit of organizing information hierarchically to improve distinction. It consists of three core components:

  1. Dynamic Hierarchical Taxonomy: As new classes emerge, TCL uses an LLM (such as ChatGPT or Llama) as an expert to dynamically insert new labels into a tree-like taxonomy based on their origin, type, and shape. This automatically clusters semantically related classes into "leaf groups."
  2. Group-Based Contrastive Regularization: TCL introduces a novel regularization loss function ($L_G$) that applies Supervised Contrastive Loss at two levels: globally across all classes seen so far, and locally within each leaf group. This forces the model to draw sharper decision boundaries between easily confused classes.
  3. Optimal Transport (OT) Prior: To avoid treating all classes within a leaf group identically, the authors use the frozen pretrained model to calculate the $L2$-Wasserstein distance between class feature distributions. Classes that are naturally closer together in the pretrained space receive higher weights in the contrastive loss, forcing the model to focus its optimization on the most challenging boundaries.
Figure 3. The label-based hierarchical taxonomy obtained when learning Task 3 on Split-CIFAR100. The colors (i.e., blue, red, orange) of the label names represent the order in which the corresponding classes appear. Accordingly, the tree-like taxonomy is gradually developed and detailed over time. [Best viewed in color mode]

Datasets

The framework was evaluated on four widely used class-incremental learning benchmarks:

  • Split CIFAR-100: 100 classes split into 10 sequential tasks.
  • Split ImageNet-R: 200 classes containing structurally difficult or stylized images, split into 10 tasks.
  • 5-Datasets: A challenging composite sequence of five distinct datasets (CIFAR-10, MNIST, Fashion-MNIST, SVHN, and notMNIST).
  • Split CUB-200: A fine-grained dataset of 200 bird species split into 10 tasks.

Key Insights and Ideas

  • Crowding vs. Drifting: By isolating the classification head during testing, the authors proved that "within-task accuracy" remains nearly perfect over time. Forgetting happens primarily because the global classification head cannot distinguish old classes from new, overlapping ones.
  • LLMs as Dynamic Domain Experts: Instead of relying on rigid, pre-defined semantic trees (like WordNet), TCL demonstrates that modern LLMs can reliably generate and expand custom taxonomies on-the-fly as a stream of data arrives.
  • Pretrained Models as Geometric Guides: Pretrained backbones already possess rich geometric intuitions about class similarities. Mining these priors via optimal transport allows the model to predict exactly which new classes pose the highest confusion risk to historical data.
Figure 1. Empirical study about forgetting. We setup the experiment to eliminate factors (I) and (II), which result in feature shift after learning the sequence of tasks - Table (a). Therefore, the ”within task accuracy” on D1, using classification head s1(x) to classify classes within task 1 only, remains over time - Figure (b). However, when using head hψ to classify all classes observed so far, the model accuracy on D1 decrease significantly - Figure (c), suggesting that besides feature shift, there are other factors that lead to forgetting.

Key Results

TCL consistently outperformed all state-of-the-art prompt-based baselines (including HiDe-Prompt, CODA-Prompt, and L2P) across all benchmarks:

  • Final Average Accuracy (FAA): TCL achieved a consistent ~1.5% accuracy boost over the strongest baseline across all datasets (e.g., reaching 93.94% on Split CIFAR-100 and 76.41% on Split ImageNet-R).
  • Forgetting Mitigation: TCL dramatically reduced the Final Forgetting Measure (FFM). Most notably, on the 5-Datasets benchmark, it reduced forgetting to a mere 0.21%, outperforming the runner-up baseline by an absolute margin of 17%.

Limitations and Future Work

The primary limitation of TCL is its dependency on the quality of the generated taxonomy. If the LLM creates an inappropriate structure or misallocates a class to the wrong leaf group, the contrastive constraints will be suboptimal and could harm performance.

For future work, the authors propose extending this taxonomy-driven grouping strategy to more complex computer vision tasks beyond classification, such as Object Detection and Action Recognition, where class overlap and relationship modeling are even more critical.

Summary updated

BibTeX
@misc{tran2024leveraging,
  author = {Quyen Tran and Hoang Phan and Minh Le and Tuan Truong and Dinh Phung and Linh Ngo and Thien Nguyen and Nhat Ho and Trung Le},
  title = {{Leveraging Hierarchical Taxonomies in Prompt-based Continual Learning}},
  year = {2024},
  eprint = {2410.04327},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.04327},
}
Figure