Inf Retriever V1 1.5b
INF-Retriever-v1-1.5B是INF TECH開發的基於大語言模型的稠密檢索模型,針對中英文數據檢索任務進行了優化微調。
下載量 19.59k
發布時間 : 2/8/2025
模型概述
該模型是基於gte-Qwen2-1.5B-instruct的輕量級版本,專門針對中英文數據檢索任務進行了優化微調,在AIR-Bench基準測試中表現優異。
模型特點
中英文檢索優化
模型針對中英文檢索場景進行了專項優化,顯著提升了各類檢索任務的準確率和效率。
頂尖性能表現
在AIR-Bench基準測試中取得領先成績,是跨領域異構信息檢索的理想選擇。
大上下文支持
支持最大32768個token的輸入長度,適合處理長文檔檢索任務。
模型能力
文本嵌入
信息檢索
句子相似度計算
跨語言檢索
使用案例
信息檢索
網頁搜索查詢
給定網頁搜索查詢,檢索相關答案段落
在AIR-Bench基準測試中取得優異表現
跨領域檢索
支持維基百科、網頁、醫療、法律、學術、新聞、金融等多個領域的檢索任務
在13種語言的跨領域檢索中表現良好
🚀 INF-Retriever-v1-1.5B
INF-Retriever-v1-1.5B 是一款輕量級的基於大語言模型的稠密檢索模型,專為中英文數據檢索任務優化,在異構信息檢索任務中表現卓越。
🚀 快速開始
INF-Retriever-v1-1.5B 是 INF-Retriever-v1 的輕量級版本,由 INF TECH 開發。它基於 gte-Qwen2-1.5B-instruct 模型構建,並針對檢索任務進行了微調,尤其適用於中文和英文數據。
截至 2025 年 2 月 19 日,在參數少於 70 億的模型中,INF-Retriever-v1-1.5B 在 AIR-Bench 24.04 和 24.05 版本的中英文雙語子排行榜上均排名第一,展示了其在異構信息檢索任務中的前沿性能。
✨ 主要特性
- 針對中英文檢索優化:該模型使用了專注於檢索的中英文數據集進行微調,顯著提高了其在各種檢索場景中的準確性和效率。
- 頂級性能表現:INF-Retriever-v1-1.5B 在 AIR-Bench 排行榜上取得了優異成績,使其成為跨領域異構信息檢索任務的首選模型。
📦 安裝指南
文檔中未提及安裝步驟,故跳過此章節。
💻 使用示例
基礎用法
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("infly/inf-retriever-v1-1.5b", trust_remote_code=True)
# In case you want to reduce the maximum length:
model.max_seq_length = 8192
queries = [
"how much protein should a female eat",
"summit define",
]
documents = [
"As a general guideline, the CDC's average requirement of protein for women ages 19 to 70 is 46 grams per day. But, as you can see from this chart, you'll need to increase that if you're expecting or training for a marathon. Check out the chart below to see how much protein you should be eating each day.",
"Definition of summit for English Language Learners. : 1 the highest point of a mountain : the top of a mountain. : 2 the highest level. : 3 a meeting or series of meetings between the leaders of two or more governments.",
]
query_embeddings = model.encode(queries, prompt_name="query")
document_embeddings = model.encode(documents)
scores = (query_embeddings @ document_embeddings.T) * 100
print(scores.tolist())
# [[89.36092376708984, 69.16694641113281], [57.51953125, 79.65923309326172]]
高級用法
import torch
import torch.nn.functional as F
from torch import Tensor
from transformers import AutoTokenizer, AutoModel
def last_token_pool(last_hidden_states: Tensor,
attention_mask: Tensor) -> Tensor:
left_padding = (attention_mask[:, -1].sum() == attention_mask.shape[0])
if left_padding:
return last_hidden_states[:, -1]
else:
sequence_lengths = attention_mask.sum(dim=1) - 1
batch_size = last_hidden_states.shape[0]
return last_hidden_states[torch.arange(batch_size, device=last_hidden_states.device), sequence_lengths]
def get_detailed_instruct(task_description: str, query: str) -> str:
return f'Instruct: {task_description}\nQuery: {query}'
# Each query must come with a one-sentence instruction that describes the task
task = 'Given a web search query, retrieve relevant passages that answer the query'
queries = [
get_detailed_instruct(task, 'how much protein should a female eat'),
get_detailed_instruct(task, 'summit define')
]
# No need to add instruction for retrieval documents
documents = [
"As a general guideline, the CDC's average requirement of protein for women ages 19 to 70 is 46 grams per day. But, as you can see from this chart, you'll need to increase that if you're expecting or training for a marathon. Check out the chart below to see how much protein you should be eating each day.",
"Definition of summit for English Language Learners. : 1 the highest point of a mountain : the top of a mountain. : 2 the highest level. : 3 a meeting or series of meetings between the leaders of two or more governments."
]
input_texts = queries + documents
tokenizer = AutoTokenizer.from_pretrained('infly/inf-retriever-v1-1.5b', trust_remote_code=True)
model = AutoModel.from_pretrained('infly/inf-retriever-v1-1.5b', trust_remote_code=True)
max_length = 8192
# Tokenize the input texts
batch_dict = tokenizer(input_texts, max_length=max_length, padding=True, truncation=True, return_tensors='pt')
outputs = model(**batch_dict)
embeddings = last_token_pool(outputs.last_hidden_state, batch_dict['attention_mask'])
# normalize embeddings
embeddings = F.normalize(embeddings, p=2, dim=1)
scores = (embeddings[:2] @ embeddings[2:].T) * 100
print(scores.tolist())
# [[89.36091613769531, 69.16694641113281], [57.519447326660156, 79.65917205810547]]
📚 詳細文檔
屬性 | 詳情 |
---|---|
模型大小 | 15 億 |
嵌入維度 | 1536 |
最大輸入令牌數 | 32768 |
語言支持 | 中文和英文(對其他語言也有效) |
🔧 技術細節
文檔中未提及技術實現細節,故跳過此章節。
📄 許可證
該模型使用的許可證為 apache-2.0。
👥 貢獻者
導師
魏楚 • 徐英輝 • 齊遠
INF 記憶團隊
楊俊涵 (junhanyang@inftech.ai) • 萬家禾 • 姚逸晨 (eason.yyc@inftech.ai)
📖 引用
如果您發現我們的模型有用,請考慮引用:
@misc {infly-ai_2025,
author = { Junhan Yang, Jiahe Wan, Yichen Yao, Wei Chu, Yinghui Xu, Yuan Qi },
title = { inf-retriever-v1 (Revision 5f469d7) },
year = 2025,
url = { https://huggingface.co/infly/inf-retriever-v1 },
doi = { 10.57967/hf/4262 },
publisher = { Hugging Face }
}
Jina Embeddings V3
Jina Embeddings V3 是一個多語言句子嵌入模型,支持超過100種語言,專注於句子相似度和特徵提取任務。
文本嵌入
Transformers 支持多種語言

J
jinaai
3.7M
911
Ms Marco MiniLM L6 V2
Apache-2.0
基於MS Marco段落排序任務訓練的交叉編碼器模型,用於信息檢索中的查詢-段落相關性評分
文本嵌入 英語
M
cross-encoder
2.5M
86
Opensearch Neural Sparse Encoding Doc V2 Distill
Apache-2.0
基於蒸餾技術的稀疏檢索模型,專為OpenSearch優化,支持免推理文檔編碼,在搜索相關性和效率上優於V1版本
文本嵌入
Transformers 英語

O
opensearch-project
1.8M
7
Sapbert From PubMedBERT Fulltext
Apache-2.0
基於PubMedBERT的生物醫學實體表徵模型,通過自對齊預訓練優化語義關係捕捉
文本嵌入 英語
S
cambridgeltl
1.7M
49
Gte Large
MIT
GTE-Large 是一個強大的句子轉換器模型,專注於句子相似度和文本嵌入任務,在多個基準測試中表現出色。
文本嵌入 英語
G
thenlper
1.5M
278
Gte Base En V1.5
Apache-2.0
GTE-base-en-v1.5 是一個英文句子轉換器模型,專注於句子相似度任務,在多個文本嵌入基準測試中表現優異。
文本嵌入
Transformers 支持多種語言

G
Alibaba-NLP
1.5M
63
Gte Multilingual Base
Apache-2.0
GTE Multilingual Base 是一個多語言的句子嵌入模型,支持超過50種語言,適用於句子相似度計算等任務。
文本嵌入
Transformers 支持多種語言

G
Alibaba-NLP
1.2M
246
Polybert
polyBERT是一個化學語言模型,旨在實現完全由機器驅動的超快聚合物信息學。它將PSMILES字符串映射為600維密集指紋,以數值形式表示聚合物化學結構。
文本嵌入
Transformers

P
kuelumbus
1.0M
5
Bert Base Turkish Cased Mean Nli Stsb Tr
Apache-2.0
基於土耳其語BERT的句子嵌入模型,專為語義相似度任務優化
文本嵌入
Transformers 其他

B
emrecan
1.0M
40
GIST Small Embedding V0
MIT
基於BAAI/bge-small-en-v1.5模型微調的文本嵌入模型,通過MEDI數據集與MTEB分類任務數據集訓練,優化了檢索任務的查詢編碼能力。
文本嵌入
Safetensors 英語
G
avsolatorio
945.68k
29
精選推薦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