CoolFace
Modelpublic

gomyk/me5s-student-me5s_compressed_distilled_v2

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes19downloads
Model Card

mE5-small Compressed & Distilled (v2)

A 4-layer, 384d, 15K vocab compressed student of intfloat/multilingual-e5-small, distilled on ~1.4M MTEB sentences for 20 epochs.

Model Summary

Teacher (mE5-small)**This Model**Reduction
Layers1243x fewer
Hidden dim384384same
Vocab250,03715,16816.5x smaller
Parameters~118M~13M~9x fewer
Model size~450MB~51MB~9x smaller

MTEB Benchmark Results

STS (Semantic Textual Similarity)

TaskTeacherStudentDelta
BIOSSES0.84380.7374-0.106
SICK-R0.78630.7792-0.007
STS120.78050.7658-0.015
STS130.77470.7698-0.005
STS140.77540.7573-0.018
STS150.87490.8505-0.024
STS170.76730.0523-0.715
STS22.v20.64280.5294-0.113
STSBenchmark0.83590.8077-0.028
Average0.78680.6722-0.115
Note: STS17 is a cross-lingual task heavily impacted by vocab pruning (250K->15K tokens). Excluding STS17: Teacher 0.7893 vs Student 0.7496 (delta -0.040, 95.0% retention).

Classification

TaskTeacherStudentDelta
AmazonCounterfactualClassification0.74280.7445+0.002
Banking77Classification0.70640.6723-0.034
ImdbClassification0.75820.7149-0.043
MTOPDomainClassification0.89130.8497-0.042
MassiveIntentClassification0.47600.6334+0.157
MassiveScenarioClassification0.56190.6768+0.115
ToxicConversationsClassification0.62050.5757-0.045
TweetSentimentExtractionClassification0.61820.6259+0.008
Average0.67190.6867+0.015

Clustering

TaskTeacherStudentDelta
ArXivHierarchicalClusteringP2P0.53950.4859-0.054
ArXivHierarchicalClusteringS2S0.53760.4726-0.065
BiorxivClusteringP2P.v20.36750.2020-0.166
MedrxivClusteringP2P.v20.34240.2598-0.083
MedrxivClusteringS2S.v20.31950.2320-0.088
StackExchangeClustering.v20.49610.3811-0.115
StackExchangeClusteringP2P.v20.38410.3288-0.055
TwentyNewsgroupsClustering.v20.33520.1848-0.150
Average0.41530.3184-0.097

Overall Summary

CategoryTeacherStudentRetention
STS0.78680.672285.4%
STS (excl. STS17)0.78930.749695.0%
Classification0.67190.6867102.2%
Clustering0.41530.318476.7%
Overall Average0.62470.559189.5%
9x smaller model size (450MB -> 51MB), 89.5% overall performance retention. Classification exceeds teacher performance. STS retains 95% (excluding cross-lingual STS17).

Compression Pipeline

  1. 1.Layer pruning: 12 -> 4 layers (uniform spacing: layers 0, 4, 8, 11)
  2. 2.Vocabulary pruning: 250,037 -> 15,168 tokens (corpus-seen tokens only)
  3. 3.Distillation: MSE + Cosine loss on ~1.4M MTEB corpus sentences, 20 epochs
  4. 4.Best distillation loss: 0.0096

Usage

python
from sentence_transformers import SentenceTransformer

model = SentenceTransformer("gomyk/me5s-student-me5s_compressed_distilled_v2")

sentences = [
    "The weather is lovely today.",
    "It's so sunny outside!",
    "He drove to the stadium.",
]
embeddings = model.encode(sentences)
print(embeddings.shape)  # [3, 384]

similarities = model.similarity(embeddings, embeddings)
print(similarities)

Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 512, 'do_lower_case': False, 'architecture': 'BertModel'})
       - 4 layers, 384d hidden, 12 attention heads
       - 15,168 vocab (XLMRobertaTokenizer, pruned)
  (1): Pooling(mean_tokens)
)

Training Details

  • —Teacher: intfloat/multilingual-e5-small (12L, 384d, 250K vocab)
  • —Distillation loss: MSE + 0.5 * Cosine similarity loss
  • —Corpus: ~1.4M sentences from MTEB Classification/Clustering/STS/NLI datasets
  • —Epochs: 20 (best loss: 0.0096)
  • —Batch size: 32, LR: 2e-5, Cosine annealing scheduler
  • —Framework: PyTorch 2.10, Transformers 4.56, Sentence-Transformers 5.3

Limitations

  • —Cross-lingual STS (STS17) significantly degraded due to aggressive vocab pruning
  • —Clustering performance drops more than other categories
  • —Optimized for English; multilingual coverage is reduced by vocab pruning