预训练模型

Hugging Face Hub 上已公开发布了多个稀疏编码器(Sparse Encoder)模型。

模型可通过这个简单的界面无缝集成。

from sentence_transformers import SparseEncoder

# Download from the 🤗 Hub
model = SparseEncoder("naver/splade-v3")
# Run inference
queries = ["what causes aging fast"]
documents = [
    "UV-A light, specifically, is what mainly causes tanning, skin aging, and cataracts, UV-B causes sunburn, skin aging and skin cancer, and UV-C is the strongest, and therefore most effective at killing microorganisms. Again â\x80\x93 single words and multiple bullets.",
    "Answers from Ronald Petersen, M.D. Yes, Alzheimer's disease usually worsens slowly. But its speed of progression varies, depending on a person's genetic makeup, environmental factors, age at diagnosis and other medical conditions. Still, anyone diagnosed with Alzheimer's whose symptoms seem to be progressing quickly â\x80\x94 or who experiences a sudden decline â\x80\x94 should see his or her doctor.",
    "Bell's palsy and Extreme tiredness and Extreme fatigue (2 causes) Bell's palsy and Extreme tiredness and Hepatitis (2 causes) Bell's palsy and Extreme tiredness and Liver pain (2 causes) Bell's palsy and Extreme tiredness and Lymph node swelling in children (2 causes)",
]
query_embeddings = model.encode_query(queries)
document_embeddings = model.encode_document(documents)
print(query_embeddings.shape, document_embeddings.shape)
# [1, 30522] [3, 30522]

# Get the similarity scores for the embeddings
similarities = model.similarity(query_embeddings, document_embeddings)
print(similarities)
# tensor([[11.3768, 10.8296,  4.3457]])

核心 SPLADE 模型

MS MARCO 段落检索 是一个黄金标准数据集,其特点是包含来自 Bing 搜索引擎的真实用户查询,并配有专家标注的相关文本段落。在此基准上训练的模型作为生产搜索系统的嵌入模型,表现出卓越的有效性。性能分数反映了在该数据集上的评估结果,这是一个很好的指标,但不应作为唯一的考量参数。

BEIR(信息检索基准测试)提供了一个异构基准,用于评估信息检索模型在 13 个不同数据集上的表现。平均 nDCG@10 分数代表了在所有 13 个数据集上的平均性能。

请注意,以下所有数字均摘自不同论文。这些模型代表了稀疏神经检索的核心。

模型名称 MS MARCO MRR@10 BEIR-13 平均 nDCG@10 参数
opensearch-project/opensearch-neural-sparse-encoding-v2-distill 不适用 52.8 6700 万
opensearch-project/opensearch-neural-sparse-encoding-v1 不适用 52.4 1.33 亿
naver/splade-v3 40.2 51.7 1.09 亿
ibm-granite/granite-embedding-30m-sparse 不适用 50.8 3000 万
naver/splade-cocondenser-selfdistil 37.6 50.7 1.09 亿
naver/splade_v2_distil 36.8 50.6 6700 万
naver/splade-cocondenser-ensembledistil 38.0 50.5 1.09 亿
naver/splade-v3-distilbert 38.7 50.0 6700 万
prithivida/Splade_PP_en_v2 37.8 49.4 1.09 亿
naver/splade-v3-lexical 40.0 49.1 1.09 亿
prithivida/Splade_PP_en_v1 37.2 48.7 1.09 亿
naver/splade_v2_max 34.0 46.4 6700 万
rasyosef/splade-mini 33.2 42.5 1100 万
rasyosef/splade-tiny 30.9 40.6 400 万
BM25(基线) 18.4 45.6 不适用

无推理 SPLADE 模型

无推理 Splade 的文档部分使用传统的 Splade 架构,而查询部分则是一个 SparseStaticEmbedding 模块(sentence_transformers.sparse_encoder.models.SparseStaticEmbedding),它仅为查询中的每个词元返回一个预计算的分数。因此,对于这些模型,我们牺牲了查询扩展,但查询推理变得近乎瞬时,这对于速度优化非常有价值。

模型名称 BEIR-13 平均 nDCG@10 参数
opensearch-project/opensearch-neural-sparse-encoding-doc-v3-gte 54.6 1.37 亿
opensearch-project/opensearch-neural-sparse-encoding-doc-v3-distill 51.7 6700 万
opensearch-project/opensearch-neural-sparse-encoding-doc-v2-distill 50.4 6700 万
opensearch-project/opensearch-neural-sparse-encoding-doc-v2-mini 49.7 2300 万
opensearch-project/opensearch-neural-sparse-encoding-doc-v1 49.0 1.33 亿
naver/splade-v3-doc 47.0 1.09 亿

模型集合

这些是 Hugging Face Hub 上可用的模型集合。