🚀 BAAI/bge-reranker-baseベースのCross Encoderモデル
このモデルは、sentence-transformersライブラリを使用して、BAAI/bge-reranker-baseからファインチューニングされたCross Encoderモデルです。テキストペアのスコアを計算し、テキストの再ランキングや意味検索に利用できます。
📚 ドキュメント
モデルの詳細
モデルの説明
モデルのソース
💻 使用例
基本的な使用法
まず、Sentence Transformersライブラリをインストールします。
pip install -U sentence-transformers
次に、このモデルをロードして推論を実行できます。
from sentence_transformers import CrossEncoder
model = CrossEncoder("foochun/bge-reranker-ft")
pairs = [
['zach koh yong liang', 'yong liang koh zach'],
['zulkifli bin mohamad', 'zulkifli bin muhammad'],
['rahman bin mohd rashid', 'rahman mohammed rashid'],
['mohd syukri bin bakar', 'muhd syukri bakar'],
['carmen tan fang kiat', 'tan fang kiat'],
]
scores = model.predict(pairs)
print(scores.shape)
ranks = model.rank(
'zach koh yong liang',
[
'yong liang koh zach',
'zulkifli bin muhammad',
'rahman mohammed rashid',
'muhd syukri bakar',
'tan fang kiat',
]
)
🔧 技術詳細
学習データセット
無名データセット
- サイズ:72,905個の学習サンプル
- 列:
query
、pos
、neg
- 最初の1000サンプルに基づく概算統計:
| | query | pos | neg |
|:--------|:----------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------|
| タイプ | string | string | string |
| 詳細 |
- 最小: 9文字
- 平均: 19.91文字
- 最大: 45文字
| - 最小: 9文字
- 平均: 17.64文字
- 最大: 40文字
| - 最小: 9文字
- 平均: 17.95文字
- 最大: 37文字
|
- サンプル:
| query | pos | neg |
|:-------------------------------------------|:-------------------------------------|:-----------------------------------|
|
sim hong soon
| sim hong soon
| sim soon hong
|
| raja mariam binti raja sharif
| raja mariam raja sharif
| zuraidah binti dollah
|
| saw ann fui
| fui saw ann
| ann saw fui
|
- 損失関数:
MultipleNegativesRankingLoss
パラメータ:
{
"scale": 10.0,
"num_negatives": 4,
"activation_fn": "torch.nn.modules.activation.Sigmoid"
}
評価データセット
無名データセット
- サイズ:10,415個の評価サンプル
- 列:
query
、pos
、neg
- 最初の1000サンプルに基づく概算統計:
| | query | pos | neg |
|:--------|:----------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------|
| タイプ | string | string | string |
| 詳細 |
- 最小: 9文字
- 平均: 19.95文字
- 最大: 43文字
| - 最小: 9文字
- 平均: 17.8文字
- 最大: 42文字
| - 最小: 8文字
- 平均: 18.33文字
- 最大: 36文字
|
- サンプル:
| query | pos | neg |
|:------------------------------------|:------------------------------------|:---------------------------------|
|
zach koh yong liang
| yong liang koh zach
| liang yong koh zach
|
| zulkifli bin mohamad
| zulkifli bin muhammad
| razak bin ibrahim
|
| rahman bin mohd rashid
| rahman mohammed rashid
| fauzi bin mohd
|
- 損失関数:
MultipleNegativesRankingLoss
パラメータ:
{
"scale": 10.0,
"num_negatives": 4,
"activation_fn": "torch.nn.modules.activation.Sigmoid"
}
学習ハイパーパラメータ
非デフォルトのハイパーパラメータ
eval_strategy
: steps
per_device_train_batch_size
: 64
per_device_eval_batch_size
: 64
learning_rate
: 1e-05
warmup_ratio
: 0.1
seed
: 12
fp16
: True
dataloader_num_workers
: 4
load_best_model_at_end
: True
batch_sampler
: no_duplicates
学習ログ
エポック |
ステップ |
学習損失 |
0.0009 |
1 |
0.5117 |
0.8772 |
1000 |
0.0955 |
1.7544 |
2000 |
0.005 |
2.6316 |
3000 |
0.0039 |
フレームワークのバージョン
- Python: 3.11.9
- Sentence Transformers: 4.1.0
- Transformers: 4.51.3
- PyTorch: 2.6.0+cu124
- Accelerate: 1.6.0
- Datasets: 3.6.0
- Tokenizers: 0.21.1
📄 引用
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",
}