A Shared Encoder Approach to Multimodal Representation Learning

Shuvendu Roy, Franklin Ogidi, Ali Etemad, Elham Dolatabadi, Arash AfkanpourarXiv 2025 · DOI

Introduction

In multimodal machine learning, the standard paradigm—exemplified by models like CLIP—relies on dual-encoder architectures where separate, high-capacity models process images and text independently. While effective in the general domain where billions of data pairs are available, this approach often falters in specialized fields like medicine. High-quality, paired medical data (e.g., radiology images with corresponding clinical notes) is scarce due to privacy restrictions and the high cost of expert annotation. In these "data-poor" environments, dual-encoder systems are prone to overfitting and struggle to generalize.

Researchers from the Vector Institute and Queen’s University propose a "shared encoder" framework to address this challenge. By utilizing a single Transformer to process both modalities, the model leverages parameter sharing as a form of regularization, leading to superior performance in data-constrained medical settings.

Methodology: The Shared Encoder Framework

The core innovation is the replacement of modality-specific encoders with a single shared Transformer block ($E_{shared}$). This architecture forces the model to learn a unified representation space for both visual and textual information.

Comparison of the traditional dual-encoder approach versus the proposed shared encoder framework with modality identifiers.

To enable a single encoder to distinguish between input types, the authors introduced two primary mechanisms:

  1. Modality Identifiers: The model must identify whether an input is an image or text. Two methods were evaluated: Modality Feature Vectors (appending a specific vector to every input embedding) and Modality Tokens (inserting a dedicated token at the beginning of the input sequence).
  2. Architectural Specialization: The study explored "Early" vs. "Late" specialization, where a few modality-specific layers are placed either before or after the shared encoder block.

The system is optimized using a standard Contrastive Loss, aligning paired image and text embeddings in the shared latent space while distancing non-matching pairs.

Experimental Setup

The framework was evaluated across several diverse medical datasets to test both in-distribution and out-of-distribution (OOD) performance, including PMC-OA (1.3M pairs for pretraining), MIMIC-CXR (chest X-rays), Quilt (histopathology), and DeepEyeNet (ophthalmic photography).

Results and Discussion

Performance in Data-Scarce Regimes

The shared encoder approach demonstrates significant advantages as the volume of training data decreases. By reducing the total number of parameters that need to be learned independently for each modality, the model avoids the "memorization" of noise common in small datasets.

Performance comparison between modality-specific and shared encoders across varying training set sizes, showing significant relative gains in low-data scenarios.

As shown in the table above, the relative improvement of the shared encoder over the modality-specific baseline grows dramatically as the training set size is reduced. At 0.33 million pairs (25% of the full set), the shared encoder achieves a ~29.57% relative improvement in Text-to-Image retrieval.

Key Insights

  • Parameter Efficiency: A 125M parameter shared encoder outperformed a standard CLIP model of equivalent size in 7 out of 8 retrieval tasks. It even surpassed a "Large CLIP" model (210M parameters) in 5 out of 8 tasks, despite having nearly 40% fewer parameters.
  • Modality Handling: Experimental results indicated that Modality Feature Vectors outperformed single tokens. This suggests that providing a persistent signal of the input modality throughout the shared layers is more effective for maintaining modality-specific nuances.
  • Early Specialization: Placing modality-specific layers before the shared block (early specialization) was found to be more effective than late specialization. This implies that while high-level reasoning can be shared, the initial processing of raw pixels versus text tokens still benefits from specialized "perceptual" layers.

Conclusion

The shared encoder framework represents a paradigm shift for multimodal learning in specialized domains. By treating parameter sharing as a powerful regularizer, the model achieves state-of-the-art results in medical image-text retrieval while being significantly more data-efficient than traditional dual-encoder architectures. Future research will explore the scalability of this approach to multi-billion parameter models and its applicability to generative tasks such as automated medical report generation.

Summary updated

BibTeX
@misc{roy2025shared,
  author = {Shuvendu Roy and Franklin Ogidi and Ali Etemad and Elham Dolatabadi and Arash Afkanpour},
  title = {{A Shared Encoder Approach to Multimodal Representation Learning}},
  year = {2025},
  eprint = {2503.01654},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2503.01654},
}
Figure