/ Модель

Характеристики

Контекст
8 192 токена
Параметры
434 млн
Лицензия
MIT
Архитектура
new · dense
Опубликована
12 июл 2024

stella_en_400M_v5

ЭмбеддингиТекст → embedding10 профессий

Англоязычная модель Stella преобразует тексты в эмбеддинги для семантического поиска и сравнения сходства предложений.

86 013скачиваний за 30 дней235лайковвеса обновлены28 июл 2025

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки31

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

  • IndicGenBenchFloresBitextMining

    main_score

    Результат

    0,1445

    Общий результат 0,1181Общий результат 0,1073Общий результат 0,0768
    MTEB

    Публичная таблицадругая ревизия

  • MassiveScenarioClassification

    main_score

    Результат

    0,3699

    Общий результат 0,4127Общий результат 0,3316Общий результат 0,2099
    MTEB

    Публичная таблицадругая ревизия

  • Tatoeba

    main_score

    Результат

    0,4826

    Общий результат 0,1124
    MTEB

    Публичная таблицадругая ревизия

  • IN22GenBitextMining

    Среднее по поднаборам

    Результат

    0,1067

    MTEB

    Расчёт каталогадругая ревизия

  • HeadlineClassification

    main_score

    Результат

    0,3922

    MTEB

    Публичная таблицадругая ревизия

  • MIRACLReranking

    main_score

    Результат

    0,5261

    MTEB

    Публичная таблицадругая ревизия

  • SIB200ClusteringS2S

    main_score

    Результат

    0,0309

    Общий результат 0,3658Общий результат 0,1183Общий результат 0,0716
    MTEB

    Публичная таблицадругая ревизия

  • PhincBitextMining

    main_score

    Результат

    0,6758

    MTEB

    Публичная таблицадругая ревизия

  • EPBench

    main_score

    Результат

    0,7061

    MTEB

    Публичная таблицадругая ревизия

  • MassiveIntentClassification

    main_score

    Результат

    0,0263

    Общий результат 0,8148Общий результат 0,041
    MTEB

    Публичная таблицадругая ревизия

  • LEMBNarrativeQARetrieval

    main_score

    Результат

    0,2776

    MTEB

    Публичная таблицадругая ревизия

  • AmazonPolarityClassification

    main_score

    Результат

    0,9719

    MTEB

    Публичная таблицаревизия не подтверждена

  • STSBenchmarkMultilingualSTS

    main_score

    Результат

    0,7822

    MTEB

    Публичная таблицадругая ревизия

  • MLQARetrieval

    main_score

    Результат

    0,5821

    Общий результат 0,0298Общий результат 0,0227
    MTEB

    Публичная таблицадругая ревизия

  • CQADupstackGamingRetrieval

    main_score

    Результат

    0,5702

    MTEB

    Публичная таблицадругая ревизия

  • DeepPlanning

    main_score

    Результат

    0,5336

    MTEB

    Публичная таблицадругая ревизия

  • PAC

    main_score

    Результат

    0,6313

    MTEB

    Публичная таблицадругая ревизия

  • MTOPIntentClassification

    main_score

    Результат

    0,5233

    Общий результат 0,5912
    MTEB

    Публичная таблицадругая ревизия

  • SemRel24STS

    main_score

    Результат

    0,3311

    MTEB

    Публичная таблицадругая ревизия

  • LongMemEval

    main_score

    Результат

    0,9356

    MTEB

    Публичная таблицадругая ревизия

  • CUREv1

    main_score

    Результат

    0,3007

    MTEB

    Публичная таблицадругая ревизия

  • MTOPDomainClassification

    main_score

    Результат

    0,8115

    MTEB

    Публичная таблицадругая ревизия

  • PpcPC

    main_score

    Результат

    0,8197

    MTEB

    Публичная таблицадругая ревизия

  • NLPJournalTitleIntroRetrieval

    main_score

    Результат

    0,1861

    MTEB

    Публичная таблицадругая ревизия

  • STS22.v2

    main_score

    Результат

    0,806

    MTEB

    Публичная таблицадругая ревизия

  • PawsXPairClassification

    main_score

    Результат

    0,6772

    MTEB

    Публичная таблицадругая ревизия

  • STS22

    main_score

    Результат

    0,7531

    MTEB

    Публичная таблицадругая ревизия

  • WikiClusteringP2P.v2

    main_score

    Результат

    0,3522

    MTEB

    Публичная таблицадругая ревизия

  • KorHateSpeechMLClassification

    main_score

    Результат

    0,0676

    MTEB

    Публичная таблицадругая ревизия

  • MacedonianTweetSentimentClassification

    main_score

    Результат

    0,3464

    MTEB

    Публичная таблицадругая ревизия

  • BUCC.v2

    main_score

    Результат

    0,3

    MTEB

    Публичная таблицадругая ревизия

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

NovaSearch/stella_en_400M_v5 — англоязычная модель эмбеддингов, обученная разработчиками Stella на основе Alibaba-NLP/gte-large-en-v1.5 и Alibaba-NLP/gte-Qwen2-1.5B-instruct. Она предназначена для преобразования текстов в векторы и оценки семантического сходства, включая поиск релевантных фрагментов по запросу. Модель содержит 433,9 млн параметров, поддерживает контекст до 8192 токенов и использует архитектуру SentenceTransformer на PyTorch; для большинства задач предусмотрены промпты s2p для поиска и s2s для сравнения текстов.

Обучение с Matryoshka Representation Learning позволяет получать эмбеддинги размером 512, 768, 1024, 2048, 4096, 6144 или 8192 измерения; авторы считают 1024 измерения достаточными для большинства задач. Модель можно применять для семантического поиска, поиска по запросу релевантных фрагментов и измерения сходства предложений. Хотя метаданные указывают контекст 8192 токена, README рекомендует длину последовательности 512: по наблюдениям авторов, на специализированных задачах поиска по длинным текстам модель работает хуже. Лицензия — MIT.

Сценарии применения

  • поиск релевантных фрагментов по текстовому запросу
  • семантический поиск по англоязычным документам
  • сравнение сходства двух предложений
  • ранжирование текстов по семантической близости

Ограничения

Для большинства сценариев README рекомендует ограничивать последовательность 512 токенами; на специализированных задачах поиска по длинным текстам качество может быть низким. Подробности обучения и использованных датасетов в карточке не приведены.

Для каких профессий подходит10

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Также подходит для

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Updates

We released a Jasper and Stella model technology report and code.(2025.1)

Report: https://arxiv.org/abs/2412.19048

Codes: https://github.com/NovaSearch-Team/RAG-Retrieval

Introduction

The models are trained based on Alibaba-NLP/gte-large-en-v1.5 and Alibaba-NLP/gte-Qwen2-1.5B-instruct. Thanks for their contributions!

We simplify usage of prompts, providing two prompts for most general tasks, one is for s2p, another one is for s2s.

Prompt of s2p task(e.g. retrieve task):

Instruct: Given a web search query, retrieve relevant passages that answer the query.\nQuery: {query}

Prompt of s2s task(e.g. semantic textual similarity task):

Instruct: Retrieve semantically similar text.\nQuery: {query}

The models are finally trained by MRL, so they have multiple dimensions: 512, 768, 1024, 2048, 4096, 6144 and 8192.

The higher the dimension, the better the performance. Generally speaking, 1024d is good enough. The MTEB score of 1024d is only 0.001 lower than 8192d.

Model directory structure

The model directory structure is very simple, it is a standard SentenceTransformer directory with a series of 2_Dense_{dims} folders, where dims represents the final vector dimension.

For example, the 2_Dense_256 folder stores Linear weights that convert vector dimensions to 256 dimensions. Please refer to the following chapters for specific instructions on how to use them.

Usage

You can use SentenceTransformers or transformers library to encode text.

Sentence Transformers

from sentence_transformers import SentenceTransformer

# This model supports two prompts: "s2p_query" and "s2s_query" for sentence-to-passage and sentence-to-sentence tasks, respectively.
# They are defined in `config_sentence_transformers.json`
query_prompt_name = "s2p_query"
queries = [
    "What are some ways to reduce stress?",
    "What are the benefits of drinking green tea?",
]
# docs do not need any prompts
docs = [
    "There are many effective ways to reduce stress. Some common techniques include deep breathing, meditation, and physical activity. Engaging in hobbies, spending time in nature, and connecting with loved ones can also help alleviate stress. Additionally, setting boundaries, practicing self-care, and learning to say no can prevent stress from building up.",
    "Green tea has been consumed for centuries and is known for its potential health benefits. It contains antioxidants that may help protect the body against damage caused by free radicals. Regular consumption of green tea has been associated with improved heart health, enhanced cognitive function, and a reduced risk of certain types of cancer. The polyphenols in green tea may also have anti-inflammatory and weight loss properties.",
]

# !The default dimension is 1024, if you need other dimensions, please clone the model and modify `modules.json` to replace `2_Dense_1024` with another dimension, e.g. `2_Dense_256` or `2_Dense_8192` !
# on gpu
model = SentenceTransformer("dunzhang/stella_en_400M_v5", trust_remote_code=True).cuda()
# you can also use this model without the features of `use_memory_efficient_attention` and `unpad_inputs`. It can be worked in CPU.
# model = SentenceTransformer(
#     "dunzhang/stella_en_400M_v5",
#     trust_remote_code=True,
#     device="cpu",
#     config_kwargs={"use_memory_efficient_attention": False, "unpad_inputs": False}
# )
query_embeddings = model.encode(queries, prompt_name=query_prompt_name)
doc_embeddings = model.encode(docs)
print(query_embeddings.shape, doc_embeddings.shape)
# (2, 1024) (2, 1024)

similarities = model.similarity(query_embeddings, doc_embeddings)
print(similarities)
# tensor([[0.8398, 0.2990],
#         [0.3282, 0.8095]])

Transformers

import os
import torch
from transformers import AutoModel, AutoTokenizer
from sklearn.preprocessing import normalize

query_prompt = "Instruct: Given a web search query, retrieve relevant passages that answer the query.\nQuery: "
queries = [
    "What are some ways to reduce stress?",
    "What are the benefits of drinking green tea?",
]
queries = [query_prompt + query for query in queries]
# docs do not need any prompts
docs = [
    "There are many effective ways to reduce stress. Some common techniques include deep breathing, meditation, and physical activity. Engaging in hobbies, spending time in nature, and connecting with loved ones can also help alleviate stress. Additionally, setting boundaries, practicing self-care, and learning to say no can prevent stress from building up.",
    "Green tea has been consumed for centuries and is known for its potential health benefits. It contains antioxidants that may help protect the body against damage caused by free radicals. Regular consumption of green tea has been associated with improved heart health, enhanced cognitive function, and a reduced risk of certain types of cancer. The polyphenols in green tea may also have anti-inflammatory and weight loss properties.",
]

# The path of your model after cloning it
model_dir = "{Your MODEL_PATH}"

vector_dim = 1024
vector_linear_directory = f"2_Dense_{vector_dim}"
model = AutoModel.from_pretrained(model_dir, trust_remote_code=True).cuda().eval()
# you can also use this model without the features of `use_memory_efficient_attention` and `unpad_inputs`. It can be worked in CPU.
# model = AutoModel.from_pretrained(model_dir, trust_remote_code=True,use_memory_efficient_attention=False,unpad_inputs=False).cuda().eval()
tokenizer = AutoTokenizer.from_pretrained(model_dir, trust_remote_code=True)
vector_linear = torch.nn.Linear(in_features=model.config.hidden_size, out_features=vector_dim)
vector_linear_dict = {
    k.replace("linear.", ""): v for k, v in
    torch.load(os.path.join(model_dir, f"{vector_linear_directory}/pytorch_model.bin")).items()
}
vector_linear.load_state_dict(vector_linear_dict)
vector_linear.cuda()

# Embed the queries
with torch.no_grad():
    input_data = tokenizer(queries, padding="longest", truncation=True, max_length=512, return_tensors="pt")
    input_data = {k: v.cuda() for k, v in input_data.items()}
    attention_mask = input_data["attention_mask"]
    last_hidden_state = model(**input_data)[0]
    last_hidden = last_hidden_state.masked_fill(~attention_mask[..., None].bool(), 0.0)
    query_vectors = last_hidden.sum(dim=1) / attention_mask.sum(dim=1)[..., None]
    query_vectors = normalize(vector_linear(query_vectors).cpu().numpy())

# Embed the documents
with torch.no_grad():
    input_data = tokenizer(docs, padding="longest", truncation=True, max_length=512, return_tensors="pt")
    input_data = {k: v.cuda() for k, v in input_data.items()}
    attention_mask = input_data["attention_mask"]
    last_hidden_state = model(**input_data)[0]
    last_hidden = last_hidden_state.masked_fill(~attention_mask[..., None].bool(), 0.0)
    docs_vectors = last_hidden.sum(dim=1) / attention_mask.sum(dim=1)[..., None]
    docs_vectors = normalize(vector_linear(docs_vectors).cpu().numpy())

print(query_vectors.shape, docs_vectors.shape)
# (2, 1024) (2, 1024)

similarities = query_vectors @ docs_vectors.T
print(similarities)
# [[0.8397531  0.29900077]
#  [0.32818374 0.80954516]]

infinity_emb

Usage via infinity, MIT Licensed.

docker run \
--gpus all -p "7997":"7997" \
michaelf34/infinity:0.0.69 \
v2 --model-id dunzhang/stella_en_400M_v5 --revision "refs/pr/24" --dtype bfloat16 --batch-size 16 --device cuda --engine torch --port 7997 --no-bettertransformer

Citation


@misc{zhang2025jasperstelladistillationsota,
      title={Jasper and Stella: distillation of SOTA embedding models}, 
      author={Dun Zhang and Jiacheng Li and Ziyang Zeng and Fulong Wang},
      year={2025},
      eprint={2412.19048},
      archivePrefix={arXiv},
      primaryClass={cs.IR},
      url={https://arxiv.org/abs/2412.19048}, 
}

FAQ

Q: The details of training?

A: The training method and datasets will be released in the future. (specific time unknown, may be provided in a paper)

Q: How to choose a suitable prompt for my own task?

A: In most cases, please use the s2p and s2s prompts. These two prompts account for the vast majority of the training data.

Q: How to reproduce MTEB results?

A: Please use evaluation scripts in Alibaba-NLP/gte-Qwen2-1.5B-instruct or intfloat/e5-mistral-7b-instruct

Q: Why each dimension has a linear weight?

A: MRL has multiple training methods, we choose this method which has the best performance.

Q: What is the sequence length of models?

A: 512 is recommended, in our experiments, almost all models perform poorly on specialized long text retrieval datasets. Besides, the model is trained on datasets of 512 length. This may be an optimization term.

If you have any questions, please start a discussion on community.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм

Нельзя запустить

Модели нужен код из репозитория; автор пока не в списке доверенных организаций.

Класс архитектуры
NewModel
Ревизия весов
ffeb2b7

0 моделей