Geometry-Aware Adaptation for Pretrained Models

Nicholas Roberts, Xintong Li, Dyah Adila, Sonia Cromp, Tzu-Heng Huang, Jitian Zhao, Frederic Sala

Abstract

Pretrained models often struggle to generalize to classes not seen during training without expensive fine-tuning. We present LOKI, a geometry-aware adaptor that leverages the relational distances between labels to enable zero-shot prediction of unobserved classes. By replacing the standard argmax decision rule with the Fréchet mean in a metric space, LOKI achieves significant performance gains—up to 29.7% on ImageNet—without additional training. This approach demonstrates that structural information in label spaces, such as taxonomies or embedding distances, can serve as a powerful substitute for raw training data.

Introduction

The current paradigm in machine learning relies heavily on massive pretrained models. However, these models are often "blind" to classes they did not encounter during their initial training phase. For instance, a model trained to recognize 1,000 types of objects will likely fail if asked to identify a 1,001st type, even if that new type is closely related to known categories (e.g., a specific rare breed of dog).

Traditionally, addressing this limitation requires fine-tuning: a process of collecting new labeled data and retraining the model, which is both computationally expensive and time-consuming. This research explores an alternative: adapting a model to predict new classes using only the "relational information" already available about labels. If we know that a "Husky" is taxonomically positioned between a "Wolf" and a "Malamute," can we leverage a model's existing knowledge of those two classes to identify the third? LOKI (referring to the loci of the Fréchet mean) provides a framework to do exactly this.

Methodology: The LOKI Framework

LOKI introduces a fundamental change to the final step of the standard prediction pipeline.

From Argmax to Fréchet Mean

In a standard prediction pipeline, a model outputs a probability vector, and the final classification is determined by the argmax rule—selecting the class with the highest probability. LOKI replaces this with the Fréchet mean. It treats the model's output probabilities as weights and identifies the point in the label space that minimizes the weighted squared distance to all observed classes.

Mathematically, this allows the model to "interpolate" between known labels to find the most likely candidate in a broader metric space.

Implementation as a Linear Adaptor

A significant advantage of LOKI is its efficiency. It can be implemented as a fixed linear transformation. By multiplying the model's output vector by a pre-computed distance matrix $D$, LOKI acts as a "plug-and-play" solution for existing pipelines. This transformation requires no additional training parameters, making it a zero-shot adaptation technique.

Metric Spaces and Locus Analysis

LOKI is versatile across any label space equipped with a metric (distance function). This includes:

  • WordNet hierarchies and taxonomic trees.
  • Knowledge graphs.
  • Embedding distances derived from text or image encoders.

The authors also introduce the concept of "locus analysis" to determine the set of all classes a model could potentially predict given a specific set of training labels. This theoretical framework enables an active learning strategy to strategically select which new classes to label to maximize the "coverage" of the entire label space.

Experimental Evaluation

The researchers evaluated LOKI across several high-cardinality benchmarks to test its scalability and accuracy:

  • CIFAR-100: Testing zero-shot improvements on models like CLIP and ALIGN.
  • ImageNet: Utilizing the WordNet phylogenetic tree to adapt from a subset of classes to the full 1,000-class set.
  • PubMed: A medical literature dataset with 9,419 classes.
  • LSHTC: A massive text classification dataset featuring 325,056 classes.

Key Results

  • Zero-Shot Performance: On CIFAR-100, LOKI improved CLIP’s performance by 19.53% relative to the baseline simply by incorporating WordNet hierarchy distances.
  • Internal Metrics: Even without an external knowledge base, using distances between the model's own internal embeddings as a metric yielded a 10.57% improvement for CLIP.
  • ImageNet Gains: LOKI provided up to a 29.7% relative improvement over SimCLR on ImageNet when adapting to unobserved classes.
  • Massive Scaling: On the LSHTC dataset, LOKI significantly outperformed standard 5-Nearest Neighbor baselines, demonstrating its robustness in extremely large, sparse label spaces.

Discussion and Insights

Geometry as a "Free" Signal

Relational data, such as ontologies or hierarchies, is often readily available or easily generated. LOKI proves that this structural information is a powerful substitute for raw training data. Furthermore, the authors prove that the standard argmax rule is actually a special case of LOKI: if one assumes all labels are equally distant from each other (a "complete graph"), LOKI naturally simplifies back to argmax.

The Role of Calibration

LOKI’s performance is sensitive to the "confidence" of the underlying model. Tuning the softmax temperature (calibration) is essential, as it determines how much the geometric "pull" of different labels influences the final result. Proper calibration ensures that the Fréchet mean accurately reflects the model's uncertainty.

Reaching the Unreachable

Through "locus covers," the paper demonstrates that training on every class is not a prerequisite for predicting every class. In tree-structured label spaces, training only on the "leaves" is sufficient to predict any internal node, effectively expanding the model's reach without expanding the training set.

Limitations and Future Work

While LOKI offers a powerful tool for adaptation, it is dependent on the quality of the provided metric space. If the "map" of the labels is inaccurate, the adaptation will fail. Additionally, as a simple adaptor, LOKI may inherit or amplify biases present in the underlying pretrained model.

Future research may explore using LOKI to "steer" models away from harmful misclassifications by embedding safety constraints directly into the label metric space, or addressing the memory challenges associated with storing distance matrices for millions of classes in production environments.

Summary updated

BibTeX
@inproceedings{roberts2023geometry,
  author = {Nicholas Roberts and Xintong Li and Dyah Adila and Sonia Cromp and Tzu-Heng Huang and Jitian Zhao and Frederic Sala},
  title = {{Geometry-Aware Adaptation for Pretrained Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=exGOXqxR0L},
}
Figure