🚀 BAAI/bge-m3からの8層蒸留モデル:2.5倍の高速化
このモデルは、BAAI/bge-m3 を公開データセットと独自データセットを組み合わせて蒸留した埋め込みモデルです。24層ではなく8層のモデルで、パラメータサイズは366mで、検索性能をほとんど損なうことなく2.5倍の高速化を達成しています。
🚀 クイックスタート
このモデルを使用するには、まず Sentence Transformers
ライブラリをインストールする必要があります。
pip install -U sentence-transformers
その後、モデルをロードして推論を実行できます。
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("altaidevorg/bge-m3-distill-8l")
sentences = [
'That is a happy person',
'That is a happy dog',
'That is a very happy person',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
✨ 主な機能
- 高速化:
BAAI/bge-m3
から蒸留して層数を24層から8層に減らし、2.5倍の高速化を達成。
- 性能維持:検索性能をほとんど損なうことなく、多様なドメインやユースケースでの性能を維持。
- 多言語対応:トルコ語のデータセットで訓練しているが、英語など他の言語でも高い性能を維持。
📦 インストール
Sentence Transformers
ライブラリをインストールすることで、このモデルを使用できます。
pip install -U sentence-transformers
💻 使用例
基本的な使用法
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("altaidevorg/bge-m3-distill-8l")
sentences = [
'That is a happy person',
'That is a happy dog',
'That is a very happy person',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
📚 ドキュメント
モデルの詳細
属性 |
详情 |
モデルタイプ |
Sentence Transformer |
ベースモデル |
BAAI/bge-m3 |
最大シーケンス長 |
8192トークン |
出力次元数 |
1024次元 |
類似度関数 |
コサイン類似度 |
訓練データセット |
1000万のテキスト |
モデルのソース
完全なモデルアーキテクチャ
SentenceTransformer(
(0): Transformer({'max_seq_length': 8192, 'do_lower_case': False}) with Transformer model: XLMRobertaModel
(1): Pooling({'word_embedding_dimension': 1024, 'pooling_mode_cls_token': True, 'pooling_mode_mean_tokens': False, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
(2): Normalize()
)
🔧 技術詳細
評価指標
意味的類似度
指標 |
sts-dev |
sts-test |
pearson_cosine |
0.9691 |
0.9691 |
spearman_cosine |
0.965 |
0.9651 |
知識蒸留
指標 |
値 |
negative_mse |
-0.0064 |
訓練データセット
- サイズ: 9,623,924個の訓練サンプル
- 列:
sentence
と label
- 最初の1000サンプルに基づく近似統計:
|
文 |
ラベル |
タイプ |
文字列 |
リスト |
詳細 |
- 最小: 5トークン
- 平均: 55.78トークン
- 最大: 468トークン
|
|
📄 ライセンス
本READMEにはライセンス情報が含まれていません。
📖 引用
BibTeX
Sentence Transformers
@inproceedings{reimers-2019-sentence-bert,
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
author = "Reimers, Nils and Gurevych, Iryna",
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
month = "11",
year = "2019",
publisher = "Association for Computational Linguistics",
url = "https://arxiv.org/abs/1908.10084",
}
MSELoss
@inproceedings{reimers-2020-multilingual-sentence-bert,
title = "Making Monolingual Sentence Embeddings Multilingual using Knowledge Distillation",
author = "Reimers, Nils and Gurevych, Iryna",
booktitle = "Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing",
month = "11",
year = "2020",
publisher = "Association for Computational Linguistics",
url = "https://arxiv.org/abs/2004.09813",
}
bge-m3
@misc{bge-m3,
title={BGE M3-Embedding: Multi-Lingual, Multi-Functionality, Multi-Granularity Text Embeddings Through Self-Knowledge Distillation},
author={Jianlv Chen and Shitao Xiao and Peitian Zhang and Kun Luo and Defu Lian and Zheng Liu},
year={2024},
eprint={2402.03216},
archivePrefix={arXiv},
primaryClass={cs.CL}
}