Skip to main content
QUICK REVIEW

[Paper Review] Contrastive Learning and Mixture of Experts Enables Precise Vector Embeddings

Logan Hallee, R. Kapur|arXiv (Cornell University)|Jan 28, 2024
Educational Technology and AssessmentComputer Science3 citations
TL;DR

This paper proposes a contrastive learning and Mixture of Experts (MoE) framework to generate precise, domain-specific vector embeddings for scientific text, using co-citation networks to build training data and Multiple Negative Ranking (MNR) loss for contrastive fine-tuning. The MoE approach achieves performance equivalent to N separate models with a single, scalable, one-size-fits-all architecture, significantly improving sentence similarity metrics in biomedical domains like cardiovascular disease and COPD.

ABSTRACT

The advancement of transformer neural networks has significantly elevated the capabilities of sentence similarity models, but they still struggle with highly discriminative tasks and may produce sub-optimal representations of important documents like scientific literature. With the increased reliance on retrieval augmentation and search, representing diverse documents as concise and descriptive vectors is crucial. This paper improves upon the vectors embeddings of scientific text by assembling niche datasets using co-citations as a similarity metric, focusing on biomedical domains. We apply a novel Mixture of Experts (MoE) extension pipeline to pretrained BERT models, where every multi-layer perceptron section is enlarged and copied into multiple distinct experts. Our MoE variants perform well over $N$ scientific domains with $N$ dedicated experts, whereas standard BERT models excel in only one domain at a time. Notably, extending just a single transformer block to MoE captures 85% of the benefit seen from full MoE extension at every layer. This holds promise for versatile and efficient One-Size-Fits-All transformer networks for numerically representing diverse inputs. Our methodology marks advancements in representation learning and holds promise for enhancing vector database search and compilation.

Motivation & Objective

  • To address the poor performance of general-purpose LLMs in niche scientific domains due to overgeneralization or over-sensitivity to minor differences.
  • To improve sentence similarity and text classification accuracy in specialized biomedical subfields like CVD and COPD.
  • To develop a scalable, universal model architecture capable of high-accuracy inference across multiple scientific domains.
  • To leverage co-citation networks as a weakly supervised signal for efficient, large-scale dataset construction.
  • To demonstrate that MoE-based fine-tuning with enforced routing can match the performance of N individual models while remaining computationally efficient.

Proposed method

  • Constructed training datasets using co-citation networks from PubMed Central, where co-cited papers are labeled as similar.
  • Fine-tuned BERT-based models using contrastive learning with a Multiple Negative Ranking (MNR)-inspired loss to optimize semantic similarity.
  • Introduced domain-specific special tokens and enforced routing to guide expert selection in the MoE architecture during inference.
  • Implemented MoE seeding with N experts and N corresponding special tokens, enabling scalable adaptation to N different domains.
  • Used abstracts only for faster training while maintaining high performance on downstream similarity tasks.
  • Employed a router mechanism that selects one expert per transformer block per input, enabling efficient and dynamic routing.
Figure 1: Determination of abstract pair similarity for model evaluation
Figure 1: Determination of abstract pair similarity for model evaluation

Experimental results

Research questions

  • RQ1Can co-citation networks be effectively used to create large-scale, domain-specific training data for sentence similarity models?
  • RQ2Does contrastive fine-tuning with MNR loss improve the precision of vector embeddings in specialized scientific domains?
  • RQ3Can a Mixture of Experts (MoE) architecture achieve performance equivalent to N separate fine-tuned models while remaining computationally efficient?
  • RQ4Does enforced routing with domain-specific special tokens improve expert selection and model generalization across domains?
  • RQ5What is the minimum model size required for effective MoE performance in scientific text representation?

Key findings

  • The SciBERT MoE and SciBERT SE models achieved an F1_max of 0.97, accuracy of 0.97, and average distance of 0.48 on the CVD validation set, outperforming base models.
  • On the CVD test set, SciBERT variants achieved 1.00 accuracy and an average distance of 0.01, indicating highly precise vector clustering.
  • The Mini SE model achieved 0.97 accuracy on CVD and 0.56 on COPD, with average distances of 0.23 and 0.33 respectively, suggesting limitations in generalization on low-data domains.
  • The MoE approach matched the performance of separate expert models, demonstrating that a single universal model can handle multiple domains effectively.
  • The BiomedBERT base model achieved an average test set distance of 0.01 on both CVD and COPD, indicating strong baseline performance, likely due to data overlap.
  • Mini MoE variants underperformed, suggesting a minimum model size is required for effective MoE training, likely due to insufficient capacity in shared attention layers.
Figure 2: Typical ChatGPT Response to a Set of Similar Papers, qualitatively classifying all similar papers as dissimilar.
Figure 2: Typical ChatGPT Response to a Set of Similar Papers, qualitatively classifying all similar papers as dissimilar.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.