Sentence Similarity
sentence-transformers
Safetensors
Russian
bert
embeddings
mteb
text-embeddings-inference
Instructions to use IIIaHTu/komugi_embeddings with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use IIIaHTu/komugi_embeddings with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("IIIaHTu/komugi_embeddings") sentences = [ "Это счастливый человек", "Это счастливая собака", "Это очень счастливый человек", "Сегодня солнечный день" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
Publish Komugi Embeddings
Browse files- 1_Pooling/config.json +10 -0
- LICENSE +21 -0
- NOTICE +4 -0
- README.md +108 -0
- config.json +31 -0
- config_sentence_transformers.json +47 -0
- model.safetensors +3 -0
- modules.json +20 -0
- sentence_bert_config.json +4 -0
- tokenizer.json +0 -0
- tokenizer_config.json +16 -0
1_Pooling/config.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"word_embedding_dimension": 312,
|
| 3 |
+
"pooling_mode_cls_token": false,
|
| 4 |
+
"pooling_mode_mean_tokens": true,
|
| 5 |
+
"pooling_mode_max_tokens": false,
|
| 6 |
+
"pooling_mode_mean_sqrt_len_tokens": false,
|
| 7 |
+
"pooling_mode_weightedmean_tokens": false,
|
| 8 |
+
"pooling_mode_lasttoken": false,
|
| 9 |
+
"include_prompt": true
|
| 10 |
+
}
|
LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2026 IIIaHTu (Komugi Embeddings contributions)
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
NOTICE
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Komugi Embeddings
|
| 2 |
+
|
| 3 |
+
Base checkpoint (MIT): https://huggingface.co/cointegrated/rubert-tiny2
|
| 4 |
+
Distillation teacher: https://huggingface.co/ai-forever/FRIDA
|
README.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: ru
|
| 3 |
+
library_name: sentence-transformers
|
| 4 |
+
pipeline_tag: sentence-similarity
|
| 5 |
+
base_model: cointegrated/rubert-tiny2
|
| 6 |
+
license: mit
|
| 7 |
+
tags:
|
| 8 |
+
- embeddings
|
| 9 |
+
- mteb
|
| 10 |
+
datasets:
|
| 11 |
+
- wikimedia/wikipedia
|
| 12 |
+
- HuggingFaceFW/fineweb-2
|
| 13 |
+
- zloelias/lenta-ru
|
| 14 |
+
- IlyaGusev/gazeta
|
| 15 |
+
- kuznetsoffandrey/sberquad
|
| 16 |
+
- unicamp-dl/mmarco
|
| 17 |
+
- cointegrated/ru-paraphrase-NMT-Leipzig
|
| 18 |
+
- cointegrated/nli-rus-translated-v2021
|
| 19 |
+
- nyuuzyou/wb-feedbacks
|
| 20 |
+
- IlyaGusev/pikabu
|
| 21 |
+
- deepvk/cultura_ru_edu
|
| 22 |
+
- data-silence/lenta.ru_2-extended
|
| 23 |
+
- data-silence/xlsum-russian-bbc
|
| 24 |
+
- ScoutieAutoML/russian-news-telegram-dataset
|
| 25 |
+
- RussianNLP/wikiomnia
|
| 26 |
+
- its5Q/yandex-q
|
| 27 |
+
- ai-forever/cedr-classification
|
| 28 |
+
- ai-forever/sensitive-topics-classification
|
| 29 |
+
- mlsa-iai-msu-lab/ru_sci_bench_mteb
|
| 30 |
+
- ai-forever/ru-scibench-grnti-classification
|
| 31 |
+
- ai-forever/ru-scibench-oecd-classification
|
| 32 |
+
- ai-forever/ru-stsbenchmark-sts
|
| 33 |
+
- ai-forever/terra-pairclassification
|
| 34 |
+
- mteb/georeview
|
| 35 |
+
- mteb/headline
|
| 36 |
+
- mteb/inappropriateness
|
| 37 |
+
- mteb/ru_reviews
|
| 38 |
+
- ai-forever/kinopoisk-sentiment-classification
|
| 39 |
+
---
|
| 40 |
+
|
| 41 |
+
# Komugi Embeddings
|
| 42 |
+
|
| 43 |
+
Компактный русскоязычный энкодер для поиска и сравнения текстов. Три слоя BERT, 312 измерений, до 512 токенов с учётом префикса. Модель усредняет представления токенов с маской и L2-нормализует результат. В опубликованной конфигурации предусмотрены отдельные префиксы для запроса и документа.
|
| 44 |
+
|
| 45 |
+
## Использование
|
| 46 |
+
|
| 47 |
+
```python
|
| 48 |
+
from sentence_transformers import SentenceTransformer
|
| 49 |
+
|
| 50 |
+
model = SentenceTransformer("IIIaHTu/komugi_embeddings")
|
| 51 |
+
queries = model.encode_query(["Как настроить резервное копирование?"])
|
| 52 |
+
documents = model.encode_document([
|
| 53 |
+
"Инструкция по настройке резервного копирования.",
|
| 54 |
+
"Прогноз погоды на выходные.",
|
| 55 |
+
])
|
| 56 |
+
print(model.similarity(queries, documents))
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
Для обычного `encode()` применяется префикс `categorize`. Для парафразов можно передать `prompt_name="paraphrase"`.
|
| 60 |
+
|
| 61 |
+
## Обучение
|
| 62 |
+
|
| 63 |
+
Модель инициализирована весами [RuBERT-tiny2](https://huggingface.co/cointegrated/rubert-tiny2). Учителем эмбеддингов была [FRIDA](https://huggingface.co/ai-forever/FRIDA). Для дистилляции использовались фрагменты Википедии, веб-тексты, новости, отзывы, обсуждения, пары вопросов и ответов, парафразы и NLI.
|
| 64 |
+
|
| 65 |
+
При дистилляции использовались тексты из train-частей CEDR, Sensitive Topics, RuSciBench, RuSTSBenchmark и TERRa. Для Georeview, Headline, Inappropriateness, RuReviews и Kinopoisk использовались тексты из train и validation. Метки этих задач не использовались как цели обучения. По исходному набору из 17 задач выполнялась фильтрация текстовых совпадений с оценочными сплитами.
|
| 66 |
+
|
| 67 |
+
## Оценка
|
| 68 |
+
|
| 69 |
+
Локальная оценка на всех 23 задачах MTEB(rus, v1.1) с MTEB 2.27.18. Все значения в таблицах приведены по шкале от 0 до 100.
|
| 70 |
+
|
| 71 |
+
| Model | Mean (Task) | Mean (TaskType) |
|
| 72 |
+
|---|---:|---:|
|
| 73 |
+
| sergeyzh/rubert-mini-frida | 63.02 | 61.67 |
|
| 74 |
+
| IIIaHTu/komugi_embeddings | 62.97 | 61.25 |
|
| 75 |
+
| deepvk/USER-bge-m3 | 62.61 | 62.04 |
|
| 76 |
+
| deepvk/USER2-small | 57.30 | 55.05 |
|
| 77 |
+
| sergeyzh/rubert-tiny-turbo | 53.56 | 52.42 |
|
| 78 |
+
| cointegrated/rubert-tiny2 | 42.53 | 39.50 |
|
| 79 |
+
|
| 80 |
+
| Задача | Балл |
|
| 81 |
+
|---|---:|
|
| 82 |
+
| GeoreviewClassification | 49.00 |
|
| 83 |
+
| HeadlineClassification | 87.71 |
|
| 84 |
+
| InappropriatenessClassification | 69.10 |
|
| 85 |
+
| KinopoiskClassification | 60.35 |
|
| 86 |
+
| MassiveIntentClassification | 64.75 |
|
| 87 |
+
| MassiveScenarioClassification | 71.78 |
|
| 88 |
+
| RuReviewsClassification | 70.76 |
|
| 89 |
+
| RuSciBenchGRNTIClassification | 62.87 |
|
| 90 |
+
| RuSciBenchOECDClassification | 48.48 |
|
| 91 |
+
| GeoreviewClusteringP2P | 66.57 |
|
| 92 |
+
| RuSciBenchGRNTIClusteringP2P | 61.93 |
|
| 93 |
+
| RuSciBenchOECDClusteringP2P | 52.42 |
|
| 94 |
+
| CEDRClassification | 53.25 |
|
| 95 |
+
| SensitiveTopicsClassification | 35.64 |
|
| 96 |
+
| TERRa | 58.77 |
|
| 97 |
+
| MIRACLReranking | 59.98 |
|
| 98 |
+
| RuBQReranking | 71.32 |
|
| 99 |
+
| MIRACLRetrievalHardNegatives.v2 | 57.99 |
|
| 100 |
+
| RiaNewsRetrievalHardNegatives.v2 | 69.70 |
|
| 101 |
+
| RuBQRetrieval | 63.89 |
|
| 102 |
+
| RUParaPhraserSTS | 74.13 |
|
| 103 |
+
| STS22 | 59.44 |
|
| 104 |
+
| RuSTSBenchmarkSTS | 78.55 |
|
| 105 |
+
|
| 106 |
+
## Лицензия
|
| 107 |
+
|
| 108 |
+
Вклад Komugi распространяется под [MIT](LICENSE). Происхождение весов описано в [NOTICE](NOTICE).
|
config.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_cross_attention": false,
|
| 3 |
+
"architectures": [
|
| 4 |
+
"BertModel"
|
| 5 |
+
],
|
| 6 |
+
"attention_probs_dropout_prob": 0.1,
|
| 7 |
+
"bos_token_id": null,
|
| 8 |
+
"classifier_dropout": null,
|
| 9 |
+
"dtype": "float32",
|
| 10 |
+
"emb_size": 312,
|
| 11 |
+
"eos_token_id": null,
|
| 12 |
+
"gradient_checkpointing": false,
|
| 13 |
+
"hidden_act": "gelu",
|
| 14 |
+
"hidden_dropout_prob": 0.1,
|
| 15 |
+
"hidden_size": 312,
|
| 16 |
+
"initializer_range": 0.02,
|
| 17 |
+
"intermediate_size": 600,
|
| 18 |
+
"is_decoder": false,
|
| 19 |
+
"layer_norm_eps": 1e-12,
|
| 20 |
+
"max_position_embeddings": 2048,
|
| 21 |
+
"model_type": "bert",
|
| 22 |
+
"num_attention_heads": 12,
|
| 23 |
+
"num_hidden_layers": 3,
|
| 24 |
+
"pad_token_id": 0,
|
| 25 |
+
"position_embedding_type": "absolute",
|
| 26 |
+
"tie_word_embeddings": true,
|
| 27 |
+
"transformers_version": "5.2.0",
|
| 28 |
+
"type_vocab_size": 2,
|
| 29 |
+
"use_cache": true,
|
| 30 |
+
"vocab_size": 83828
|
| 31 |
+
}
|
config_sentence_transformers.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_type": "SentenceTransformer",
|
| 3 |
+
"__version__": {
|
| 4 |
+
"sentence_transformers": "5.2.3",
|
| 5 |
+
"transformers": "5.2.0",
|
| 6 |
+
"pytorch": "2.10.0+cu130"
|
| 7 |
+
},
|
| 8 |
+
"prompts": {
|
| 9 |
+
"query": "search_query: ",
|
| 10 |
+
"document": "search_document: ",
|
| 11 |
+
"search_query": "search_query: ",
|
| 12 |
+
"search_document": "search_document: ",
|
| 13 |
+
"paraphrase": "paraphrase: ",
|
| 14 |
+
"categorize": "categorize: ",
|
| 15 |
+
"categorize_sentiment": "categorize_sentiment: ",
|
| 16 |
+
"categorize_topic": "categorize_topic: ",
|
| 17 |
+
"categorize_entailment": "categorize_entailment: ",
|
| 18 |
+
"Classification": "categorize: ",
|
| 19 |
+
"MultilabelClassification": "categorize: ",
|
| 20 |
+
"Clustering": "categorize_topic: ",
|
| 21 |
+
"PairClassification": "paraphrase: ",
|
| 22 |
+
"Reranking": "paraphrase: ",
|
| 23 |
+
"Reranking-query": "search_query: ",
|
| 24 |
+
"Reranking-document": "search_document: ",
|
| 25 |
+
"STS": "search_query: ",
|
| 26 |
+
"Summarization": "categorize: ",
|
| 27 |
+
"CEDRClassification": "categorize_sentiment: ",
|
| 28 |
+
"GeoreviewClassification": "categorize_sentiment: ",
|
| 29 |
+
"GeoreviewClassification.v2": "categorize_sentiment: ",
|
| 30 |
+
"HeadlineClassification": "categorize_topic: ",
|
| 31 |
+
"HeadlineClassification.v2": "categorize_topic: ",
|
| 32 |
+
"InappropriatenessClassification": "categorize_topic: ",
|
| 33 |
+
"InappropriatenessClassification.v2": "categorize_topic: ",
|
| 34 |
+
"KinopoiskClassification": "categorize_sentiment: ",
|
| 35 |
+
"RuReviewsClassification": "categorize_sentiment: ",
|
| 36 |
+
"RuReviewsClassification.v2": "categorize_sentiment: ",
|
| 37 |
+
"RuSciBenchGRNTIClassification": "categorize_topic: ",
|
| 38 |
+
"RuSciBenchGRNTIClassification.v2": "categorize_topic: ",
|
| 39 |
+
"RuSciBenchOECDClassification": "categorize_topic: ",
|
| 40 |
+
"RuSciBenchOECDClassification.v2": "categorize_topic: ",
|
| 41 |
+
"SensitiveTopicsClassification": "categorize_topic: ",
|
| 42 |
+
"TERRa": "categorize_entailment: ",
|
| 43 |
+
"RiaNewsRetrieval": "categorize: "
|
| 44 |
+
},
|
| 45 |
+
"default_prompt_name": "categorize",
|
| 46 |
+
"similarity_fn_name": "cosine"
|
| 47 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b5089e8a7013b0214b5220f716874f89fc5083e0a844c9b8e39c3f88449d67b2
|
| 3 |
+
size 116781176
|
modules.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"idx": 0,
|
| 4 |
+
"name": "0",
|
| 5 |
+
"path": "",
|
| 6 |
+
"type": "sentence_transformers.models.Transformer"
|
| 7 |
+
},
|
| 8 |
+
{
|
| 9 |
+
"idx": 1,
|
| 10 |
+
"name": "1",
|
| 11 |
+
"path": "1_Pooling",
|
| 12 |
+
"type": "sentence_transformers.models.Pooling"
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"idx": 2,
|
| 16 |
+
"name": "2",
|
| 17 |
+
"path": "2_Normalize",
|
| 18 |
+
"type": "sentence_transformers.models.Normalize"
|
| 19 |
+
}
|
| 20 |
+
]
|
sentence_bert_config.json
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"max_seq_length": 512,
|
| 3 |
+
"do_lower_case": false
|
| 4 |
+
}
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"backend": "tokenizers",
|
| 3 |
+
"cls_token": "[CLS]",
|
| 4 |
+
"do_basic_tokenize": true,
|
| 5 |
+
"do_lower_case": false,
|
| 6 |
+
"is_local": true,
|
| 7 |
+
"mask_token": "[MASK]",
|
| 8 |
+
"model_max_length": 512,
|
| 9 |
+
"never_split": null,
|
| 10 |
+
"pad_token": "[PAD]",
|
| 11 |
+
"sep_token": "[SEP]",
|
| 12 |
+
"strip_accents": null,
|
| 13 |
+
"tokenize_chinese_chars": true,
|
| 14 |
+
"tokenizer_class": "BertTokenizer",
|
| 15 |
+
"unk_token": "[UNK]"
|
| 16 |
+
}
|