TLDR: MOSAIC is a multi-stage framework that adapts general-domain sentence embedding models to specialized domains by jointly optimizing masked language modeling (MLM) and contrastive objectives. It achieves this by first expanding the model’s vocabulary with domain-specific tokens, then applying a targeted MLM on these new tokens alongside contrastive learning, and finally refining with contrastive-only training. This approach significantly improves performance in both high-resource (biomedical) and low-resource (Islamic) domains, demonstrating robust domain adaptation without compromising the model’s original semantic discrimination capabilities.
In the rapidly evolving world of artificial intelligence, language models have become incredibly powerful tools, capable of understanding and generating human-like text. However, these large models, often trained on vast amounts of general internet data, sometimes struggle when applied to highly specialized fields like medicine or religious studies. This is where a new approach called MOSAIC comes in.
MOSAIC, which stands for “Masked Objective with Selective Adaptation for In-domain Contrastive learning,” is a clever multi-stage system designed to help these powerful language models adapt to specific domains. Imagine you have a brilliant student who knows a lot about general topics, but you want them to become an expert in, say, biomedical research. You wouldn’t just throw a pile of medical textbooks at them; you’d guide their learning, focusing on new vocabulary and how concepts relate specifically within that field. MOSAIC does something similar for AI models.
The core challenge MOSAIC addresses is how to make a general-purpose sentence embedding model—which is excellent at understanding the meaning of sentences across various topics—also excel in a niche domain without losing its original strengths. Previous attempts to combine different learning methods, like “masked language modeling” (MLM) and “contrastive learning,” often led to conflicts, where one objective would overpower the other, resulting in suboptimal performance.
How MOSAIC Works: A Three-Stage Journey
MOSAIC tackles this by breaking down the adaptation process into three distinct stages:
Stage 1: Expanding the Vocabulary. The first step is to introduce the model to the unique language of the new domain. This involves training a new tokenizer (the part of the model that breaks text into smaller units) on a large collection of domain-specific texts. Any new, important words or phrases not in the original model’s vocabulary are added. Their initial meanings are set based on related existing words, ensuring a smooth integration without complex architectural changes. This stage is about giving the model the right dictionary for its new field.
Stage 2: Joint Learning with a Domain Focus. This is where MOSAIC’s innovation truly shines. It combines two powerful learning techniques: Masked Language Modeling (MLM) and Contrastive Learning. MLM is like a fill-in-the-blanks exercise, where the model predicts missing words in a sentence. Contrastive learning, on the other hand, teaches the model to distinguish between similar and dissimilar sentences. The trick here is that MOSAIC restricts the MLM task to *only* the newly introduced domain-specific words. Why? Because if the model tries to predict every word, the sheer volume of general words can overwhelm the learning process, making it hard to focus on the domain-specific nuances. By focusing MLM on rare, informative domain tokens, MOSAIC ensures a balanced learning signal, allowing both token-level (word-specific) and sentence-level (overall meaning) understanding to improve simultaneously.
Stage 3: Refining Sentence Understanding. After the model has learned the new vocabulary and started to integrate token-level and sentence-level understanding, the final stage involves continuing training with only the contrastive objective. This stage acts as a fine-tuning step, allowing the model to solidify its ability to discriminate between sentences at a high level, ensuring that the representations it learns are robust and accurate for the new domain.
Also Read:
- Improving Multimodal AI: Understanding How Modalities Work Together
- Enhancing Dense Retrieval Models with a Single Mixture-of-Experts Block for Improved Efficiency and Generalization
Real-World Validation
The researchers put MOSAIC to the test in two very different domains: the Biomedical domain (high-resource, with lots of scientific texts) and the Islamic domain (low-resource, with limited English-language data). In both cases, MOSAIC demonstrated significant improvements. For instance, in the biomedical domain, it achieved up to a 13.4% improvement in a key performance metric (NDCG@10) over existing general-domain models. Even in the challenging low-resource Islamic domain, MOSAIC outperformed other models, making fewer completely incorrect predictions and showing its robustness.
This research highlights the importance of a balanced, multi-stage approach to domain adaptation. By carefully integrating new vocabulary and jointly optimizing different learning objectives, MOSAIC provides a powerful framework for making advanced language models truly useful in specialized fields. You can read the full research paper here.


