Abstract
Knowledge distillation (KD) is crucial for compressing large text embedding models, but faces challenges when teacher and student models use different tokenizers (Cross-Tokenizer KD - CTKD). Vocabulary mismatches impede the transfer of relational knowledge encoded in deep representations, such as hidden states and attention matrices, which are vital for producing high-quality embeddings. Existing CTKD methods often focus on direct output alignment, neglecting this crucial structural information. We propose a novel framework tailored for CTKD embedding model distillation. We first map tokens one-to-one via Minimum Edit Distance (MinED). Then, we distill intra-model relational knowledge by aligning attention matrix patterns using Centered Kernel Alignment, focusing on the top-m most important tokens of the directly mapped tokens. Simultaneously, we align final hidden states via Optimal Transport with Importance-Scored Mass Assignment, which emphasizes semantically important token representations, based on importance scores derived from attention weights. We evaluate distillation from state-of-the-art embedding models (e.g., LLM2Vec, BGE) to a Bert-base-uncased model on embedding-reliant tasks such as text classification, sentence pair classification, and semantic textual similarity. Our proposed framework significantly outperforms existing CTKD baselines. By preserving attention structure and prioritizing key representations, our approach yields smaller, high-fidelity embedding models despite tokenizer differences.
Introduction
The rapid advancement of Large Language Models (LLMs) has led to the creation of powerful text embedding models. However, these models often contain billions of parameters, making them computationally expensive for real-world applications. Knowledge Distillation (KD) is typically employed to compress these giants into smaller, efficient "student" models. A significant hurdle arises when the teacher and student use different tokenizers—a scenario known as Cross-Tokenizer KD (CTKD). In CTKD, sequences do not align token-for-token, making it difficult to transfer internal structural knowledge like hidden states and attention patterns.
The EMO Framework
To address the limitations of existing CTKD methods, we introduce EMO (Embedding Model Distillation via Intra-Model Relation and Optimal Transport Alignments). EMO focuses on preserving the internal logic of the teacher model through two primary alignment strategies.
1. Token Mapping via MinED
Since tokenizers differ, EMO first establishes a reliable one-to-one mapping between teacher and student tokens using Minimum Edit Distance (MinED). This provides a foundation for aligning token-specific information.
2. Intra-Model Relational Alignment (IRA)
Rather than matching raw hidden state values, IRA aligns the relationships between tokens. It uses Centered Kernel Alignment (CKA) to compare the patterns in attention matrices. To optimize efficiency and reduce noise, the alignment focuses on the "top-$m$" most important tokens, identified by the teacher's attention weights.
3. Cross-Model Representation Alignment (OTIS)
For the final hidden states, EMO employs Optimal Transport (OT). We propose Importance-Scored Mass Assignment (OTIS), which weights the transport plan based on token importance. This ensures that the student model prioritizes learning high-fidelity representations for semantically significant keywords over less informative tokens like punctuation.
Experimental Evaluation
We evaluated EMO by distilling knowledge from high-performing teachers like LLM2Vec (Mistral 7B) and BGE-M3 into a Bert-base-uncased student. The benchmarks covered three task categories:
- Text Classification: Patent, Imdb, and Banking77.
- Sentence Pair Classification: SciTail, ConTRoL-NLI, and Anli_r2.
- Semantic Textual Similarity (STS): STSB, STS12, and SICK.
Results and Discussion
EMO consistently outperformed state-of-the-art CTKD baselines, such as DSKD and MultilevelOT, across nearly all benchmarks.
As shown in the results, EMO significantly narrows the performance gap between the compact BERT student and the massive teacher models. For instance, on the SciTail dataset, EMO improved the student's accuracy from 88.1% to 90.9%. In Semantic Textual Similarity tasks (STS-B), EMO achieved a Spearman correlation of 81.3, surpassing the previous best baseline of 78.3.
Ablation studies confirmed the importance of both IRA and OTIS components. Removing either component led to a drop in performance, demonstrating that both relational alignment and importance-weighted representation alignment are critical for effective CTKD.
Conclusion
EMO provides a robust framework for distilling high-quality text embedding models across different tokenizers. By prioritizing structural relationships and semantically important representations, EMO enables the creation of efficient, high-fidelity models that capture the essence of state-of-the-art LLMs. Future work will explore multi-layer importance scoring and more flexible token mapping strategies to further enhance distillation performance.
Summary updated