Latent Functional Maps: a spectral framework for representation alignment

Marco Fumero, Marco Pegoraro, Valentino Maiorca, Francesco Locatello, Emanuele Rodolà

TL;DR

Latent Functional Maps (LFM) introduces a spectral geometry framework to align the internal representations of different neural networks. By shifting the problem from mapping individual data points to mapping entire function spaces defined on data manifolds, the authors provide a "swiss-army knife" for measuring model similarity, finding correspondences, and "stitching" together components from different models with unprecedented sample efficiency.

What Problem Does This Paper Address?

Deep learning models are often "black boxes" that represent data as points on low-dimensional manifolds embedded in high-dimensional spaces. A major challenge in the field is representation alignment: how do we compare or connect the "latent spaces" of two different models?

If Model A and Model B both learn to recognize cats, their internal "concepts" of a cat should be similar, even if their architectures are different. Current tools like Canonical Correlation Analysis (CCA) or Centered Kernel Alignment (CKA) help measure this similarity, but they have flaws. For instance, CKA is notoriously sensitive to local shifts in data that don't actually change the underlying semantics. Furthermore, most existing methods struggle to effectively "transfer" knowledge between models without extensive retraining or a massive amount of overlapping data.

Methods

The authors propose Latent Functional Maps (LFM), adapting a concept from 3D shape processing to the world of neural latent spaces.

Latent Functional Maps Framework

The process follows three main steps:

  1. Graph Construction: They treat latent representations as samples from a manifold and build a k-nearest neighbor (k-NN) graph.
  2. Spectral Decomposition: They compute the graph Laplacian and its eigenvectors. Think of these eigenvectors as the "natural frequencies" or "vibrations" of the data's shape—much like a Fourier transform for a manifold.
  3. Functional Mapping: Instead of trying to find a complex non-linear mapping between millions of points, they solve for a small matrix ($C$) that aligns the functional bases (the eigenvectors) of the two spaces.

This approach allows them to express complex relationships as simple linear transformations in the "spectral domain." They can use "descriptors" (like labels or distance functions) to guide this alignment in supervised, weakly supervised, or even unsupervised settings.

Datasets

The authors demonstrate the versatility of LFM across multiple modalities and scales:

  • Image Classification: CIFAR-10, CIFAR-100 (coarse and fine-grained), and the massive ImageNet.
  • Fine-grained Recognition: Caltech-UCSD Birds-200-2011 (CUB).
  • Handwritten Digits: MNIST and FashionMNIST.
  • Text Classification: AgNews.
  • Word Embeddings: Aligning FastText and Word2Vec spaces.

Key Insights and Ideas

  • From Points to Functions: The core insight is realizing that it's easier to align the geometry of the space (via functions) than the individual points themselves. This makes the alignment much more robust to noise and architectural differences.
  • Interpretability through Distortion: LFM isn't just a black box; it’s interpretable. By looking at the "area distortion" of the map, researchers can actually localize where two models disagree on the manifold (e.g., identifying exactly which class of images is causing the alignment to fail).
  • Extreme Sample Efficiency: LFM can align two entirely different latent spaces using as few as 5 to 50 "anchor" points (shared examples). Traditional methods often require thousands.
  • Robustness to "Meaningless" Shifts: Unlike CKA, LFM remains stable even when data is perturbed in ways that don't affect classification (like local translations), making it a more reliable metric for representational health.

Key Results

  • Layer Matching: LFM achieved 99.8% accuracy in identifying corresponding layers across 10 different CNN models trained on CIFAR-10, outperforming both CCA (41.4%) and CKA (99.6%).
Layer Matching Comparison: CCA, CKA, and LFM
  • Zero-Shot Stitching: The authors performed "model surgery," taking an encoder from one model and plugging it into the decoder of another. LFM-augmented stitching consistently outperformed standard orthogonal transformations, especially when very few anchors were available.
  • Word Embedding Retrieval: When aligning FastText and Word2Vec, LFM achieved a Mean Reciprocal Rank (MRR) of over 0.8 with only 5 anchors, whereas baseline methods were essentially at zero. With 300 anchors, LFM reached a near-perfect MRR of 0.99.

Limitations and Future Work

While powerful, LFM has a few hurdles:

  • Eigenvector Sensitivity: The performance is sensitive to the number of eigenvectors ($k$) chosen. Finding the optimal number of eigenvectors for a specific manifold remains an open problem.
  • The Full Correspondence Assumption: Currently, the framework assumes that the two domains being aligned overlap significantly. It isn't yet optimized for "partial mappings" (e.g., aligning a model that only knows about dogs with a model that knows about all animals).
  • Computational Scaling: While efficient for the sizes tested, building k-NN graphs for extremely large-scale datasets (millions of points) can become computationally expensive, suggesting a need for more efficient graph approximation techniques in the future.

Summary updated

BibTeX
@inproceedings{fumero2024latent,
  author = {Marco Fumero and Marco Pegoraro and Valentino Maiorca and Francesco Locatello and Emanuele Rodolà},
  title = {{Latent Functional Maps: a spectral framework for representation alignment}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=mfvKEdJ4zW},
}
Figure