Rank1 7b
模型概述
該模型用於信息檢索中的重排序任務,通過生成顯式推理鏈再進行相關性判斷,提高了多樣化檢索任務的性能
模型特點
測試時計算
在做出相關性判斷前生成推理鏈,提高決策質量
顯式推理
在<think>標籤內生成推理步驟,使判斷過程透明化
二元判斷
最終輸出true/false二元判斷,並轉換為置信度分數
多尺寸選擇
提供從0.5B到32B不同參數規模的模型變體
模型能力
信息檢索
文檔重排序
相關性判斷
推理鏈生成
使用案例
信息檢索
搜索引擎結果重排序
對搜索引擎返回的初步結果進行重新排序
提高檢索結果的相關性
文檔相關性評估
評估文檔與查詢的相關性程度
生成可解釋的相關性判斷
🚀 rank1-7b:信息檢索重排序的測試時計算模型
rank1是一個推理重排序模型,它在進行相關性判斷之前會進行“思考”。這個擁有70億參數的模型基於Qwen2.5 - 7B基礎模型進行訓練,並利用測試時計算來生成推理鏈,然後再判斷文檔是否與查詢相關。
🚀 快速開始
rank1模型在信息檢索領域引入了一種新穎的方法,它在做出相關性判斷之前會生成明確的推理鏈。與直接輸出分數的傳統重排序器不同,rank1模型的工作流程如下:
- 接收查詢和文檔對。
- 在
<think>...</think>
部分內生成推理鏈。 - 做出二元相關性判斷(
true
或false
)。 - 根據真/假標記的對數幾率返回置信度分數。
這種方法有助於模型將複雜的相關性決策分解為邏輯步驟,從而提高在各種檢索任務中的性能。
✨ 主要特性
- 推理重排序:在進行相關性判斷前生成推理鏈,使決策更具邏輯性。
- 多參數變體:提供從0.5B到32B等不同參數規模的模型變體,滿足不同需求。
- 量化版本:部分模型提供量化版本,優化資源使用。
- MTEB兼容:可與MTEB基準測試框架集成,方便評估。
📦 安裝指南
詳細的安裝說明請參考 GitHub倉庫。
💻 使用示例
基礎用法
以下是使用vLLM的最小示例:
from vllm import LLM, SamplingParams
import math
# Initialize the model with vLLM
model = LLM(
model="jhu-clsp/rank1-7b",
tensor_parallel_size=1, # Number of GPUs
trust_remote_code=True,
max_model_len=16000, # Context length
gpu_memory_utilization=0.9,
dtype="float16",
)
# Set up sampling parameters
sampling_params = SamplingParams(
temperature=0,
max_tokens=8192,
logprobs=20,
stop=["</think> true", "</think> false"],
skip_special_tokens=False
)
# Prepare the prompt
def create_prompt(query, document):
return (
"Determine if the following passage is relevant to the query. "
"Answer only with 'true' or 'false'.\n"
f"Query: {query}\n"
f"Passage: {document}\n"
"<think>"
)
# Example usage
query = "What are the effects of climate change?"
document = "Climate change leads to rising sea levels, extreme weather events, and disruptions to ecosystems. These effects are caused by increasing greenhouse gas concentrations in the atmosphere due to human activities."
# Generate prediction
prompt = create_prompt(query, document)
outputs = model.generate([prompt], sampling_params)
# Extract score
output = outputs[0].outputs[0]
text = output.text
final_logits = output.logprobs[-1]
# Get token IDs for "true" and "false" tokens
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("jhu-clsp/rank1-7b")
true_token = tokenizer(" true", add_special_tokens=False).input_ids[0]
false_token = tokenizer(" false", add_special_tokens=False).input_ids[0]
# Calculate relevance score (probability of "true")
true_logit = final_logits[true_token].logprob
false_logit = final_logits[false_token].logprob
true_score = math.exp(true_logit)
false_score = math.exp(false_logit)
relevance_score = true_score / (true_score + false_score)
print(f"Reasoning chain: {text}")
print(f"Relevance score: {relevance_score}")
高級用法
rank1模型可與 MTEB基準測試框架 集成,以下是示例代碼:
from mteb import MTEB
from rank1 import rank1 # From the official repo
# Initialize the model
model = rank1(
model_name_or_path="jhu-clsp/rank1-7b",
num_gpus=1,
device="cuda"
)
# Run evaluation on specific tasks
evaluation = MTEB(tasks=["NevIR"])
results = evaluation.run(model)
📚 詳細文檔
模型家族
模型 | 基礎模型 | 描述 |
---|---|---|
rank1-0.5b | Qwen2.5-0.5B | 最小變體(0.5B參數) |
rank1-1.5b | Qwen2.5-1.5B | 較小變體(1.5B參數) |
rank1-3b | Qwen2.5-3B | 較小變體(3B參數) |
rank1-7b | Qwen2.5-7B | 當前模型(7B參數) |
rank1-14b | Qwen2.5-14B | 較大變體(14B參數) |
rank1-32b | Qwen2.532B | 最大變體(32B參數) |
rank1-mistral-2501-24b | Mistral-Small 2501 24B | 基於Mistral基礎模型訓練 |
rank1-llama3-8b | Llama 3.1 8B | 基於Llama 3.1基礎模型訓練 |
量化變體
模型 | 描述 |
---|---|
rank1-7b-awq | rank1-7b的量化版本 |
rank1-14b-awq | rank1-14b的量化版本 |
rank1-32b-awq | rank1-32b的量化版本 |
rank1-mistral-2501-24b-awq | rank1-mistral-24b的量化版本 |
rank1-llama3-8b-awq | rank1-llama3-8b的量化版本 |
關聯數據和資源
資源 | 描述 |
---|---|
rank1-r1-msmarco | 來自MS MARCO的所有R1輸出示例 |
rank1-training-data | rank1模型使用的訓練數據 |
rank1-run-files | 用於前100文檔重排序的預計算運行文件 |
GitHub倉庫 | rank1官方倉庫 |
🔧 技術細節
rank1-7b模型在檢索基準測試中表現出色,尤其在需要複雜推理的任務上。該模型“思考”相關性決策的能力使其在處理細微主題時特別有效。具體的基準測試結果和與其他模型的比較,請參考 論文 和 官方GitHub倉庫。
📄 許可證
本項目採用 MIT許可證。
📖 引用
如果您在研究中使用了rank1模型,請引用以下論文:
@misc{weller2025rank1testtimecomputereranking,
title={Rank1: Test-Time Compute for Reranking in Information Retrieval},
author={Orion Weller and Kathryn Ricci and Eugene Yang and Andrew Yates and Dawn Lawrie and Benjamin Van Durme},
year={2025},
eprint={2502.18418},
archivePrefix={arXiv},
primaryClass={cs.IR},
url={https://arxiv.org/abs/2502.18418},
}
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