/ Модель

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

Лицензия
MIT
Базовая модель
bge-m3
Библиотека
transformers
Опубликована
19 ноя 2026

BanhTrangPhoi-L20

ЭмбеддингиТекст → embedding8 профессий
0скачиваний за 30 дней2лайкавеса обновлены19 ноя 2026

Описание модели

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

Компактная дистиллированная многоязычная модель BGE-M3 для семантического и гибридного поиска по документам с плотными, разреженными и ColBERT-представлениями.

BanhTrangPhoi-L20 — компактная многоязычная модель для поиска по текстам, созданная как дистиллированная и сокращённая версия BAAI/bge-m3. Разработчик оставил три выходных компонента исходной модели: плотные эмбеддинги размерности 1024, разреженные лексические веса и многовекторные представления ColBERT. Модель содержит 388 млн параметров, использует 20 слоёв трансформера вместо 24 и словарь из 125 000 токенов. Доступны веса safetensors fp16 и варианты ONNX fp32 и динамической int8-квантизации.

Модель предназначена для построения многоязычного семантического и гибридного поиска по документам. Разработчик рекомендует сочетать плотные векторы с BM25; все три головы можно использовать для схемы dense + sparse + ColBERT. Проверялись вьетнамский, японский, английский, китайский, корейский, арабский, испанский, французский, хинди, индонезийский, русский и тайский языки; контекст в описанных испытаниях ограничен 512 токенами. По результатам разработчика, китайский и корейский языки в некоторых межъязыковых сценариях слабее исходной BGE-M3; int8-вариант также уступил установленному порогу на части тестов, поэтому для корейского разработчик советует fp32. Лицензия — MIT.

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

  • семантический поиск по многоязычным документам
  • гибридный поиск с плотными эмбеддингами и BM25
  • ранжирование результатов поиска с ColBERT-векторами
  • построение лексического поиска по весам токенов
  • извлечение эмбеддингов текстов для поискового индекса

Ограничения

На тестах разработчика китайский и корейский показали небольшое снижение качества относительно BGE-M3, особенно в межъязыковом поиске; int8-вариант не прошёл установленный порог на части тестов. Проверки охватывали последовательности до 512 токенов и ограниченный набор поисковых коллекций, поэтому результаты могут отличаться на других данных.

Публичные бенчмарки

Результаты из открытых лидербордов в сравнении с лидерами каталога

Публичных оценок пока нет

В подключённых источниках результатов этой модели не нашлось. Отсутствие оценки не значит, что модель хуже: её могли просто не проверять.

Источники: Hugging Face Leaderboards, Hugging Face Eval Results, Open LLM v2, MTEB, timm, Open ASR, EvalPlus, LLM Stats

Бенчмарки пользователейпока нет

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

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

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

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

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

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

    Модели ответят на каждую задачу, судья оценит ответы по шкале 0–100.

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

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

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

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

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

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

Открыть на Hugging Face

BanhTrangPhoi-L20

A smaller, faster student of BAAI/bge-m3 that keeps all three bge-m3 heads (dense, sparse/lexical, ColBERT multi-vector).

  • 20 transformer layers (teacher layers 0, 1, 2, 3, 6, 8, 9, 10, 11, 12, 14, 15 and 16-23) instead of 24.
  • Vocabulary pruned from 250,002 to 125,000 tokens (about 128M parameters saved), 388M parameters in total.
  • Trained by knowledge distillation from bge-m3 (see "Training").
  • Same output space as bge-m3: 1024-d dense vectors (L2-normalised), per-token sparse weights, 1024-d ColBERT vectors.

Read this first: status and honest limits

This model did NOT pass our tier-1 release gate against the original bge-m3. The gate (our own, set 2026-11-18) requires non-inferiority on every tier-1 cell: delta >= -1.0 point AND 95% CI lower bound >= -2.5 on the ALL cell of vi/ja/en/zh/ko and on every sub-cell with n >= 250. The L20 fp16 model falls outside it on 15 cells, all of them Chinese/Korean cross-lingual MKQA cells (n = 250), Korean ALL recall@50 (dense), and Vietnamese ALL recall@50 (dense, delta -0.6 with a wide CI). Tier 2 (ar, es, fr, hi, id, ru, th) is within its limits in every mode for fp16, fp32 and Q8_0, and fails in the all mode for the int8 variant (see table). Full lists are in gate/.

Practical reading: Vietnamese, Japanese and English are on par with bge-m3 in our pools; Chinese and Korean are slightly weaker, mostly in the cross-lingual (query in zh/ko, English corpus) setting. If those matter to you, test on your own data.

Not measured: anything beyond 512 tokens (all gates use max_len 512), languages outside the list above, and retrieval domains outside our pools. Absolute scores are for our pools and our scoring code; do not compare them with numbers from other harnesses.

Results against bge-m3 (fp16, same scoring path)

Tier 1, ALL cells, mode all (dense + sparse + ColBERT), recall@20 in %, teacher -> student:

variantvijaenzhkotier-2 mean delta (all / dense)
gpu-fp1694.6 -> 95.1100 -> 10098.9 -> 10091.1 -> 90.289.9 -> 89.7-0.91 / -0.57
cpu-fp32 (ONNX)94.6 -> 95.1100 -> 10098.9 -> 10091.1 -> 90.489.9 -> 89.7-0.92 / -0.59
cpu-int8-hlf (ONNX int8)94.6 -> 95.7100 -> 10098.9 -> 10091.1 -> 90.489.9 -> 88.8-1.12 (below the -1.0 limit) / -0.97
Q8_0 GGUF (separate repo)94.6 -> 95.1100 -> 10098.9 -> 10091.1 -> 90.489.9 -> 89.7-0.95 / -0.61

Measurement: 4,631 queries over 20 pools (about 94k documents), max_len 512. Tier 1 = vi/ja/en/zh/ko (MIRACL, MKQA, MLDR and a few small in-house domain pools, labelled in the tables); tier 2 = ar/es/fr/hi/id/ru/th (MIRACL, MKQA, MLDR). Tier-2 delta is in points of 100 x metric (nDCG@10 for MIRACL/MLDR, recall@100 for MKQA), averaged over the gated cells. Confidence intervals: paired bootstrap over queries.

Variants (folders)

folderformatsizeuse it when
gpu-fp16/safetensors fp16 (HF XLMRobertaModel) + head weights0.78 GBGPU, or when you want to fine-tune / re-export. Reference quality.
cpu-fp32/ONNX fp32 with all three heads1.56 GBCPU when quality matters most (Korean, Chinese).
cpu-int8-hlf/ONNX, dynamic per-channel int80.95 GBCPU, dense (+ BM25) retrieval where RAM and latency matter. About 1.7-2.1x faster and ~23% less RAM than fp32 on our CPU benchmark. Costs about 0.9 points Korean ALL recall@20 (mode all) vs the fp16 student; fails the tier-2 limit in the all mode (-1.12); dense-only tier 2 is -0.97. Prefer cpu-fp32 for Korean.
GGUF Q8_0llama.cpp0.44 GBin the separate repo EVOKA/BanhTrangPhoi-L20-GGUF

cpu-int8-hlf: onnxruntime dynamic int8 on MatMul weights; the sparse/ColBERT head MatMuls and layers 0, 1, 18, 19 stay fp32 ("hlf" = heads + last2 + first2). Each folder is self-contained (tokenizer, id_map_*.json, head weights, PRUNE_INFO.json, SURGERY.json).

Usage

ONNX (cpu-fp32/ or cpu-int8-hlf/), all three heads in one call

import numpy as np, onnxruntime as ort
from huggingface_hub import snapshot_download
from tokenizers import Tokenizer

folder = "cpu-int8-hlf"   # or "cpu-fp32"
p = snapshot_download("EVOKA/BanhTrangPhoi-L20", allow_patterns=[f"{folder}/*"]) + "/" + folder
tk = Tokenizer.from_file(f"{p}/tokenizer.json")
tk.enable_padding(pad_id=1, pad_token="<pad>"); tk.enable_truncation(512)
sess = ort.InferenceSession(f"{p}/model.onnx", providers=["CPUExecutionProvider"])

def encode(texts):
    e = tk.encode_batch(texts)
    ids = np.array([x.ids for x in e], dtype=np.int64)
    mask = np.array([x.attention_mask for x in e], dtype=np.int64)
    dense, sparse, colbert = sess.run(None, {"input_ids": ids, "attention_mask": mask})
    return dense, sparse, colbert, ids, mask

dense, sparse, colbert, ids, mask = encode(["Hà Nội là thủ đô của Việt Nam.", "Thủ đô nước Việt Nam là gì?"])
print(dense.shape, float(dense[0] @ dense[1]))   # (2, 1024); dense is already L2-normalised

Outputs: dense_vecs (b, 1024), sparse_vecs (b, t) = weight per input token, colbert_vecs (b, t-1, 1024) (position 0 / CLS excluded; use mask[:, 1:] to drop padding). Sparse: build the lexical dict per text as max weight per token id, skipping weights <= 0 and the special ids 0, 1, 2, 3 (see reference/m3.py, lex_dict). The token ids are the pruned vocabulary; to compare with bge-m3's sparse weights map them with id_map_new2old.json.

Recommended retrieval setup: dense + BM25

We suggest using the dense head together with a classic BM25 / keyword index (hybrid retrieval) instead of the sparse or ColBERT heads. This is the setup the cpu-int8-hlf variant targets. Use the sparse and ColBERT heads when you want bge-m3's full "all" scoring (dense + sparse + colbert, weights as in bge-m3); they are available from all folders.

PyTorch (gpu-fp16/)

reference/m3.py is a minimal loader of the three heads on top of XLMRobertaModel: dense = L2(CLS), sparse = relu(Linear(h)) per token, ColBERT = L2(Linear(h[1:])). Pass the gpu-fp16 folder as path.

Speed and memory (CPU, indicative)

Measured on one aarch64 box (Cortex-X925 / A725, 16 threads, onnxruntime 1.22.1), while other jobs were running (load average about 12), 3 heads computed. "b1" = batch-1 latency p50 in ms; "b64" = throughput in texts/s with batch 64; RSS in MB at 512 tokens. Query = 32 tokens, passages = 256 / 512 tokens. Numbers are noisy; measure on your hardware.

variantq32 b1 / b64p256 b1 / b64p512 b1 / b64RSS (p512)
cpu-fp3233.7 ms / 42.3231.8 ms / 5.7480.9 ms / 3.23.8 GB
cpu-int8-hlf18.9 ms / 84.9127.9 ms / 12.0265.3 ms / 5.52.9 GB

GPU (RTX 3060, torch fp16, batch 128, shared machine, best of several runs, earlier measurement): passages of 256 tokens, 3 heads: bge-m3 118.5 texts/s vs L20 133.3 (about 1.12x); dense only: 134.5 vs 159.4 (about 1.2x). The GGUF variant is benchmarked in its own repo card.

Training

Teacher: BAAI/bge-m3. The student is initialised from the teacher by vocabulary pruning (keep-set of 125k ids) and layer selection, then trained by knowledge distillation: KL divergence on the dense / sparse / ColBERT / combined score matrices, a feature-matching loss, and a small InfoNCE term, with an online fp16 teacher and hard negatives from a precomputed teacher dense index. Final stage: 5k steps, lr 1e-5, about 147k rows.

Training data includes FineWeb-2 (ODC-By 1.0), C4 (ODC-By 1.0), Aya (Apache-2.0), OASST1 (Apache-2.0), TyDi QA questions (Apache-2.0), Wikidata (CC0). MIRACL, MKQA and MLDR were used for evaluation only, and near-duplicates of evaluation queries/passages were removed from the training mix. The licences of the individual sources apply to those sources; no claim is made here about the licence status of any other data.

License and citation

Model weights and code in this repository: MIT (the teacher, BAAI/bge-m3, is MIT-licensed). Please also credit the teacher:

@misc{bge-m3,
  title={BGE M3-Embedding: Multi-Lingual, Multi-Functionality, Multi-Granularity Text Embeddings Through Self-Knowledge Distillation},
  author={Chen, Jianlv and Xiao, Shitao and Zhang, Peitian and Luo, Kun and Lian, Defu and Liu, Zheng},
  year={2024}, eprint={2402.03216}, archivePrefix={arXiv}
}

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

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

GPU в ailist

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

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

Подбираем GPU…

Ревизия весов
843a43a

0 моделей