Few-Shot Learning by Dimensionality Reduction in Gradient Space

Martin Gauch, Maximilian Beck, Thomas Adler, Dmytro Kotsur, Stefan Fiel, Hamid Eghbal-zadeh, Johannes Brandstetter, Johannes Kofler, Markus Holzleitner, Werner Zellinger, Daniel Klotz, Sepp Hochreiter, Sebastian Lehner

Abstract

We introduce Subspace Gradient Descent (SubGD), a novel few-shot learning method based on the recent finding that stochastic gradient descent (SGD) updates tend to reside in a low-dimensional parameter subspace. In few-shot learning (FSL) scenarios, standard fine-tuning often leads to severe overfitting due to the high dimensionality of the parameter space relative to the available data. SubGD addresses this by restricting model updates to a low-dimensional subspace learned from previous tasks. Our experiments demonstrate that SubGD significantly improves sample efficiency, particularly in "parametric transfer" tasks involving physical and dynamical systems, where it outperforms established meta-learning baselines.

Introduction

Deep learning models are notoriously data-hungry. When adapted to new scenarios with only a handful of examples—a challenge known as few-shot learning—standard optimization techniques like SGD often fail. The network's vast number of parameters provides too many degrees of freedom, allowing it to memorize small datasets rather than learning generalizable patterns.

While many FSL methods focus on finding optimal initializations (e.g., MAML) or complex meta-architectures, they often target categorical transfer (like recognizing new image classes). However, in scientific and engineering domains, new tasks often involve the same underlying physical laws operating under different parameters—such as an electrical circuit with varying components or a hydrological model adapting to a new geography. SubGD is specifically designed to exploit the shared structure of these parametric transfer tasks by constraining the optimization process itself.

Methodology: Subspace Gradient Descent (SubGD)

SubGD modifies the fine-tuning optimizer to operate within a data-driven, low-dimensional subspace. The process consists of four primary stages:

  1. Trajectory Collection: The model is first trained on a variety of data-rich tasks. The resulting weight update directions (the difference between initial and final weights for each task) are recorded.
  2. Subspace Identification: An auto-correlation matrix of these update directions is computed. Through eigendecomposition, the most significant directions—the "subspace"—are identified.
  3. Constrained Fine-Tuning: When presented with a new few-shot task, SubGD projects all gradient updates into this predefined subspace, preventing the model from moving in directions that were not useful in prior tasks.
  4. Eigenvalue Scaling: To further regularize the model, SubGD scales the learning rate in each subspace direction by its corresponding eigenvalue. This naturally dampens updates in less certain directions, reducing the need for manual hyperparameter tuning of the subspace dimensionality.
Conceptual overview of Subspace Gradient Descent (SubGD). Updates from an initial point $\theta_0$ to various task optima ($\theta, \theta', \theta''$) are constrained to a low-dimensional subspace spanned by vectors $v_1, v_2$.

SubGD is architecture-agnostic and can be integrated with various initialization strategies, including random initialization, standard pre-training, or meta-learned initializations like Reptile or MAML.

Experimental Results

We evaluated SubGD across several benchmarks emphasizing parametric transfer, comparing it against standard SGD and popular meta-learning algorithms.

Parametric Transfer Performance

In Sinusoid Regression, SubGD achieved an MSE of 0.065 on 5-shot tasks, significantly outperforming MAML (0.301) and MetaSGD (0.410). Similar gains were observed in a Non-linear RLC Circuit simulation, where SubGD combined with Reptile initialization yielded a median MSE of 0.054, compared to 0.058 for standard Reptile and 2.673 for Jacobian Feature Regression.

In a real-world Hydrology task—predicting river runoff across different geographical basins—SubGD demonstrated superior sample efficiency. Using a 14-shot setting, SubGD combined with first-order MAML (foMAML) achieved a Nash–Sutcliffe Efficiency (NSE) of 0.953, surpassing the 0.949 achieved by standard foMAML.

Performance comparison of SubGD against baselines across different initialization strategies. SubGD (dark blue triangles) consistently achieves lower Average MSE than standard SGD (orange circles) across various support sizes and pre-training regimes.

Discussion and Insights

Why SubGD Works

The success of SubGD stems from its role as a powerful, data-driven regularizer. By forcing the network to stay within a subspace where learning has historically been successful, it effectively reduces the hypothesis space to a manageable size for few-shot data. The eigenvalue weighting acts as an automatic dampener, ensuring that the optimizer prioritizes the most robust directions of adaptation.

Limitations: Categorical vs. Parametric Transfer

SubGD relies on the existence of a shared low-dimensional subspace across tasks. While this holds true for dynamical systems governed by consistent physics, it is less applicable to categorical transfer tasks like miniImageNet. In image classification, new categories often require the network to move in entirely new, orthogonal parameter directions. Analysis shows that for such datasets, the effective rank of updates does not saturate, explaining why SubGD does not provide the same benefits in standard computer vision benchmarks.

Conclusion

Subspace Gradient Descent offers a robust framework for few-shot learning in domains where tasks share underlying causal or physical mechanisms. By constraining optimization to a learned subspace, it provides a simple yet effective way to prevent overfitting and improve adaptation speed. Future work may explore non-linear manifolds for gradient restriction or methods to explicitly encourage low-dimensional subspaces during the initial training phase.

Summary updated

BibTeX
@inproceedings{gauch2022few,
  author = {Martin Gauch and Maximilian Beck and Thomas Adler and Dmytro Kotsur and Stefan Fiel and Hamid Eghbal-zadeh and Johannes Brandstetter and Johannes Kofler and Markus Holzleitner and Werner Zellinger and Daniel Klotz and Sepp Hochreiter and Sebastian Lehner},
  title = {{Few-Shot Learning by Dimensionality Reduction in Gradient Space}},
  booktitle = {CoLLAs},
  year = {2022},
  url = {https://openreview.net/forum?id=pJ1ydUVSOPV},
}
Figure