/ Модель

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

Контекст
512 токенов
Параметры
25,9 млн
Лицензия
Apache 2.0
Архитектура
bert · dense
Базовая модель
MiniLM-L6-v2
Опубликована
8 авг 2025

mdbr-leaf-ir

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

Компактная англоязычная BERT-модель MongoDB Research создаёт эмбеддинги для поиска и ранжирования документов, включая поиск в RAG-системах.

13 580скачиваний за 30 дней67лайковвеса обновлены20 июл 2026

Бенчмарки

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

Тесты пользователейпока нет

Никто ещё не опубликовал тест этой модели. Соберите бенчмарк из своих задач — результат появится здесь.

  1. Добавьте модель в бенчмарк

    Вместе с другими моделями категории «Эмбеддинги» — сравнение идёт внутри одной категории.

  2. Опишите свои задачи

    Напишите запросы, при необходимости приложите файлы и эталонные ответы.

  3. Запустите и опубликуйте

    Модели ответят на каждую задачу, судья оценит ответы. Опубликованный результат появится на этой странице.

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

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

  • EnglishFinance2Retrieval

    main_score

    Результат

    0,5057

    MTEB

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

  • Touche2020

    main_score

    Результат

    0,3081

    MTEB

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

  • AppsRetrieval

    main_score

    Результат

    0,0422

    MTEB

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

  • TRECCOVID

    main_score

    Результат

    0,8197

    MTEB

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

  • Code1Retrieval

    main_score

    Результат

    0,7855

    MTEB

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

  • QuoraRetrieval

    main_score

    Результат

    0,8617

    MTEB

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

  • CUREv1

    main_score

    Результат

    0,5487

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

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

  • NFCorpus

    main_score

    Результат

    0,3653

    MTEB

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

  • ChatDoctorRetrieval

    main_score

    Результат

    0,5189

    MTEB

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

  • DBPedia

    main_score

    Результат

    0,4536

    MTEB

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

  • ClimateFEVER

    main_score

    Результат

    0,3485

    MTEB

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

  • MSMARCO

    main_score

    Результат

    0,4057

    MTEB

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

  • SCIDOCS

    main_score

    Результат

    0,1977

    MTEB

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

  • WikiSQLRetrieval

    main_score

    Результат

    0,8226

    MTEB

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

  • FinanceBenchRetrieval

    main_score

    Результат

    0,7293

    MTEB

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

  • EnglishFinance1Retrieval

    main_score

    Результат

    0,7138

    MTEB

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

  • EnglishHealthcare1Retrieval

    main_score

    Результат

    0,5375

    MTEB

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

  • SciFact

    main_score

    Результат

    0,7056

    MTEB

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

  • EnglishFinance3Retrieval

    main_score

    Результат

    0,6153

    MTEB

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

  • FiQA2018

    main_score

    Результат

    0,3917

    MTEB

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

  • AILAStatutes

    main_score

    Результат

    0,2555

    MTEB

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

  • HC3FinanceRetrieval

    main_score

    Результат

    0,4527

    MTEB

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

  • EnglishFinance4Retrieval

    main_score

    Результат

    0,41

    MTEB

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

  • DS1000Retrieval

    main_score

    Результат

    0,3036

    MTEB

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

  • AILACasedocs

    main_score

    Результат

    0,2664

    MTEB

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

  • FEVER

    main_score

    Результат

    0,866

    MTEB

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

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

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

mdbr-leaf-ir — компактная модель эмбеддингов текста, разработанная командой MongoDB Research для информационного поиска, в том числе для этапа поиска документов в RAG-системах. Она основана на архитектуре BERT и дообучена на базе microsoft/MiniLM-L6-v2. Модель содержит 25,9 млн параметров и обрабатывает последовательности длиной до 512 токенов.

Модель кодирует запросы и документы в векторы для поиска и ранжирования по смысловому сходству. Она поддерживает асимметричный поиск, когда запросы и документы кодируются разными способами, а также сокращение размерности векторов (MRL) и их квантизацию, чтобы уменьшить затраты на хранение и поиск. В README заявлены результаты на уровне лидеров среди компактных моделей на бенчмарке BEIR.

Модель рассчитана на английский язык. Доступны веса в форматах Safetensors и ONNX. Лицензия — Apache-2.0. MongoDB Research отмечает, что на момент публикации модель не используется в коммерческих продуктах или услугах MongoDB.

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

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

Ограничения

Модель предназначена для информационного поиска; README рекомендует mdbr-leaf-mt для классификации, кластеризации, обобщения и других задач. Заявленные результаты BEIR приведены в карточке модели и сами по себе не гарантируют качество на конкретном корпусе.

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

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

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

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

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

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

Открыть на Hugging Face

Content

  1. Introduction
  2. Technical Report
  3. Highlights
  4. Benchmarks
  5. Quickstart
  6. Citation

Introduction

mdbr-leaf-ir is a compact high-performance text embedding model specifically designed for information retrieval (IR) tasks, e.g., the retrieval stage of Retrieval-Augmented Generation (RAG) pipelines.

To enable even greater efficiency, mdbr-leaf-ir supports flexible asymmetric architectures and is robust to vector quantization and MRL truncation.

If you are looking to perform other tasks such as classification, clustering, semantic sentence similarity, summarization, please check out our mdbr-leaf-mt model.

[!Note]
Note: this model has been developed by the ML team of MongoDB Research. At the time of writing it is not used in any of MongoDB's commercial product or service offerings.

Technical Report

A technical report detailing our proposed LEAF training procedure is available here.

Highlights

  • State-of-the-Art Performance: mdbr-leaf-ir achieves state-of-the-art results for compact embedding models, ranking #1 on the public BEIR benchmark leaderboard for models with ≤100M parameters.
  • Flexible Architecture Support: mdbr-leaf-ir supports asymmetric retrieval architectures enabling even greater retrieval results. See below for more information.
  • MRL and Quantization Support: embedding vectors generated by mdbr-leaf-ir compress well when truncated (MRL) and can be stored using more efficient types like int8 and binary. See below for more information.

Benchmark Comparison

The table below shows the average BEIR benchmark scores (nDCG@10) for mdbr-leaf-ir compared to other retrieval models.

mdbr-leaf-ir ranks #1 on the BEIR public leaderboard, and when run in asymmetric "(asym.)" mode as described here, the results improve even further.

ModelSizeBEIR Avg. (nDCG@10)
OpenAI text-embedding-3-largeUnknown55.43
mdbr-leaf-ir (asym.)23M54.03
mdbr-leaf-ir23M53.55
snowflake-arctic-embed-s32M51.98
bge-small-en-v1.533M51.65
OpenAI text-embedding-3-smallUnknown51.08
granite-embedding-small-english-r247M50.87
snowflake-arctic-embed-xs23M50.15
e5-small-v233M49.04
SPLADE++110M48.88
MiniLM-L6-v223M41.95
BM25–41.14

Quickstart

Sentence Transformers

from sentence_transformers import SentenceTransformer  
  
# Load the model  
model = SentenceTransformer("MongoDB/mdbr-leaf-ir")  
  
# Example queries and documents  
queries = [
    "What is machine learning?",  
    "How does neural network training work?"  
]  
  
documents = [  
    "Machine learning is a subset of artificial intelligence that focuses on algorithms that can learn from data.",  
    "Neural networks are trained through backpropagation, adjusting weights to minimize prediction errors."  
]  
  
# Encode queries and documents  
query_embeddings = model.encode(queries, prompt_name="query")  
document_embeddings = model.encode(documents)  
  
# Compute similarity scores  
scores = model.similarity(query_embeddings, document_embeddings)  

# Print results
for i, query in enumerate(queries):
    print(f"Query: {query}")
    for j, doc in enumerate(documents):
        print(f" Similarity: {scores[i, j]:.4f} | Document {j}: {doc[:80]}...")
Query: What is machine learning?
 Similarity: 0.6857 | Document 0: Machine learning is a subset of ...
 Similarity: 0.4598 | Document 1: Neural networks are trained ...

Query: How does neural network training work?
 Similarity: 0.4238 | Document 0: Machine learning is a subset of ...
 Similarity: 0.5723 | Document 1: Neural networks are trained ...

Transformers.js

If you haven't already, you can install the Transformers.js JavaScript library from NPM using:

npm i @huggingface/transformers

You can then use the model to compute embeddings like this:

import { AutoModel, AutoTokenizer, matmul } from "@huggingface/transformers";

// Download from the 🤗 Hub
const model_id = "MongoDB/mdbr-leaf-ir";
const tokenizer = await AutoTokenizer.from_pretrained(model_id);
const model = await AutoModel.from_pretrained(model_id, {
    dtype: "fp32", // Options: "fp32" | "fp16" | "q8" | "q4" | "q4f16"
});

// Prepare queries and documents
const queries = [
    "What is machine learning?",
    "How does neural network training work?",
];
const documents = [  
    "Machine learning is a subset of artificial intelligence that focuses on algorithms that can learn from data.",
    "Neural networks are trained through backpropagation, adjusting weights to minimize prediction errors.",
];
const inputs = await tokenizer([
    ...queries.map((x) => "Represent this sentence for searching relevant passages: " + x),
    ...documents,
], { padding: true });

// Generate embeddings
const { sentence_embedding } = await model(inputs);

// Compute similarities
const scores = await matmul(
    sentence_embedding.slice([0, queries.length]),
    sentence_embedding.slice([queries.length, null]).transpose(1, 0),
);
const scores_list = scores.tolist();

for (let i = 0; i < queries.length; ++i) {
    console.log(`Query: ${queries[i]}`);
    for (let j = 0; j < documents.length; ++j) {
        console.log(` Similarity: ${scores_list[i][j].toFixed(4)} | Document ${j}: ${documents[j]}`);
    }
    console.log();
}
Query: What is machine learning?
 Similarity: 0.6857 | Document 0: Machine learning is a subset of artificial intelligence that focuses on algorithms that can learn from data.
 Similarity: 0.4598 | Document 1: Neural networks are trained through backpropagation, adjusting weights to minimize prediction errors.

Query: How does neural network training work?
 Similarity: 0.4238 | Document 0: Machine learning is a subset of artificial intelligence that focuses on algorithms that can learn from data.
 Similarity: 0.5723 | Document 1: Neural networks are trained through backpropagation, adjusting weights to minimize prediction errors.

Transformers Usage

See full example notebook here.

Asymmetric Retrieval Setup

[!Note]
Note: a version of this asymmetric setup, conveniently packaged into a single model, is available here.

mdbr-leaf-ir is aligned to snowflake-arctic-embed-m-v1.5, the model it has been distilled from. This enables flexible architectures in which, for example, documents are encoded using the larger model, while queries can be encoded faster and more efficiently with the compact leaf model:

# Use mdbr-leaf-ir for query encoding (real-time, low latency)  
query_model = SentenceTransformer("MongoDB/mdbr-leaf-ir")  
query_embeddings = query_model.encode(queries, prompt_name="query")  

# Use a larger model for document encoding (one-time, at index time)  
doc_model = SentenceTransformer("Snowflake/snowflake-arctic-embed-m-v1.5")  
document_embeddings = doc_model.encode(documents)  

# Compute similarities  
scores = query_model.similarity(query_embeddings, document_embeddings)  

Retrieval results in asymmetric mode are often superior to the standard mode above.

MRL Truncation

Embeddings have been trained via MRL and can be truncated for more efficient storage:

query_embeds = model.encode(queries, prompt_name="query", truncate_dim=256)
doc_embeds = model.encode(documents, truncate_dim=256)

similarities = model.similarity(query_embeds, doc_embeds)

print('After MRL:')
print(f"* Embeddings dimension: {query_embeds.shape[1]}")
print(f"* Similarities: \n\t{similarities}")
After MRL:
* Embeddings dimension: 256
* Similarities:
  tensor([[0.7136, 0.4989],
          [0.4567, 0.6022]])

Vector Quantization

Vector quantization, for example to int8 or binary, can be performed as follows:

Note: For vector quantization to types other than binary, we suggest performing a calibration to determine the optimal ranges, see here. Good initial values, according to the teacher model's documentation, are:

  • int8: -0.3 and +0.3
  • int4: -0.18 and +0.18
from sentence_transformers.quantization import quantize_embeddings
import torch

query_embeds = model.encode(queries, prompt_name="query")
doc_embeds = model.encode(documents)

# Quantize embeddings to int8 using -0.3 and +0.3 as calibration ranges
ranges = torch.tensor([[-0.3], [+0.3]]).expand(2, query_embeds.shape[1]).cpu().numpy()
query_embeds = quantize_embeddings(query_embeds, "int8", ranges=ranges)
doc_embeds = quantize_embeddings(doc_embeds, "int8", ranges=ranges)

# Calculate similarities; cast to int64 to avoid under/overflow
similarities = query_embeds.astype(int) @ doc_embeds.astype(int).T

print('After quantization:')
print(f"* Embeddings type: {query_embeds.dtype}")
print(f"* Similarities: \n{similarities}")
After quantization:
* Embeddings type: int8
* Similarities:
   [[118022  79111]
    [ 72961  98333]]

Evaluation

Please see here.

Citation

If you use this model in your work, please cite:

@inproceedings{vujanic-ruckstiess-2026-leaf,
    title = "{LEAF}: Knowledge Distillation of Text Embedding Models with Teacher-Aligned Representations",
    author = {Vujanic, Robin  and
      R{\"u}ckstie{\ss}, Thomas},
    editor = "Liakata, Maria  and
      Moreira, Viviane P.  and
      Zhang, Jiajun  and
      Jurgens, David",
    booktitle = "Proceedings of the 64th Annual Meeting of the {A}ssociation for {C}omputational {L}inguistics (Volume 1: Long Papers)",
    month = jul,
    year = "2026",
    address = "San Diego, California, United States",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2026.acl-long.2008/",
    doi = "10.18653/v1/2026.acl-long.2008",
    pages = "43362--43383",
    ISBN = "979-8-89176-390-6",
    abstract = "We present a knowledge distillation framework for text embedding models. A key distinguishing feature is that our distilled models are compatible with their teacher, enabling flexible asymmetric architectures where documents are encoded with the larger teacher model, while queries use smaller student models. We also show that our models automatically inherit MRL and robustness to output quantization whenever these properties are present in the teacher model, without explicitly training for them. To demonstrate the effectiveness of our framework we publish leaf-ir, a 23M parameters information retrieval oriented model that, besides being teacher-compatibile, sets a new state-of-the-art (SOTA) on BEIR, ranking no.1 on the public leaderboard for models of its size. Asymmetric mode further increases its retrieval performance. Our scheme is however not restricted to information retrieval. We demonstrate its wider applicability by synthesizing the multi-task leaf-mt model. This also sets a new SOTA, achieving no.1 on the public MTEB v2 (English) leaderboard for models of its size. Our technique is applicable to black-box models, requires no judgments nor hard negatives, and training can be conducted using small batch sizes. Thus, dataset and training infrastructure requirements for our framework are modest. We make our models publicly available under a permissive Apache 2.0 license."
}

License

This model is released under Apache 2.0 License.

Contact

For questions or issues, please open an issue or pull request. You can also contact the MongoDB ML research team at robin.vujanic@mongodb.com.

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

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

GPU в ailist

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

Можно запустить

Подбираем GPU…

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

0 моделей