Expectation-Maximization Contrastive Learning for Compact Video-and-Language Representations

Peng Jin, Jinfa Huang, Fenglin Liu, Xian Wu, Shen Ge, Guoli Song, David A. Clifton, Jie Chen

TL;DR

Standard contrastive learning for video-text retrieval often struggles with a persistent "modality gap" and relies heavily on massive batch sizes for negative sampling. This paper introduces Expectation-Maximization Contrastive Learning (EMCL), a novel approach that uses the EM algorithm to project features into a compact, low-rank semantic subspace before applying contrastive loss. By stripping away semantically irrelevant redundancies, EMCL significantly boosts retrieval performance and can even be dropped into existing models as a plug-and-play module without retraining.

What Problem Does This Paper Address?

Contrastive learning (like OpenAI's CLIP) is the dominant paradigm for aligning video and text representations. It works by pulling matching video-text pairs together and pushing unmatched pairs apart in a shared latent space.

However, this shared space is rarely optimal. It often retains a "modality gap"—a clear dividing line between visual and textual features—and struggles to group instances of the exact same semantic class if they come from different modalities.

t-SNE visualization showing the modality gap in base models versus the mixed semantic clustering in EMCL.

Furthermore, contrastive learning usually requires huge batch sizes or memory banks to supply enough negative samples to properly shape the space. The authors identify that the raw feature space contains a lot of semantically irrelevant redundancy, which prevents the model from forming tight, modality-agnostic semantic clusters.

Methods

To filter out feature redundancy and learn a compact latent space, the authors propose Expectation-Maximization Contrastive Learning (EMCL).

Diagram of the Expectation-Maximization Contrastive Learning (EMCL) module.
  • Maximum Probability Projection: Instead of contrasting raw features directly, they use the Expectation-Maximization (EM) algorithm to find a set of $K$ optimal reconstruction bases (subspaces) that represent shared semantic concepts.
  • Feature Reconstruction: Both video and text features are re-represented as linear combinations of these $K$ bases. This acts as a bottleneck that strips away redundant, non-semantic dimensions.
  • Contrastive Learning: Standard InfoNCE contrastive loss is then applied to these new, compact representations.
  • EMCL-Net & Initialization Strategy: The EM algorithm is notoriously sensitive to initialization; random initialization per batch causes wild fluctuations. To fix this, the authors introduce an inter-batch information transfer mechanism. They maintain a moving average of the subspace bases across batches to initialize the EM algorithm, ensuring stable convergence.
  • Plug-and-Play Modularity: EMCL can be inserted at the end of any dual-encoder architecture. It can be trained jointly with the base model or used out-of-the-box during inference without any extra training.

Datasets

The authors evaluated their method on three standard text-video retrieval benchmarks:

  • MSR-VTT: 10,000 videos with 20 text descriptions each (also used for downstream Video Captioning and Video QA tasks).
  • ActivityNet Captions: 20,000 long videos with multiple sentence descriptions.
  • LSMDC: 118,081 video clips sourced from 202 movies.

Key Insights and Ideas

  • Redundancy hinders contrastive learning: The raw feature spaces produced by standard encoders contain noise and redundant dimensions. This makes it hard to push/pull samples effectively unless you have massive negative sample batches to force the geometry.
  • EM as a semantic filter: By forcing features to be reconstructed from a small set of $K$ shared bases (e.g., $K=32$), the model naturally drops the modality-specific noise that causes the visual/textual "modality gap."
  • Initialization is everything for EM in deep learning: Applying EM per-batch usually fails because random initialization prevents stable learning. The authors' trick of maintaining a moving average of the bases across batches is the secret sauce making EM viable in deep contrastive learning.
  • Zero-shot modularity: Because EMCL maps features to themselves (just filtered), it is model-agnostic. It can be bolted onto already-trained models to instantly improve their feature space without updating their underlying weights.

Key Results

  • State-of-the-Art Performance: EMCL achieved top results on the MSR-VTT dataset (1k-A split), hitting 51.6% R@1 for text-to-video and 51.8% R@1 for video-to-text retrieval.
  • Consistent Gains: It consistently outperformed baselines on ActivityNet (50.6% R@1 text-to-video) and LSMDC (25.9% R@1 text-to-video).
  • Plug-and-Play Boost: When applied as a drop-in module to existing strong baselines (MMT, CLIP4Clip, DCR), EMCL boosted text-to-video R@1 by up to 3.5% and video-to-text R@1 by up to 4.2%.
  • Versatility: The compact representations also improved downstream generative tasks, bumping Video Captioning BLEU-4 from 45.2 to 45.3, and Video QA accuracy from 45.0% to 45.8%.

Limitations and Future Work

  • Limitations: The performance of EMCL is highly dependent on the hyperparameter $K$ (the number of subspaces). If $K$ is too small, the model loses the ability to reconstruct nuanced features; if $K$ is too large, intra-class variance increases, defeating the purpose of the compact space. Additionally, while lighter than alternatives like PCA, the EM algorithm still adds an $O(BDK)$ computational overhead during routing.
  • Future Work: The authors suggest applying this method to other contrastive learning domains beyond video-text retrieval, particularly in scenarios where samples contain highly redundant dimensions or where gathering large numbers of negative samples is computationally prohibitive.

Summary updated

BibTeX
@inproceedings{jin2022expectation,
  author = {Peng Jin and Jinfa Huang and Fenglin Liu and Xian Wu and Shen Ge and Guoli Song and David A. Clifton and Jie Chen},
  title = {{Expectation-Maximization Contrastive Learning for Compact Video-and-Language Representations}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
  url = {https://openreview.net/forum?id=HfCgXCX-Vg},
}
Figure