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