🚀 gte-multilingual-reranker-base
gte-multilingual-reranker-baseモデルは、GTEモデルファミリーの最初のリランカーモデルで、いくつかの重要な特性を持っています。
- 高性能:同サイズのリランカーモデルと比較して、多言語検索タスクとマルチタスク表現モデル評価において最先端(SOTA)の結果を達成します。
- 学習アーキテクチャ:エンコーダーのみのトランスフォーマーアーキテクチャを使用して学習されており、モデルサイズが小さくなっています。以前のデコーダーのみのLLMアーキテクチャに基づくモデル(例:gte - qwen2 - 1.5b - instruct)とは異なり、このモデルは推論に必要なハードウェア要件が低く、推論速度が10倍向上します。
- 長文コンテキスト:最大8192トークンのテキスト長をサポートします。
- 多言語対応:70以上の言語をサポートします。
📚 ドキュメント
モデル情報
Property |
Details |
Model Size |
306M |
Max Input Tokens |
8192 |
💻 使用例
基本的な使用法
import torch
from transformers import AutoModelForSequenceClassification, AutoTokenizer
model_name_or_path = "Alibaba-NLP/gte-multilingual-reranker-base"
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
model = AutoModelForSequenceClassification.from_pretrained(
model_name_or_path, trust_remote_code=True,
torch_dtype=torch.float16
)
model.eval()
pairs = [["中国的首都在哪儿","北京"], ["what is the capital of China?", "北京"], ["how to implement quick sort in python?","Introduction of quick sort"]]
with torch.no_grad():
inputs = tokenizer(pairs, padding=True, truncation=True, return_tensors='pt', max_length=512)
scores = model(**inputs, return_dict=True).logits.view(-1, ).float()
print(scores)
高度な使用法
docker run --gpus all -v $PWD/data:/app/.cache -p "7997":"7997" \
michaelf34/infinity:0.0.68 \
v2 --model-id Alibaba-NLP/gte-multilingual-reranker-base --revision "main" --dtype bfloat16 --batch-size 32 --device cuda --engine torch --port 7997
評価
複数のテキスト検索データセットに基づくリランキングの結果です。

より詳細な実験結果は論文に記載されています。
クラウドAPIサービス
オープンソースのGTEシリーズモデルに加えて、GTEシリーズモデルはアリババクラウド上で商用APIサービスとしても利用可能です。
- 埋め込みモデル:テキスト埋め込みモデルには3つのバージョン(text - embedding - v1/v2/v3)があり、v3が最新のAPIサービスです。
- リランクモデル:gte - rerankモデルサービスが利用可能です。
商用APIの背後にあるモデルは、オープンソースモデルと完全に同一ではないことに注意してください。
引用
もし私たちの論文やモデルが役に立った場合は、以下のように引用していただけると幸いです。
@inproceedings{zhang2024mgte,
title={mGTE: Generalized Long-Context Text Representation and Reranking Models for Multilingual Text Retrieval},
author={Zhang, Xin and Zhang, Yanzhao and Long, Dingkun and Xie, Wen and Dai, Ziqi and Tang, Jialong and Lin, Huan and Yang, Baosong and Xie, Pengjun and Huang, Fei and others},
booktitle={Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing: Industry Track},
pages={1393--1412},
year={2024}
}
📄 ライセンス
このモデルはApache - 2.0ライセンスの下で提供されています。