đ ReasonIR-8B
ReasonIR-8B is the first retriever specifically trained for general reasoning tasks, offering state-of-the-art retrieval performance and enhancing retrieval-augmented generation.
đ Quick Start
Ensure you have transformers>=4.47.0
installed before using the model.
⨠Features
- ReasonIR-8B is the first retriever tailored for general reasoning tasks, achieving state-of-the-art retrieval performance on BRIGHT (reasoning-intensive retrieval).
- When used for retrieval-augmented generation (RAG), it brings substantial gains on MMLU and GPQA.
đĻ Installation
Make sure to install transformers>=4.47.0
first!
đģ Usage Examples
Basic Usage
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
When using AutoModel
, it is important to:
- Include
trust_remote_code=True
to make sure our custom bidirectional encoding architecture is used.
- Use
torch_dtype="auto"
so that bf16
is activated (by default torch will use fp32
).
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)
It is important to also include trust_remote_code=True
and torch_dtype="auto"
as discussed earlier.
Advanced Usage
â ī¸ Important Note
There are some very slight floating point discrepancies when using the model via SentenceTransformer caused by how the models are cast to the bfloat16
dtype, though it should not affect the results in general.
We thank @tomaarsen for improving the SentenceTransformer integration and analyzing the cause of the floating point discrepancies!
đ Documentation
đ License
This model is released under the cc-by-nc-4.0
license.
đ Citation
@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},
}
đ Model Information
Property |
Details |
Base Model |
meta-llama/Llama-3.1-8B |
Language |
en |
License |
cc-by-nc-4.0 |
Pipeline Tag |
feature-extraction |
Library Name |
transformers |
Tags |
sentence-transformers |