🚀 ReasonIR-8B
ReasonIR-8Bは、一般的な推論タスク用に特別に訓練された最初のリトリーバーです。BRIGHT(推論集中型検索)において最先端の検索性能を達成しています。検索拡張生成(RAG)に使用する場合、MMLUとGPQAでも大幅な改善をもたらします。
🚀 クイックスタート
このモデルの概要や使用方法をご紹介します。
✨ 主な機能
- 一般的な推論タスク用に特別に訓練されたリトリーバーで、BRIGHTで最先端の検索性能を達成。
- 検索拡張生成(RAG)に使用すると、MMLUとGPQAで大幅な改善をもたらす。
属性 |
详情 |
ベースモデル |
meta-llama/Llama-3.1-8B |
言語 |
en |
ライセンス |
cc-by-nc-4.0 |
パイプラインタグ |
feature-extraction |
ライブラリ名 |
transformers |
タグ |
sentence-transformers |
- 論文: https://arxiv.org/abs/2504.20595
- リポジトリ: https://github.com/facebookresearch/ReasonIR
- データ: https://huggingface.co/datasets/reasonir/reasonir-data
📦 インストール
まずはtransformers>=4.47.0
をインストールしてください!
💻 使用例
基本的な使用法
Transformers
from transformers import AutoModel
model = AutoModel.from_pretrained("reasonir/ReasonIR-8B", torch_dtype="auto", trust_remote_code=True)
model = model.to("cuda")
model.eval()
query = "The quick brown fox jumps over the lazy dog."
document = "The quick brown fox jumps over the lazy dog."
query_instruction = ""
doc_instruction = ""
query_emb = model.encode(query, instruction=query_instruction)
doc_emb = model.encode(document, instruction=doc_instruction)
sim = query_emb @ doc_emb.T
AutoModel
を使用する際には、以下の点に注意してください。
trust_remote_code=True
を指定して、カスタムの双方向エンコーディングアーキテクチャが使用されるようにします。
torch_dtype="auto"
を使用して、bf16
が有効になるようにします(デフォルトではtorchはfp32
を使用します)。
Sentence Transformers
Transformersに加えて、このモデルをSentence Transformersで使用することもできます。
from sentence_transformers import SentenceTransformer
model_kwargs = {"torch_dtype": "auto"}
model = SentenceTransformer("reasonir/ReasonIR-8B", trust_remote_code=True, model_kwargs=model_kwargs)
query = "The quick brown fox jumps over the lazy dog."
document = "The quick brown fox jumps over the lazy dog."
query_instruction = ""
doc_instruction = ""
query_emb = model.encode(query, prompt=query_instruction)
doc_emb = model.encode(document, prompt=doc_instruction)
sim = model.similarity(query_emb, doc_emb)
前述の通り、trust_remote_code=True
とtorch_dtype="auto"
を指定することが重要です。
⚠️ 重要提示
SentenceTransformerを介してモデルを使用する場合、モデルがbfloat16
データ型にキャストされる方法により、非常にわずかな浮動小数点数の不一致が発生することがありますが、一般的には結果に影響を与えません。
@tomaarsen氏がSentenceTransformerの統合を改善し、浮動小数点数の不一致の原因を分析してくれたことに感謝します!
📄 ライセンス
このモデルはcc-by-nc-4.0ライセンスの下で提供されています。
📚 引用
@article{shao2025reasonir,
title={ReasonIR: Training Retrievers for Reasoning Tasks},
author={Rulin Shao and Rui Qiao and Varsha Kishore and Niklas Muennighoff and Xi Victoria Lin and Daniela Rus and Bryan Kian Hsiang Low and Sewon Min and Wen-tau Yih and Pang Wei Koh and Luke Zettlemoyer},
year={2025},
journal={arXiv preprint arXiv:2504.20595},
url={https://arxiv.org/abs/2504.20595},
}