tomaarsen/mxbai-embed-large-v1-distilled Model Card
Model2Vec distills a Sentence Transformer into a small, static model.
This model is ideal for applications requiring fast, lightweight embeddings.
Installation
Install model2vec using pip:
Usage
A StaticModel can be loaded using the from_pretrained method:
1from model2vec import StaticModel
2
3model = StaticModel.from_pretrained("tomaarsen/mxbai-embed-large-v1-distilled")
4
5embeddings = model.encode(["Example sentence"])
Alternatively, you can distill your own model using the distill method:
1from model2vec.distill import distill
2
3# Choose a Sentence Transformer model
4model_name = "BAAI/bge-base-en-v1.5"
5
6# Distill the model
7m2v_model = distill(model_name=model_name, pca_dims=256)
8
9# Save the model
10m2v_model.save_pretrained("m2v_model")
How it works
Model2vec creates a small, fast, and powerful model that outperforms other static embedding models by a large margin on all tasks we could find, while being much faster to create than traditional static embedding models such as GloVe. Best of all, you don't need any data to distill a model using Model2Vec.
It works by passing a vocabulary through a sentence transformer model, then reducing the dimensionality of the resulting embeddings using PCA, and finally weighting the embeddings using zipf weighting. During inference, we simply take the mean of all token embeddings occurring in a sentence.
Citation
Please cite the
Model2Vec repository if you use this model in your work.
Additional Resources
Model Authors
Model2Vec was developed by the
Minish Lab team consisting of Stephan Tulkens and Thomas van Dongen.