Deep Transfer Learning with Ridge Regression

Shuai Tang, Virginia R. de SaarXiv 2020

Abstract

The large amount of online data and vast array of computing resources enable current researchers in both industry and academia to employ the power of deep learning with neural networks. While deep models trained with massive amounts of data demonstrate promising generalisation ability on unseen data from relevant domains, the computational cost of finetuning gradually becomes a bottleneck in transfering the learning to new domains. We address this issue by leveraging the low-rank property of learnt feature vectors produced from deep neural networks (DNNs) with the closed-form solution provided in kernel ridge regression (KRR). This frees transfer learning from finetuning and replaces it with an ensemble of linear systems with many fewer hyperparameters. Our method is successful on supervised and semi-supervised transfer learning tasks.

Introduction

The standard approach to transfer learning involves taking a model pretrained on a massive dataset, such as ImageNet, and finetuning its weights on a new, smaller target dataset. While effective, this process is computationally expensive, requiring multiple passes of backpropagation through millions of parameters. A faster alternative is to use the pretrained model as a frozen feature extractor, training a simple classifier only on the final layer. However, this often leads to inferior performance because the final layer may be too specialized for the source task, discarding structural information useful for the new domain. This paper proposes a middle ground: a backpropagation-free method that achieves the speed of a frozen extractor with the accuracy of a fully adapted model.

Methodology

The proposed pipeline consists of four key steps designed to eliminate the need for iterative gradient descent:

  1. Low-rank Approximation: High-dimensional feature vectors from multiple deep layers are compressed using CountSketch and the Nyström method. This creates manageable, low-rank approximations in a single forward pass.
  2. Kernel Alignment: To determine which layers are most relevant for a specific task, the authors use an alignment maximization algorithm. This finds a sparse, convex combination of kernels from different layers, effectively "picking" the best features for the target labels.
  3. Kernel Ridge Regression (KRR): Instead of backpropagation, the model uses KRR, which offers a closed-form mathematical solution. This allows for nearly instantaneous training once features are extracted.
  4. Transductive Regression: For semi-supervised scenarios, unlabeled data is incorporated into the KRR framework, allowing the model to learn from the distribution of the test set.

Performance and Layer Selection

The method was evaluated using ResNet-18 and ResNet-34 backbones across several datasets, categorized as in-domain (e.g., CIFAR-10) and out-of-domain (e.g., SVHN, Japanese characters).

Performance comparison on in-domain transfer tasks (CIFAR-10, CIFAR-100, STL-10) showing KRR variants consistently outperforming the Logistic Regression baseline.

As shown in the performance plots, the KRR-based approach (particularly with higher rank approximations like KRR-2048) consistently outperforms the standard top-layer Logistic Regression (LogReg) baseline across varying portions of training data.

One of the most significant findings is the importance of layer diversity. For in-domain tasks, the final layers of the ImageNet-pretrained model are highly effective. However, for out-of-domain tasks, the alignment algorithm often selects features from middle layers, which retain more general structural information.

Heatmaps showing the weight assigned to different layers across various datasets and training data portions. In-domain tasks favor top layers, while out-of-domain tasks often rely on middle layers.

Key Insights and Results

  • Superior Accuracy: The method outperformed the LogReg baseline on 5 out of 6 tasks. On the SVHN dataset, for instance, it achieved approximately 88% accuracy compared to the baseline's 64%.
  • Semi-supervised Strength: The transductive regression component provided a massive advantage when labeled data was scarce, leveraging unlabeled samples to significantly boost performance over standard methods.
  • Efficiency: By relying on a closed-form solution, the method drastically reduces the time and energy required for domain adaptation compared to iterative finetuning.

Limitations and Conclusion

While highly efficient, the KRR models can suffer from calibration issues, where confidence scores do not perfectly align with actual probabilities; the authors suggest temperature scaling as a potential fix. Additionally, the method struggled on the fine-grained CUB200 (birds) dataset, likely due to the difficulty of one-vs-all regression in distinguishing many visually similar classes. Despite these challenges, the approach offers a powerful, fast, and backpropagation-free alternative for deep transfer learning.

Summary updated

BibTeX
@misc{tang2020deep,
  author = {Shuai Tang and Virginia R. de Sa},
  title = {{Deep Transfer Learning with Ridge Regression}},
  year = {2020},
  eprint = {2006.06791},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2006.06791},
}
Figure