Mxbai Rerank Large V2 Seq
一個支持多種語言的句子轉換器模型,適用於文本排序任務
下載量 210
發布時間 : 3/14/2025
模型概述
該模型是一個多語言句子轉換器,能夠處理多種語言的文本排序任務。它支持包括英語、中文、德語、日語等在內的14種語言,適用於跨語言文本處理和信息檢索場景。
模型特點
多語言支持
支持14種語言的文本處理,包括主要歐洲和亞洲語言
文本排序能力
專門優化用於文本排序任務,能夠有效比較和排序句子
基於Transformer
採用先進的Transformer架構,提供高質量的文本表示
模型能力
多語言文本處理
句子嵌入生成
文本相似度計算
跨語言信息檢索
使用案例
信息檢索
跨語言文檔搜索
在多語言文檔集合中查找相關文檔
能夠有效匹配不同語言的相似內容
推薦系統
多語言內容推薦
基於用戶歷史行為推薦多語言相關內容
提升跨語言用戶體驗
🚀 重寫為分類器的Mixedbread重排器
本倉庫是將Mixedbread重排器重寫為分類器的項目,截至2025年3月,它是最強大的重排器,例如可用於檢索增強生成(RAG)。
🚀 快速開始
FP8在NVIDIA L4/H100上的部署
以下是部署所需的配置文件示例:
build_commands: []
environment_variables: {}
external_package_dirs: []
model_metadata:
example_model_input:
input: 'ERROR: This redirects to the embedding endpoint. Use the /sync API to
reach /sync/predict'
model_name: BEI-mixedbread-ai-mxbai-rerank-base-v2-reranker-fp8-truss-example
python_version: py39
requirements: []
resources:
accelerator: L4
cpu: '1'
memory: 10Gi
use_gpu: true
secrets: {}
system_packages: []
trt_llm:
build:
base_model: encoder
checkpoint_repository:
repo: michaelfeil/mxbai-rerank-large-v2-seq
revision: main
source: HF
max_num_tokens: 32768
max_seq_len: 1000001
num_builder_gpus: 4
quantization_type: fp8
要將部署推送到Baseten.co,請執行以下操作:
pip install truss --upgrade
nano config.yaml # 編輯上述配置文件
truss push --publish
更多信息請參考: https://github.com/basetenlabs/truss-examples/tree/main/11-embeddings-reranker-classification-tensorrt/BEI-mixedbread-ai-mxbai-rerank-base-v2-reranker-fp8
作為分類器使用
若要在Baseten.co或github.com/michaelfeil/infinity上使用,你需要使用分類API。你需要手動創建以下特定於該模型的提示模板,該模板遵循https://github.com/mixedbread-ai/mxbai-rerank/tree/main 上的參考實現。
def create_mxbai_v2_reranker_prompt_template(query: str, document: str, instruction: str = "") -> str:
"""
Create a carefully formatted chat template string (without tokenizer) for ranking relevance.
Parameters:
query (str): The search query.
document (str): The document text to evaluate.
instruction (str): Special instructions (e.g., "You are an expert for Mockingbirds.")
Returns:
str: The formatted chat template.
"""
instruction = f"instruction: {instruction}\n" if instruction else ""
# fixed system prompt, keep as is.
system_prompt = "You are Qwen, created by Alibaba Cloud. You are a helpful assistant."
assert not "\n" in system_prompt
assert not "\n" in instruction[:-1]
assert isinstance(query, str)
assert isinstance(document, str)
templated = (
# keep spacing, newlines as is.
# template for mixedbread reranker v2
# https://huggingface.co/michaelfeil/mxbai-rerank-base-v2-seq/
f"<|endoftext|><|im_start|>system\n{system_prompt}\n"
"<|im_end|>\n"
"<|im_start|>user\n"
f"{instruction}"
f"query: {query} \n"
f"document: {document} \n"
"You are a search relevance expert who evaluates how well documents match search queries. "
"For each query-document pair, carefully analyze the semantic relationship between them, then provide your binary relevance judgment (0 for not relevant, 1 for relevant).\n"
"Relevance:<|im_end|>\n"
"<|im_start|>assistant\n"
)
return templated
✨ 主要特性
- 先進的性能和高效性:具備最先進的性能和強大的效率。
- 多語言支持:支持100多種語言,在英語和中文方面表現出色。
- 代碼支持:支持代碼相關的處理。
- 長上下文支持:能夠處理長上下文信息。
📦 安裝指南
安裝mxbai-rerank
:
pip install mxbai-rerank
💻 使用示例
基礎用法
from mxbai_rerank import MxbaiRerankV2
model = MxbaiRerankV2("mixedbread-ai/mxbai-rerank-large-v2")
query = "Who wrote 'To Kill a Mockingbird'?"
documents = [
"'To Kill a Mockingbird' is a novel by Harper Lee published in 1960. It was immediately successful, winning the Pulitzer Prize, and has become a classic of modern American literature.",
"The novel 'Moby-Dick' was written by Herman Melville and first published in 1851. It is considered a masterpiece of American literature and deals with complex themes of obsession, revenge, and the conflict between good and evil.",
"Harper Lee, an American novelist widely known for her novel 'To Kill a Mockingbird', was born in 1926 in Monroeville, Alabama. She received the Pulitzer Prize for Fiction in 1961.",
"Jane Austen was an English novelist known primarily for her six major novels, which interpret, critique and comment upon the British landed gentry at the end of the 18th century.",
"The 'Harry Potter' series, which consists of seven fantasy novels written by British author J.K. Rowling, is among the most popular and critically acclaimed books of the modern era.",
"'The Great Gatsby', a novel written by American author F. Scott Fitzgerald, was published in 1925. The story is set in the Jazz Age and follows the life of millionaire Jay Gatsby and his pursuit of Daisy Buchanan."
]
# Lets get the scores
results = model.rank(query, documents, return_documents=True, top_k=3)
print(results)
📚 詳細文檔
性能
基準測試結果
模型 | BEIR平均得分 | 多語言得分 | 中文得分 | 代碼搜索得分 | 延遲(秒) |
---|---|---|---|---|---|
mxbai-rerank-large-v2 | 57.49 | 29.79 | 84.16 | 32.05 | 0.89 |
mxbai-rerank-base-v2 | 55.57 | 28.56 | 83.70 | 31.73 | 0.67 |
mxbai-rerank-large-v1 | 49.32 | 21.88 | 72.53 | 30.72 | 2.24 |
*延遲在A100 GPU上測量
訓練細節
模型採用三步訓練過程:
- GRPO(引導式強化提示優化)
- 對比學習
- 偏好學習
更多詳細信息,請查看我們的技術博客文章。相關論文即將發佈。
📄 許可證
引用
@online{rerank2025mxbai,
title={Every Byte Matters: Introducing mxbai-embed-xsmall-v1},
author={Sean Lee and Aamir Shakir and Julius Lipp and Rui Huang},
year={2025},
url={https://www.mixedbread.com/blog/mxbai-rerank-v2},
}
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