Task-Customized Self-Supervised Pre-training with Scalable Dynamic Routing

Zhili Liu, Jianhua Han, Lanqing Hong, Hang Xu, Kai Chen, Chunjing Xu, Zhenguo Li

Introduction

In self-supervised learning (SSL), the prevailing paradigm suggests that pre-training on massive, diverse datasets—such as the entirety of ImageNet—is the most effective way to learn robust, general-purpose representations. However, this "more is better" approach often overlooks the phenomenon of negative transfer, where irrelevant data during the pre-training phase can actually degrade performance on specific downstream tasks. For instance, a model intended for aircraft classification may be hindered by features learned from datasets dominated by biological entities like cats and dogs.

While the ideal solution would be to pre-train a custom model for every specific downstream task, the computational cost of SSL makes this approach prohibitive. To address this, we present Scalable Dynamic Routing (SDR), a framework that enables the training of a single "super-net" containing 256 specialized sub-nets. This allows for task-customized pre-training at a fraction of the cost of training individual networks.

The Challenge: Negative Transfer

The authors' preliminary experiments confirm that semantic similarity between pre-training data and downstream tasks is a critical driver of transfer success. In tests, a model pre-trained only on a subset of ImageNet semantically related to the target task (e.g., inanimate objects for car classification) outperformed a model trained on the full ImageNet-1K dataset. This discovery highlights the need for a system that can provide specialized features without requiring hundreds of separate training runs.

Methodology: Scalable Dynamic Routing (SDR)

The SDR framework consists of four integrated stages designed to balance specialization with computational efficiency:

1. Data Clustering

The process begins by partitioning the unlabeled pre-training dataset (ImageNet-1K) into $k$ semantic clusters. This is achieved using a standard SSL model (SimSiam) to group images based on shared features, creating distinct niches such as "birds," "vehicles," or "household items."

2. SDRnet Architecture

The core of the framework is the SDRnet, which modifies the standard ResNet block. Instead of a monolithic structure, the channels are split into "shared groups" (accessible by all tasks) and "individual groups." A specific "path" through these groups defines a sub-net. This architecture is highly efficient, allowing the total model size to grow log-linearly rather than linearly with the number of paths.

3. Data-aware Progressive Training

Training 256 sub-nets simultaneously is inherently unstable and risks "feature collapse." To mitigate this, the authors employ a progressive training schedule that starts with the largest network and gradually introduces specialized sub-nets. Furthermore, they introduce SiamKD, a custom distillation loss. SiamKD ensures that specialized sub-nets remain anchored to the robust features of the larger super-net, preventing divergence when sub-nets are exposed to smaller data subsets.

4. Dynamic Routing

When a new downstream task is introduced, the system identifies the most appropriate sub-net through a quick "routing" check. For classification tasks, a k-nearest-neighbor (kNN) test determines which sub-net’s features align most closely with the target data.

Experimental Results

The SDR framework was evaluated across 11 diverse classification datasets and the PASCAL VOC detection benchmark.

Downstream Classification

SDR consistently outperformed standard SSL baselines. It achieved an average improvement of 2.38% over SimSiam and 2.23% over BYOL. The benefits of specialization were most evident in specific datasets; for example, on the SUN397 dataset, the task-customized sub-net improved performance by 7.83% compared to a model trained on the full ImageNet.

Object Detection

On the PASCAL VOC 2007/2012 benchmark, SDR improved the baseline by 1.48 points in AP. Notably, this performance gain was achieved using a sub-net that contained slightly fewer parameters than a standard ResNet-50, demonstrating the efficiency of the routed architecture.

Key Insights

  • Efficiency through Sparsity: SDR manages 256 sub-nets with a total training cost less than twice that of a single standard SSL baseline, making it significantly more scalable than traditional Multi-Task Learning (MTL) methods.
  • Semantic Alignment: The system's routing often aligns with intuitive semantic categories. For example, the best sub-net for "FGVC Aircraft" was found to be the one trained on clusters containing kites and large birds, confirming that relevant semantic features are the primary drivers of transfer.
  • The Role of Distillation: Without SiamKD, specialized sub-nets often failed to outperform the general model, proving that knowledge distillation is essential when training on specialized data subsets.

Limitations and Future Directions

While SDR represents a significant step forward, it relies heavily on the quality of the initial clustering. If the initial SSL model fails to create meaningful semantic partitions, the resulting sub-nets may lack utility. Additionally, while routing for classification is fast, routing for object detection currently requires a more intensive "early stopping" fine-tuning process. Finally, the authors noted that semantic clustering is less effective for non-object-centric tasks, such as texture classification (DTD). Future research may explore clustering along other dimensions, such as color, texture, or frequency components, to broaden the framework's applicability.

Summary updated

BibTeX
@inproceedings{liu2022task,
  author = {Zhili Liu and Jianhua Han and Lanqing Hong and Hang Xu and Kai Chen and Chunjing Xu and Zhenguo Li},
  title = {{Task-Customized Self-Supervised Pre-training with Scalable Dynamic Routing}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2022},
  doi = {10.1609/aaai.v36i2.20079},
}
Figure