Reranker ModernBERT Base Gooaq Bce
這是一個從ModernBERT-base微調而來的交叉編碼器模型,用於文本重排序和語義搜索任務。
下載量 483
發布時間 : 3/20/2025
模型概述
該模型是一個基於ModernBERT-base的交叉編碼器,專門用於計算文本對的相似度分數,適用於信息檢索中的重排序任務。
模型特點
長文本處理能力
支持最大8192個標記的序列長度,適合處理長文本
高效重排序
專為文本重排序任務優化,在GooAQ數據集上表現出色
二元分類
使用二元交叉熵損失進行訓練,輸出文本對的相關性分數
模型能力
文本相似度計算
信息檢索結果重排序
語義搜索
使用案例
信息檢索
搜索引擎結果重排序
對初步檢索結果進行重排序以提高相關性
在GooAQ開發集上達到0.7713的NDCG@10
問答系統
對候選答案進行相關性排序
在NanoNQ數據集上達到0.4630的NDCG@10
🚀 在GooAQ上訓練的ModernBERT-base
這是一個基於answerdotai/ModernBERT-base,使用sentence-transformers庫微調得到的交叉編碼器模型。它可以為文本對計算得分,這些得分可用於文本重排序和語義搜索。
訓練腳本請參考training_gooaq_bce.py。該腳本也在交叉編碼器 > 訓練概述文檔和使用Sentence Transformers v4訓練和微調重排序模型博客文章中有所描述。
🚀 快速開始
本模型是一個基於answerdotai/ModernBERT-base微調的交叉編碼器模型,可用於文本對得分計算,適用於文本重排序和語義搜索任務。
✨ 主要特性
- 基於預訓練的
answerdotai/ModernBERT-base
模型進行微調,能有效計算文本對的得分。 - 可用於文本重排序和語義搜索,為相關任務提供支持。
📦 安裝指南
首先安裝Sentence Transformers庫:
pip install -U sentence-transformers
💻 使用示例
基礎用法
from sentence_transformers import CrossEncoder
# 從🤗 Hub下載模型
model = CrossEncoder("tomaarsen/reranker-ModernBERT-base-gooaq-bce")
# 獲取文本對的得分
pairs = [
['why are rye chips so good?', "It makes them taste that much better! The rye chips are tasty because they stand out--they're the saltiest thing in the bag. It's not because rye bread is inherently awesome. ... You could just buy a bag of rye chips."],
['why are rye chips so good?', 'There are no substantial technical, nutritional or performance issues associated with rye that would limit its use for pets. Rye is a fairly common ingredient in human foods and beverages. The most prevalent occurrence is in crackers and breads.'],
['why are rye chips so good?', 'Bread made wholly from rye flour is made in Germany and called pumpernickel. Rye is unique among grains for having a high level of fibre in its endosperm – not just in its bran. As such, the glycemic index (GI) of rye products is generally lower than products made from wheat and most other grains.'],
['why are rye chips so good?', 'KFC Chips – The salt mix on the seasoned chips and the actual chips do not contain any animal products. Our supplier/s of chips and seasoning have confirmed they are suitable for vegans.'],
['why are rye chips so good?', 'A study in the American Journal of Clinical Nutrition found that eating rye leads to better blood-sugar control compared to wheat. Rye bread is packed with magnesium, which helps control blood pressure and optimize heart health. Its high levels of soluble fibre can also reduce cholesterol.'],
]
scores = model.predict(pairs)
print(scores.shape)
# (5,)
# 或者根據與單個文本的相似度對不同文本進行排序
ranks = model.rank(
'why are rye chips so good?',
[
"It makes them taste that much better! The rye chips are tasty because they stand out--they're the saltiest thing in the bag. It's not because rye bread is inherently awesome. ... You could just buy a bag of rye chips.",
'There are no substantial technical, nutritional or performance issues associated with rye that would limit its use for pets. Rye is a fairly common ingredient in human foods and beverages. The most prevalent occurrence is in crackers and breads.',
'Bread made wholly from rye flour is made in Germany and called pumpernickel. Rye is unique among grains for having a high level of fibre in its endosperm – not just in its bran. As such, the glycemic index (GI) of rye products is generally lower than products made from wheat and most other grains.',
'KFC Chips – The salt mix on the seasoned chips and the actual chips do not contain any animal products. Our supplier/s of chips and seasoning have confirmed they are suitable for vegans.',
'A study in the American Journal of Clinical Nutrition found that eating rye leads to better blood-sugar control compared to wheat. Rye bread is packed with magnesium, which helps control blood pressure and optimize heart health. Its high levels of soluble fibre can also reduce cholesterol.',
]
)
# [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]
📚 詳細文檔
模型詳情
模型描述
屬性 | 詳情 |
---|---|
模型類型 | 交叉編碼器 |
基礎模型 | answerdotai/ModernBERT-base |
最大序列長度 | 8192個標記 |
輸出標籤數量 | 1個標籤 |
語言 | 英語 |
許可證 | apache-2.0 |
模型來源
- 文檔:Sentence Transformers文檔
- 文檔:交叉編碼器文檔
- 倉庫:GitHub上的Sentence Transformers
- Hugging Face:Hugging Face上的交叉編碼器
評估
交叉編碼器重排序
- 數據集:
gooaq-dev
- 評估方法:使用
CrossEncoderRerankingEvaluator
,參數如下:{ "at_k": 10, "always_rerank_positives": false }
指標 | 值 |
---|---|
map | 0.7308 (+0.1997) |
mrr@10 | 0.7292 (+0.2052) |
ndcg@10 | 0.7713 (+0.1801) |
- 數據集:
gooaq-dev
- 評估方法:使用
CrossEncoderRerankingEvaluator
,參數如下:{ "at_k": 10, "always_rerank_positives": true }
指標 | 值 |
---|---|
map | 0.7908 (+0.2597) |
mrr@10 | 0.7890 (+0.2650) |
ndcg@10 | 0.8351 (+0.2439) |
- 數據集:
NanoMSMARCO_R100
、NanoNFCorpus_R100
和NanoNQ_R100
- 評估方法:使用
CrossEncoderRerankingEvaluator
,參數如下:{ "at_k": 10, "always_rerank_positives": true }
指標 | NanoMSMARCO_R100 | NanoNFCorpus_R100 | NanoNQ_R100 |
---|---|---|---|
map | 0.4579 (-0.0317) | 0.3414 (+0.0804) | 0.3932 (-0.0264) |
mrr@10 | 0.4479 (-0.0296) | 0.5340 (+0.0342) | 0.3918 (-0.0349) |
ndcg@10 | 0.5275 (-0.0130) | 0.3821 (+0.0571) | 0.4630 (-0.0377) |
交叉編碼器Nano BEIR
- 數據集:
NanoBEIR_R100_mean
- 評估方法:使用
CrossEncoderNanoBEIREvaluator
,參數如下:{ "dataset_names": [ "msmarco", "nfcorpus", "nq" ], "rerank_k": 100, "at_k": 10, "always_rerank_positives": true }
指標 | 值 |
---|---|
map | 0.3975 (+0.0074) |
mrr@10 | 0.4579 (-0.0101) |
ndcg@10 | 0.4575 (+0.0022) |
訓練詳情
訓練數據集
未命名數據集
- 大小:578,402個訓練樣本
- 列:
question
、answer
和label
- 基於前1000個樣本的近似統計信息:
| | 問題 | 答案 | 標籤 |
|------|------|------|------|
| 類型 | 字符串 | 字符串 | 整數 |
| 詳情 |
- 最小:19個字符
- 平均:45.14個字符
- 最大:85個字符
- 最小:65個字符
- 平均:254.8個字符
- 最大:379個字符
- 0:~82.90%
- 1:~17.10%
- 樣本:
| 問題 | 答案 | 標籤 |
|------|------|------|
|
why are rye chips so good?
|It makes them taste that much better! The rye chips are tasty because they stand out--they're the saltiest thing in the bag. It's not because rye bread is inherently awesome. ... You could just buy a bag of rye chips.
|1
| |why are rye chips so good?
|There are no substantial technical, nutritional or performance issues associated with rye that would limit its use for pets. Rye is a fairly common ingredient in human foods and beverages. The most prevalent occurrence is in crackers and breads.
|0
| |why are rye chips so good?
|Bread made wholly from rye flour is made in Germany and called pumpernickel. Rye is unique among grains for having a high level of fibre in its endosperm – not just in its bran. As such, the glycemic index (GI) of rye products is generally lower than products made from wheat and most other grains.
|0
| - 損失函數:
BinaryCrossEntropyLoss
,參數如下:{ "activation_fct": "torch.nn.modules.linear.Identity", "pos_weight": 5 }
訓練超參數
非默認超參數
eval_strategy
:stepsper_device_train_batch_size
:64per_device_eval_batch_size
:64learning_rate
:2e-05num_train_epochs
:1warmup_ratio
:0.1seed
:12bf16
:Truedataloader_num_workers
:4load_best_model_at_end
:True
訓練日誌
輪次 | 步驟 | 訓練損失 | gooaq-dev_ndcg@10 | NanoMSMARCO_R100_ndcg@10 | NanoNFCorpus_R100_ndcg@10 | NanoNQ_R100_ndcg@10 | NanoBEIR_R100_mean_ndcg@10 |
---|---|---|---|---|---|---|---|
-1 | -1 | - | 0.1288 (-0.4624) | 0.0149 (-0.5255) | 0.2278 (-0.0972) | 0.0229 (-0.4777) | 0.0885 (-0.3668) |
0.0001 | 1 | 1.0435 | - | - | - | - | - |
0.0221 | 200 | 1.1924 | - | - | - | - | - |
0.0443 | 400 | 1.1531 | - | - | - | - | - |
0.0664 | 600 | 0.9371 | - | - | - | - | - |
0.0885 | 800 | 0.6993 | - | - | - | - | - |
0.1106 | 1000 | 0.669 | 0.7042 (+0.1130) | 0.4353 (-0.1051) | 0.3289 (+0.0039) | 0.4250 (-0.0757) | 0.3964 (-0.0590) |
0.1328 | 1200 | 0.6257 | - | - | - | - | - |
0.1549 | 1400 | 0.6283 | - | - | - | - | - |
0.1770 | 1600 | 0.6014 | - | - | - | - | - |
0.1992 | 1800 | 0.5888 | - | - | - | - | - |
0.2213 | 2000 | 0.5493 | 0.7425 (+0.1513) | 0.4947 (-0.0457) | 0.3568 (+0.0318) | 0.4634 (-0.0373) | 0.4383 (-0.0171) |
0.2434 | 2200 | 0.5479 | - | - | - | - | - |
0.2655 | 2400 | 0.5329 | - | - | - | - | - |
0.2877 | 2600 | 0.5208 | - | - | - | - | - |
0.3098 | 2800 | 0.5259 | - | - | - | - | - |
0.3319 | 3000 | 0.5221 | 0.7479 (+0.1567) | 0.5146 (-0.0258) | 0.3710 (+0.0460) | 0.4846 (-0.0160) | 0.4568 (+0.0014) |
0.3541 | 3200 | 0.4977 | - | - | - | - | - |
0.3762 | 3400 | 0.4965 | - | - | - | - | - |
0.3983 | 3600 | 0.4985 | - | - | - | - | - |
0.4204 | 3800 | 0.4907 | - | - | - | - | - |
0.4426 | 4000 | 0.5058 | 0.7624 (+0.1712) | 0.5166 (-0.0238) | 0.3665 (+0.0415) | 0.4868 (-0.0138) | 0.4567 (+0.0013) |
0.4647 | 4200 | 0.4885 | - | - | - | - | - |
0.4868 | 4400 | 0.495 | - | - | - | - | - |
0.5090 | 4600 | 0.4839 | - | - | - | - | - |
0.5311 | 4800 | 0.4983 | - | - | - | - | - |
0.5532 | 5000 | 0.4778 | 0.7603 (+0.1691) | 0.5110 (-0.0294) | 0.3540 (+0.0290) | 0.4809 (-0.0197) | 0.4487 (-0.0067) |
0.5753 | 5200 | 0.4726 | - | - | - | - | - |
0.5975 | 5400 | 0.477 | - | - | - | - | - |
0.6196 | 5600 | 0.4613 | - | - | - | - | - |
0.6417 | 5800 | 0.4492 | - | - | - | - | - |
0.6639 | 6000 | 0.4506 | 0.7643 (+0.1731) | 0.5275 (-0.0129) | 0.3639 (+0.0389) | 0.4913 (-0.0094) | 0.4609 (+0.0055) |
0.6860 | 6200 | 0.4618 | - | - | - | - | - |
0.7081 | 6400 | 0.463 | - | - | - | - | - |
0.7303 | 6600 | 0.4585 | - | - | - | - | - |
0.7524 | 6800 | 0.4612 | - | - | - | - | - |
0.7745 | 7000 | 0.4621 | 0.7649 (+0.1736) | 0.5105 (-0.0299) | 0.3688 (+0.0437) | 0.4552 (-0.0454) | 0.4448 (-0.0105) |
0.7966 | 7200 | 0.4536 | - | - | - | - | - |
0.8188 | 7400 | 0.4515 | - | - | - | - | - |
0.8409 | 7600 | 0.4396 | - | - | - | - | - |
0.8630 | 7800 | 0.4542 | - | - | - | - | - |
0.8852 | 8000 | 0.4332 | 0.7669 (+0.1757) | 0.5247 (-0.0157) | 0.3794 (+0.0544) | 0.4370 (-0.0637) | 0.4470 (-0.0083) |
0.9073 | 8200 | 0.447 | - | - | - | - | - |
0.9294 | 8400 | 0.4335 | - | - | - | - | - |
0.9515 | 8600 | 0.4179 | - | - | - | - | - |
0.9737 | 8800 | 0.4459 | - | - | - | - | - |
0.9958 | 9000 | 0.4196 | 0.7713 (+0.1801) | 0.5275 (-0.0130) | 0.3821 (+0.0571) | 0.4630 (-0.0377) | 0.4575 (+0.0022) |
-1 | -1 | - | 0.7713 (+0.1801) | 0.5275 (-0.0130) | 0.3821 (+0.0571) | 0.4630 (-0.0377) | 0.4575 (+0.0022) |
注:加粗行表示保存的檢查點。
框架版本
- Python:3.11.10
- Sentence Transformers:3.5.0.dev0
- Transformers:4.49.0
- PyTorch:2.5.1+cu124
- Accelerate:1.5.2
- Datasets:2.21.0
- Tokenizers:0.21.0
📄 許可證
本模型使用apache-2.0許可證。
📚 引用
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",
}
Jina Embeddings V3
Jina Embeddings V3 是一個多語言句子嵌入模型,支持超過100種語言,專注於句子相似度和特徵提取任務。
文本嵌入
Transformers 支持多種語言

J
jinaai
3.7M
911
Ms Marco MiniLM L6 V2
Apache-2.0
基於MS Marco段落排序任務訓練的交叉編碼器模型,用於信息檢索中的查詢-段落相關性評分
文本嵌入 英語
M
cross-encoder
2.5M
86
Opensearch Neural Sparse Encoding Doc V2 Distill
Apache-2.0
基於蒸餾技術的稀疏檢索模型,專為OpenSearch優化,支持免推理文檔編碼,在搜索相關性和效率上優於V1版本
文本嵌入
Transformers 英語

O
opensearch-project
1.8M
7
Sapbert From PubMedBERT Fulltext
Apache-2.0
基於PubMedBERT的生物醫學實體表徵模型,通過自對齊預訓練優化語義關係捕捉
文本嵌入 英語
S
cambridgeltl
1.7M
49
Gte Large
MIT
GTE-Large 是一個強大的句子轉換器模型,專注於句子相似度和文本嵌入任務,在多個基準測試中表現出色。
文本嵌入 英語
G
thenlper
1.5M
278
Gte Base En V1.5
Apache-2.0
GTE-base-en-v1.5 是一個英文句子轉換器模型,專注於句子相似度任務,在多個文本嵌入基準測試中表現優異。
文本嵌入
Transformers 支持多種語言

G
Alibaba-NLP
1.5M
63
Gte Multilingual Base
Apache-2.0
GTE Multilingual Base 是一個多語言的句子嵌入模型,支持超過50種語言,適用於句子相似度計算等任務。
文本嵌入
Transformers 支持多種語言

G
Alibaba-NLP
1.2M
246
Polybert
polyBERT是一個化學語言模型,旨在實現完全由機器驅動的超快聚合物信息學。它將PSMILES字符串映射為600維密集指紋,以數值形式表示聚合物化學結構。
文本嵌入
Transformers

P
kuelumbus
1.0M
5
Bert Base Turkish Cased Mean Nli Stsb Tr
Apache-2.0
基於土耳其語BERT的句子嵌入模型,專為語義相似度任務優化
文本嵌入
Transformers 其他

B
emrecan
1.0M
40
GIST Small Embedding V0
MIT
基於BAAI/bge-small-en-v1.5模型微調的文本嵌入模型,通過MEDI數據集與MTEB分類任務數據集訓練,優化了檢索任務的查詢編碼能力。
文本嵌入
Safetensors 英語
G
avsolatorio
945.68k
29
精選推薦AI模型
Llama 3 Typhoon V1.5x 8b Instruct
專為泰語設計的80億參數指令模型,性能媲美GPT-3.5-turbo,優化了應用場景、檢索增強生成、受限生成和推理任務
大型語言模型
Transformers 支持多種語言

L
scb10x
3,269
16
Cadet Tiny
Openrail
Cadet-Tiny是一個基於SODA數據集訓練的超小型對話模型,專為邊緣設備推理設計,體積僅為Cosmo-3B模型的2%左右。
對話系統
Transformers 英語

C
ToddGoldfarb
2,691
6
Roberta Base Chinese Extractive Qa
基於RoBERTa架構的中文抽取式問答模型,適用於從給定文本中提取答案的任務。
問答系統 中文
R
uer
2,694
98