Preranker V1
预排序器是一种基于交叉编码器的文本排序模型,旨在优化大语言模型的函数调用流程,通过缩小可用工具的语料库来提高效率。
下载量 29
发布时间 : 4/7/2025
模型简介
预排序器是一种用于文本排序的交叉编码器模型,主要用于根据给定查询对可用工具进行排序,以优化大语言模型的函数调用流程。
模型特点
高效工具排序
通过交叉编码器技术,预排序器能够高效地对可用工具进行排序,优化大语言模型的函数调用流程。
高性能
在MTEB-ToolRet基准测试中,预排序器在多个指标上表现优于同类模型。
易于集成
预排序器通过sentence-transformers库实现,易于集成到现有系统中。
模型能力
文本排序
工具检索优化
函数调用流程优化
使用案例
工具检索
Wayback Machine可用性检查
根据查询对可用工具进行排序,以确定Wayback Machine中特定URL的可用性。
在示例中,预排序器成功识别出与查询最相关的工具。
🚀 📊 预排序器 - 预先重排序工具
预排序器(Pre:Ranker)是一款用于优化现代大语言模型(LLMs)函数调用过程的工具,它能够根据给定的查询缩小可用工具的语料库范围。
🚀 快速开始
安装依赖
pip install sentence-transformers
使用示例
from sentence_transformers.cross_encoder import CrossEncoder
model = CrossEncoder('yjoonjang/preranker-v1')
model.eval()
pairs = [
["Is 'https://www.apple.com' available in the Wayback Machine on September 9, 2015?", "{'name': 'availability', 'description': 'Checks if a given URL is archived and currently accessible in the Wayback Machine.', 'parameters': {'url': {'description': 'The URL to check for availability in the Wayback Machine.', 'type': 'str', 'default': 'http://mashape.com'}, 'timestamp': {'description': \"The timestamp to look up in Wayback. If not specified, the most recent available capture is returned. The format of the timestamp is 1-14 digits (YYYYMMDDhhmmss). Defaults to '20090101'.\", 'type': 'str, optional', 'default': '20090101'}, 'callback': {'description': 'An optional callback to produce a JSONP response. Defaults to None.', 'type': 'str, optional', 'default': ''}}}"],
["Is 'https://www.apple.com' available in the Wayback Machine on September 9, 2015?", "{'name': 'top_grossing_mac_apps', 'description': 'Fetches a list of the top-grossing Mac apps from the App Store.', 'parameters': {'category': {'description': \"The category ID for the apps to be fetched. Defaults to '6016' (general category).\", 'type': 'str', 'default': '6016'}, 'country': {'description': \"The country code for the App Store. Defaults to 'us'.\", 'type': 'str', 'default': 'us'}, 'lang': {'description': \"The language code for the results. Defaults to 'en'.\", 'type': 'str', 'default': 'en'}, 'num': {'description': 'The number of results to return. Defaults to 100. Maximum allowed value is 200.', 'type': 'int', 'default': '100'}}}"],
["Is 'https://www.apple.com' available in the Wayback Machine on September 9, 2015?", "{'name': 'top_paid_mac_apps', 'description': 'Retrieves a list of the top paid Mac apps from the App Store.', 'parameters': {'category': {'description': \"Category of the apps to retrieve. Default is '6016'.\", 'type': 'str', 'default': '6016'}, 'country': {'description': \"Country code to filter the app results. Default is 'us'.\", 'type': 'str', 'default': 'us'}, 'lang': {'description': \"Language code for the results. Default is 'en'.\", 'type': 'str', 'default': 'en'}, 'num': {'description': 'Number of results to return. Default is 100. Maximum is 200.', 'type': 'int', 'default': '100'}}}",]
]
scores = model.predict(pairs)
print(scores) # [0.91427845 0.7625548 0.7656321]
✨ 主要特性
- 优化函数调用:通过缩小可用工具的语料库范围,优化现代大语言模型的函数调用过程。
- 易于使用:提供简单的API接口,方便集成到现有项目中。
📦 安装指南
pip install sentence-transformers
💻 使用示例
基础用法
from sentence_transformers.cross_encoder import CrossEncoder
model = CrossEncoder('yjoonjang/preranker-v1')
model.eval()
pairs = [
["Is 'https://www.apple.com' available in the Wayback Machine on September 9, 2015?", "{'name': 'availability', 'description': 'Checks if a given URL is archived and currently accessible in the Wayback Machine.', 'parameters': {'url': {'description': 'The URL to check for availability in the Wayback Machine.', 'type': 'str', 'default': 'http://mashape.com'}, 'timestamp': {'description': \"The timestamp to look up in Wayback. If not specified, the most recent available capture is returned. The format of the timestamp is 1-14 digits (YYYYMMDDhhmmss). Defaults to '20090101'.\", 'type': 'str, optional', 'default': '20090101'}, 'callback': {'description': 'An optional callback to produce a JSONP response. Defaults to None.', 'type': 'str', optional', 'default': ''}}}"],
["Is 'https://www.apple.com' available in the Wayback Machine on September 9, 2015?", "{'name': 'top_grossing_mac_apps', 'description': 'Fetches a list of the top-grossing Mac apps from the App Store.', 'parameters': {'category': {'description': \"The category ID for the apps to be fetched. Defaults to '6016' (general category).\", 'type': 'str', 'default': '6016'}, 'country': {'description': \"The country code for the App Store. Defaults to 'us'.\", 'type': 'str', 'default': 'us'}, 'lang': {'description': \"The language code for the results. Defaults to 'en'.\", 'type': 'str', 'default': 'en'}, 'num': {'description': 'The number of results to return. Defaults to 100. Maximum allowed value is 200.', 'type': 'int', 'default': '100'}}}"],
["Is 'https://www.apple.com' available in the Wayback Machine on September 9, 2015?", "{'name': 'top_paid_mac_apps', 'description': 'Retrieves a list of the top paid Mac apps from the App Store.', 'parameters': {'category': {'description': \"Category of the apps to retrieve. Default is '6016'.\", 'type': 'str', 'default': '6016'}, 'country': {'description': \"Country code to filter the app results. Default is 'us'.\", 'type': 'str', 'default': 'us'}, 'lang': {'description': \"Language code for the results. Default is 'en'.\", 'type': 'str', 'default': 'en'}, 'num': {'description': 'Number of results to return. Default is 100. Maximum is 200.', 'type': 'int', 'default': '100'}}}",]
]
scores = model.predict(pairs)
print(scores) # [0.91427845 0.7625548 0.7656321]
📚 详细文档
新闻动态
- 2025.04.09: 🤗 preranker-v1, MTEB-ToolRetrieval 发布!
关于预排序器
有众多工具和功能需要使用?不妨试试 预排序器(Pre:Ranker) !它旨在通过根据给定查询缩小可用工具的语料库范围,优化现代大语言模型的函数调用过程。更多详情请查看 🐱GITHUB 。
MTEB-ToolRet
将 ToolRet Benchmark 转换为 BEIR 格式,以使其与 MTEB 兼容。更多细节请查看 make_toolret_to_beir_format.ipynb
。
评估代码
git clone https://github.com/yjoonjang/PreRanker.git
cd PreRanker/toolret_eval
python run_mteb.py
评估结果
模型名称 | 模型参数 | Recall@10 | MAP@10 | MRR@10 | Precision@10 | NDCG@10 |
---|---|---|---|---|---|---|
yjoonjang/preranker-v1 | 150M | 0.540 | 0.361 | 0.462 | 0.088 | 0.428 |
Alibaba-NLP/gte-reranker-modernbert-base | 150M | 0.524 | 0.356 | 0.454 | 0.086 | 0.422 |
jinaai/jina-reranker-v2-base-multilingual | 278M | 0.502 | 0.331 | 0.414 | 0.083 | 0.395 |
Alibaba-NLP/gte-multilingual-reranker-base | 306M | 0.474 | 0.299 | 0.383 | 0.078 | 0.363 |
BAAI/bge-reranker-v2-m3 | 568M | 0.461 | 0.293 | 0.370 | 0.076 | 0.355 |
训练详情
- preranker-v1 是基于 Alibaba-NLP/gte-reranker-modernbert-base 微调的模型,使用 sentence-transformers 进行训练。
- 训练数据即将发布。
训练过程
- 损失函数: ListNetLoss
- 批量大小: 4
- 学习率: 2e-5
- 训练轮数: 1
🔧 技术细节
预排序器(Pre:Ranker)基于 sentence-transformers
库构建,使用 CrossEncoder
进行文本排序。通过微调 Alibaba-NLP/gte-reranker-modernbert-base
模型,使其能够根据给定查询对工具进行排序。
📄 许可证
apache-2.0
引用
@misc{Pre:Ranker,
publisher = {Youngjoon Jang, Seongtae Hong},
year = {2025},
url = {https://github.com/yjoonjang/preranker}
},
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",
}
ListNetLoss
@inproceedings{cao2007learning,
title={Learning to Rank: From Pairwise Approach to Listwise Approach},
author={Cao, Zhe and Qin, Tao and Liu, Tie-Yan and Tsai, Ming-Feng and Li, Hang},
booktitle={Proceedings of the 24th international conference on Machine learning},
pages={129--136},
year={2007}
}
Phi 2 GGUF
其他
Phi-2是微软开发的一个小型但强大的语言模型,具有27亿参数,专注于高效推理和高质量文本生成。
大型语言模型 支持多种语言
P
TheBloke
41.5M
205
Roberta Large
MIT
基于掩码语言建模目标预训练的大型英语语言模型,采用改进的BERT训练方法
大型语言模型 英语
R
FacebookAI
19.4M
212
Distilbert Base Uncased
Apache-2.0
DistilBERT是BERT基础模型的蒸馏版本,在保持相近性能的同时更轻量高效,适用于序列分类、标记分类等自然语言处理任务。
大型语言模型 英语
D
distilbert
11.1M
669
Llama 3.1 8B Instruct GGUF
Meta Llama 3.1 8B Instruct 是一个多语言大语言模型,针对多语言对话用例进行了优化,在常见的行业基准测试中表现优异。
大型语言模型 英语
L
modularai
9.7M
4
Xlm Roberta Base
MIT
XLM-RoBERTa是基于100种语言的2.5TB过滤CommonCrawl数据预训练的多语言模型,采用掩码语言建模目标进行训练。
大型语言模型 支持多种语言
X
FacebookAI
9.6M
664
Roberta Base
MIT
基于Transformer架构的英语预训练模型,通过掩码语言建模目标在海量文本上训练,支持文本特征提取和下游任务微调
大型语言模型 英语
R
FacebookAI
9.3M
488
Opt 125m
其他
OPT是由Meta AI发布的开放预训练Transformer语言模型套件,参数量从1.25亿到1750亿,旨在对标GPT-3系列性能,同时促进大规模语言模型的开放研究。
大型语言模型 英语
O
facebook
6.3M
198
1
基于transformers库的预训练模型,适用于多种NLP任务
大型语言模型
Transformers

1
unslothai
6.2M
1
Llama 3.1 8B Instruct
Llama 3.1是Meta推出的多语言大语言模型系列,包含8B、70B和405B参数规模,支持8种语言和代码生成,优化了多语言对话场景。
大型语言模型
Transformers 支持多种语言

L
meta-llama
5.7M
3,898
T5 Base
Apache-2.0
T5基础版是由Google开发的文本到文本转换Transformer模型,参数规模2.2亿,支持多语言NLP任务。
大型语言模型 支持多种语言
T
google-t5
5.4M
702
精选推荐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