AILACasedocs
0,2296
Один прогон
Направление метрики неизвестно, сравнение не строится
Составлено на русском по карточке модели и метаданным Hugging Face
LLM2Vec-Mistral-7B-Instruct-v2-mntp-unsup-simcse — модель для получения текстовых эмбеддингов на основе Mistral-7B-Instruct-v2, представленная организацией или исследовательской группой McGill-NLP.
В репозитории указано, что модель распространяется с использованием PEFT и предназначена для преобразования текста в векторные представления, пригодные для сравнения семантической близости.
Модель ориентирована на семантический поиск и информационный retrieval, reranking, классификацию, кластеризацию, оценку текстовой семантической близости и извлечение признаков. В README заявлен английский язык и приведены результаты на наборах MTEB, включая задачи классификации, поиска, кластеризации, reranking и STS. Архитектура основана на модели класса Mistral с 7 млрд параметров; сведения о поддерживаемых модальностях, размере контекста и точных процедурах инференса не указаны. Сильная сторона — универсальность эмбеддингов для широкого спектра задач обработки текста; ограничения, включая качество на других языках и зависимость результатов от конкретного домена, требуют дополнительной проверки. Лицензия — MIT.
Результаты из открытых лидербордов в сравнении с лидерами каталога на 1 декабря 2026
0,2296
Один прогон
Направление метрики неизвестно, сравнение не строится
0,2248
Один прогон
Направление метрики неизвестно, сравнение не строится
0,3557
12 результатов: 0,3557–0,4747
Направление метрики неизвестно, сравнение не строится
0,3064
Один прогон
Направление метрики неизвестно, сравнение не строится
0,5876
Один прогон
Направление метрики неизвестно, сравнение не строится
0,2655
Один прогон
Направление метрики неизвестно, сравнение не строится
Разделы каталога профессий, в задачах которых используется эта модель
README от автора на Hugging Face, как он его опубликовал
LLM2Vec is a simple recipe to convert decoder-only LLMs into text encoders. It consists of 3 simple steps: 1) enabling bidirectional attention, 2) masked next token prediction, and 3) unsupervised contrastive learning. The model can be further fine-tuned to achieve state-of-the-art performance.
pip install llm2vec
from llm2vec import LLM2Vec
import torch
from transformers import AutoTokenizer, AutoModel, AutoConfig
from peft import PeftModel
# Loading base Mistral model, along with custom code that enables bidirectional connections in decoder-only LLMs. MNTP LoRA weights are merged into the base model.
tokenizer = AutoTokenizer.from_pretrained(
"McGill-NLP/LLM2Vec-Mistral-7B-Instruct-v2-mntp"
)
config = AutoConfig.from_pretrained(
"McGill-NLP/LLM2Vec-Mistral-7B-Instruct-v2-mntp", trust_remote_code=True
)
model = AutoModel.from_pretrained(
"McGill-NLP/LLM2Vec-Mistral-7B-Instruct-v2-mntp",
trust_remote_code=True,
config=config,
torch_dtype=torch.bfloat16,
device_map="cuda" if torch.cuda.is_available() else "cpu",
)
model = PeftModel.from_pretrained(
model,
"McGill-NLP/LLM2Vec-Mistral-7B-Instruct-v2-mntp",
)
model = model.merge_and_unload() # This can take several minutes on cpu
# Loading unsupervised SimCSE model. This loads the trained LoRA weights on top of MNTP model. Hence the final weights are -- Base model + MNTP (LoRA) + SimCSE (LoRA).
model = PeftModel.from_pretrained(
model, "McGill-NLP/LLM2Vec-Mistral-7B-Instruct-v2-mntp-unsup-simcse"
)
# Wrapper for encoding and pooling operations
l2v = LLM2Vec(model, tokenizer, pooling_mode="mean", max_length=512)
# Encoding queries using instructions
instruction = (
"Given a web search query, retrieve relevant passages that answer the query:"
)
queries = [
[instruction, "how much protein should a female eat"],
[instruction, "summit define"],
]
q_reps = l2v.encode(queries)
# Encoding documents. Instruction are not required for 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.",
]
d_reps = l2v.encode(documents)
# Compute cosine similarity
q_reps_norm = torch.nn.functional.normalize(q_reps, p=2, dim=1)
d_reps_norm = torch.nn.functional.normalize(d_reps, p=2, dim=1)
cos_sim = torch.mm(q_reps_norm, d_reps_norm.transpose(0, 1))
print(cos_sim)
"""
tensor([[0.6175, 0.2535],
[0.2298, 0.5792]])
"""
If you have any question about the code, feel free to email Parishad (parishad.behnamghader@mila.quebec) and Vaibhav (vaibhav.adlakha@mila.quebec).
На своей GPU в ailist. Цена — по текущим предложениям провайдеров
GPU в ailist
Универсальный рантайм · peft
Репозиторий содержит только адаптер (LoRA/PEFT) без базовой модели.