From Bricks to Bridges: Product of Invariances to Enhance Latent Space Communication

Irene Cannistraci, Luca Moschella, Marco Fumero, Valentino Maiorca, Emanuele Rodolà

In the world of deep learning, we often treat neural networks as monolithic "bricks"—black boxes trained for specific tasks. But what if we want to build a bridge between them? What if you could take the "eyes" (encoder) of a Vision Transformer and plug them into the "brain" (decoder) of a ResNet without any additional training?

This is the promise of latent space communication, and a new paper from ICLR 2024, titled "From Bricks to Bridges: Product of Invariances to Enhance Latent Space Communication," offers a powerful new way to make it happen.

TL;DR

Neural networks trained on similar data learn similar concepts but represent them in different "latent languages" due to random initialization and architectural quirks. This paper introduces a Product of Invariances framework that automatically aligns these disparate latent spaces by combining multiple geometric perspectives, enabling seamless "zero-shot stitching" of models across vision, text, and graph modalities.

What Problem Does This Paper Address?

When two neural networks are trained on the same dataset, they learn similar internal representations. However, if you try to "stitch" the encoder of Model A to the decoder of Model B, it typically fails miserably. Why? Because their latent spaces are transformed versions of each other—one might be rotated, another scaled, and another shifted.

Previous research into Relative Representations (RR) tried to solve this by representing data points not by their absolute coordinates, but by their distances to a set of fixed "anchor" points. However, RR typically assumed a single type of transformation (like angle-preserving rotations).

The authors of this paper demonstrate a crucial gap: there is no universal transformation. Depending on the architecture (CNN vs. Transformer) or the dataset (Images vs. Text), the "bridge" between models might need to account for rotations, translations, or even more complex non-linear warping.

Conceptual diagram of latent space alignment using relative representations.

Methods: The "Product Space" Approach

The authors propose a versatile framework that doesn't try to guess the "right" invariance. Instead, it incorporates a Product of Invariances.

  1. Multiple Perspectives: Instead of using just one similarity metric (like Cosine similarity), they project the latent space into multiple subspaces using different metrics: Cosine, Euclidean, $L_1$ (Manhattan), and $L_\infty$ (Chebyshev).
  2. Geometric Invariance: Each metric is naturally "blind" (invariant) to certain transformations. For example, Cosine similarity is invariant to scaling, while Euclidean distance is invariant to rotations and translations.
  3. Aggregation: These invariant components are then fused together. The authors tested several strategies, finding that Aggregation by Sum (MLP+Sum)—where each subspace is processed by a small neural network and then summed—performed best.
  4. Zero-Shot Stitching: Because this "product space" is invariant to a wide class of transformations, it acts as a universal translator. You can take an encoder, pass its output through this invariant bridge, and feed it directly into a decoder trained on a completely different model instance.

Datasets

The authors conducted an exhaustive evaluation across three distinct modalities:

  • Vision: MNIST, Fashion-MNIST, CIFAR-10, CIFAR-100, and the massive ImageNet-1k.
  • Text: DBpedia, TREC (Coarse and Fine), and N24news.
  • Graphs: The CORA citation network.
  • Models: They tested 12 foundational models, including BERT, RoBERTa, ALBERT, ViT, and RexNet.

Key Insights and Ideas

  • The "No Free Lunch" of Invariance: While Cosine similarity might be best for aligning two specific CNNs, it might be the worst choice for aligning a CNN with a Transformer. The transformation class is highly dependent on the "inductive biases" of the architecture.
Linear CKA scores across different architectures and invariances on CIFAR-10.
  • Complexity Capturing: By using a product of spaces, the model can capture complex, hybrid transformations that a single metric would miss. It’s like looking at an object from four different angles simultaneously to get a complete 3D picture.
  • The Stitching Index: They introduce a "Stitching Index" to measure how much performance is lost during the "translation." A score of 1.0 means the stitched model performs exactly as well as the original end-to-end model. Their method frequently hits this 1.0 mark.

Key Results

  • Superior Stitching: In ImageNet-1k classification, the "Product of Invariances" achieved 0.67 accuracy, significantly outperforming any single-metric baseline (e.g., Euclidean at 0.52 or Cosine at 0.50).
  • Visual Clarity: In image reconstruction tasks, using a single invariance often resulted in blurry or distorted images. The product space produced much sharper, more accurate reconstructions, proving it preserves more meaningful information.
  • Cross-Architecture Success: The method successfully stitched models with completely different architectures (e.g., stitching a RexNet encoder to a ViT decoder), a feat that is traditionally very difficult.

Limitations and Future Work

  • Analytical vs. Learned: Currently, the framework relies on a fixed set of manually chosen distance metrics. The authors suggest that learning the optimal similarity functions from data could be a promising next step.
  • Anchor Dependency: While the method is robust, it still requires a set of "anchor" points. Optimizing how these anchors are selected (rather than just picking them randomly) could further boost performance.
  • Computational Overhead: Adding more similarity metrics increases the number of projections required, though the authors mitigated this by keeping the total dimensionality constant for fair comparison.

This work marks a significant step toward a modular future for AI, where we can mix and match the best components from different models as easily as snapping together LEGO bricks.

Summary updated

BibTeX
@inproceedings{cannistraci2024from,
  author = {Irene Cannistraci and Luca Moschella and Marco Fumero and Valentino Maiorca and Emanuele Rodolà},
  title = {{From Bricks to Bridges: Product of Invariances to Enhance Latent Space Communication}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=vngVydDWft},
}
Figure