Reranker Msmarco ModernBERT Base Lambdaloss
这是一个从ModernBERT-base微调而来的交叉编码器模型,用于计算文本对的分数,适用于文本重排序和语义搜索任务。
下载量 89
发布时间 : 3/17/2025
模型简介
该模型基于ModernBERT-base架构,使用sentence-transformers库在msmarco数据集上训练,专门用于计算文本对的相似度分数,可应用于信息检索、问答系统等场景。
模型特点
高效文本重排序
能够快速计算文本对的相似度分数,有效提升检索系统的排序质量
大序列长度支持
支持最大8192个标记的序列长度,适合处理长文本
高性能指标
在多个评估数据集上表现出色,如NanoMSMARCO_R100上ndcg@10达到0.7251
模型能力
文本相似度计算
信息检索结果重排序
问答系统答案排序
语义搜索
使用案例
信息检索
搜索引擎结果重排序
对搜索引擎返回的结果进行二次排序,提高相关文档的排名
在MSMARCO数据集上map达到0.6768
问答系统
答案相关性排序
对候选答案进行相关性评分,选择最相关的答案
在NanoNQ_R100数据集上mrr@10达到0.7402
🚀 基于answerdotai/ModernBERT-base的交叉编码器
本模型是基于answerdotai/ModernBERT-base
的交叉编码器,在msmarco
数据集上使用sentence-transformers
库进行微调。它可以计算文本对的得分,可用于文本重排序和语义搜索。
🚀 快速开始
直接使用(Sentence Transformers)
首先安装Sentence Transformers库:
pip install -U sentence-transformers
然后你可以加载这个模型并进行推理。
from sentence_transformers import CrossEncoder
# 从🤗 Hub下载模型
model = CrossEncoder("tomaarsen/reranker-msmarco-ModernBERT-base-lambdaloss")
# 获取文本对的得分
pairs = [
['How many calories in an egg', 'There are on average between 55 and 80 calories in an egg depending on its size.'],
['How many calories in an egg', 'Egg whites are very low in calories, have no fat, no cholesterol, and are loaded with protein.'],
['How many calories in an egg', 'Most of the calories in an egg come from the yellow yolk in the center.'],
]
scores = model.predict(pairs)
print(scores.shape)
# (3,)
# 或者根据与单个文本的相似度对不同文本进行排序
ranks = model.rank(
'How many calories in an egg',
[
'There are on average between 55 and 80 calories in an egg depending on its size.',
'Egg whites are very low in calories, have no fat, no cholesterol, and are loaded with protein.',
'Most of the calories in an egg come from the yellow yolk in the center.',
]
)
# [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]
✨ 主要特性
- 基于
answerdotai/ModernBERT-base
模型进行微调,具有良好的文本处理能力。 - 能够计算文本对的得分,可用于文本重排序和语义搜索。
- 支持最大长度为8192个标记的输入序列。
📦 安装指南
安装Sentence Transformers库:
pip install -U sentence-transformers
💻 使用示例
基础用法
from sentence_transformers import CrossEncoder
# 从🤗 Hub下载模型
model = CrossEncoder("tomaarsen/reranker-msmarco-ModernBERT-base-lambdaloss")
# 获取文本对的得分
pairs = [
['How many calories in an egg', 'There are on average between 55 and 80 calories in an egg depending on its size.'],
['How many calories in an egg', 'Egg whites are very low in calories, have no fat, no cholesterol, and are loaded with protein.'],
['How many calories in an egg', 'Most of the calories in an egg come from the yellow yolk in the center.'],
]
scores = model.predict(pairs)
print(scores.shape)
# (3,)
高级用法
from sentence_transformers import CrossEncoder
# 从🤗 Hub下载模型
model = CrossEncoder("tomaarsen/reranker-msmarco-ModernBERT-base-lambdaloss")
# 根据与单个文本的相似度对不同文本进行排序
ranks = model.rank(
'How many calories in an egg',
[
'There are on average between 55 and 80 calories in an egg depending on its size.',
'Egg whites are very low in calories, have no fat, no cholesterol, and are loaded with protein.',
'Most of the calories in an egg come from the yellow yolk in the center.',
]
)
# [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]
📚 详细文档
模型详情
模型描述
属性 | 详情 |
---|---|
模型类型 | 交叉编码器 |
基础模型 | answerdotai/ModernBERT-base |
最大序列长度 | 8192个标记 |
输出标签数量 | 1个标签 |
训练数据集 | msmarco |
语言 | 英语 |
模型来源
- 文档:Sentence Transformers文档
- 文档:交叉编码器文档
- 仓库:GitHub上的Sentence Transformers
- Hugging Face:Hugging Face上的交叉编码器
评估
指标
交叉编码器重排序
- 数据集:
NanoMSMARCO_R100
、NanoNFCorpus_R100
和NanoNQ_R100
- 使用
CrossEncoderRerankingEvaluator
进行评估,参数如下:{ "at_k": 10, "always_rerank_positives": true }
指标 | NanoMSMARCO_R100 | NanoNFCorpus_R100 | NanoNQ_R100 |
---|---|---|---|
map | 0.6768 (+0.1872) | 0.3576 (+0.0966) | 0.7134 (+0.2938) |
mrr@10 | 0.6690 (+0.1915) | 0.5819 (+0.0820) | 0.7402 (+0.3135) |
ndcg@10 | 0.7251 (+0.1847) | 0.4143 (+0.0892) | 0.7594 (+0.2587) |
交叉编码器Nano BEIR
- 数据集:
NanoBEIR_R100_mean
- 使用
CrossEncoderNanoBEIREvaluator
进行评估,参数如下:{ "dataset_names": [ "msmarco", "nfcorpus", "nq" ], "rerank_k": 100, "at_k": 10, "always_rerank_positives": true }
指标 | 值 |
---|---|
map | 0.5826 (+0.1925) |
mrr@10 | 0.6637 (+0.1957) |
ndcg@10 | 0.6329 (+0.1776) |
训练详情
训练数据集
评估数据集
训练超参数
- 非默认超参数:
eval_strategy
: stepsnum_train_epochs
: 1warmup_ratio
: 0.1seed
: 12bf16
: Trueload_best_model_at_end
: True
框架版本
- Python: 3.11.10
- Sentence Transformers: 3.5.0.dev0
- Transformers: 4.49.0
- PyTorch: 2.5.1+cu124
- Accelerate: 1.2.0
- Datasets: 2.21.0
- Tokenizers: 0.21.0
🔧 技术细节
损失函数
使用LambdaLoss
损失函数,参数如下:
{
"weighting_scheme": "sentence_transformers.cross_encoder.losses.LambdaLoss.NDCGLoss2PPScheme",
"k": null,
"sigma": 1.0,
"eps": 1e-10,
"reduction_log": "binary",
"activation_fct": "torch.nn.modules.linear.Identity",
"mini_batch_size": 8
}
训练日志
点击展开
轮次 | 步数 | 训练损失 | 验证损失 | NanoMSMARCO_R100_ndcg@10 | NanoNFCorpus_R100_ndcg@10 | NanoNQ_R100_ndcg@10 | NanoBEIR_R100_mean_ndcg@10 |
---|---|---|---|---|---|---|---|
-1 | -1 | - | - | 0.0234 (-0.5170) | 0.3412 (+0.0161) | 0.0321 (-0.4686) | 0.1322 (-0.3231) |
0.0000 | 1 | 0.8349 | - | - | - | - | - |
0.0040 | 200 | 0.8417 | - | - | - | - | - |
... | ... | ... | ... | ... | ... | ... | ... |
0.8014 | 40000 | 0.1381 | 0.1289 | 0.7251 (+0.1847) | 0.4143 (+0.0892) | 0.7594 (+0.2587) | 0.6329 (+0.1776) |
... | ... | ... | ... | ... | ... | ... | ... |
- 加粗行表示保存的检查点。
📄 许可证
本模型使用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",
}
LambdaLoss
@inproceedings{wang2018lambdaloss,
title={The lambdaloss framework for ranking metric optimization},
author={Wang, Xuanhui and Li, Cheng and Golbandi, Nadav and Bendersky, Michael and Najork, Marc},
booktitle={Proceedings of the 27th ACM international conference on information and knowledge management},
pages={1313--1322},
year={2018}
}
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