Instructions to use BorisTM/loss-guided-static-multi with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use BorisTM/loss-guided-static-multi with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("BorisTM/loss-guided-static-multi") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Notebooks
- Google Colab
- Kaggle
Model card
Browse files
README.md
CHANGED
|
@@ -2,101 +2,86 @@
|
|
| 2 |
license: apache-2.0
|
| 3 |
library_name: sentence-transformers
|
| 4 |
pipeline_tag: sentence-similarity
|
|
|
|
|
|
|
| 5 |
tags:
|
| 6 |
- sentence-transformers
|
| 7 |
-
- sentence-
|
| 8 |
-
- multilingual
|
| 9 |
- static-embeddings
|
| 10 |
-
-
|
| 11 |
---
|
| 12 |
|
| 13 |
-
#
|
| 14 |
|
| 15 |
-
|
| 16 |
-
StaRSE checkpoint as of 2026-08-11; it is not a polished public release.
|
| 17 |
|
| 18 |
-
|
| 19 |
|
| 20 |
-
|
| 21 |
-
- Output dimension: 1,024.
|
| 22 |
-
- Base token rows: 257,914.
|
| 23 |
-
- Learned adjacent-pair rows: 56,071.
|
| 24 |
-
- Explicit language markers: 1,914.
|
| 25 |
-
- Training population: 176 languages.
|
| 26 |
-
- Training history: the registered 20,000-update Q42 model followed by a
|
| 27 |
-
separate 5,000-update branch with a fresh AdamW optimizer, inverse-square-root
|
| 28 |
-
schedule, 1,000 warmup updates, and peak learning rate 1e-4.
|
| 29 |
-
- Model tensor SHA-256:
|
| 30 |
-
`c28eaa242185aeccbd5ff643bb517b5a93d10b9d5a71c85dd03373ca4b2ad51a`.
|
| 31 |
|
| 32 |
-
|
| 33 |
-
text. Language IDs use ISO 639-3 plus ISO 15924 script, for example
|
| 34 |
-
`eng_Latn`, `rus_Cyrl`, and `arb_Arab`.
|
| 35 |
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
-
|
| 39 |
-
custom SentenceTransformers component. Loading executes that repository code,
|
| 40 |
-
so keep `trust_remote_code=True` only for a revision you have inspected and
|
| 41 |
-
pinned.
|
| 42 |
-
|
| 43 |
-
```python
|
| 44 |
-
from sentence_transformers import SentenceTransformer
|
| 45 |
|
| 46 |
-
|
| 47 |
-
"BorisTM/starse-multilingual-q42-25k",
|
| 48 |
-
trust_remote_code=True,
|
| 49 |
-
)
|
| 50 |
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
-
|
| 61 |
-
The marker must match one of the entries in `language_conditioning.json`.
|
| 62 |
|
| 63 |
-
##
|
| 64 |
|
| 65 |
-
|
| 66 |
-
MTEB 2.12.30 and zero failures:
|
| 67 |
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
On the frozen compact multilingual suite it scores:
|
| 72 |
|
| 73 |
-
|
| 74 |
-
- BUCC.v2, 4 subsets: 98.12;
|
| 75 |
-
- FloresBitextMining, 193 subsets: 63.70;
|
| 76 |
-
- unweighted three-task macro: 73.03.
|
| 77 |
|
| 78 |
-
|
| 79 |
-
exact file manifest under `provenance/`. These are results from one trained
|
| 80 |
-
checkpoint. No training noise floor was measured, so small differences must
|
| 81 |
-
not be interpreted as established effects.
|
| 82 |
|
| 83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
inference, or fully automated high-stakes decisions.
|
| 93 |
|
| 94 |
-
##
|
| 95 |
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
|
|
|
|
|
|
|
|
|
| 102 |
|
|
|
|
|
|
| 2 |
license: apache-2.0
|
| 3 |
library_name: sentence-transformers
|
| 4 |
pipeline_tag: sentence-similarity
|
| 5 |
+
language:
|
| 6 |
+
- multilingual
|
| 7 |
tags:
|
| 8 |
- sentence-transformers
|
| 9 |
+
- sentence-similarity
|
|
|
|
| 10 |
- static-embeddings
|
| 11 |
+
- multilingual
|
| 12 |
---
|
| 13 |
|
| 14 |
+
# Loss-Guided Static Multilingual Sentence Embeddings
|
| 15 |
|
| 16 |
+
## Overview
|
|
|
|
| 17 |
|
| 18 |
+
A static multilingual sentence encoder: one embedding table, mean pooling, no Transformer at inference. Its vocabulary was extended with **loss-guided vocabulary discovery**: during contrastive training, adjacent token pairs are scored by how much the sentence objective would suffer without them, and the useful pairs receive their own embedding rows. The base tokenizer stays unchanged. The model is trained on 176 languages and is intended for CPU-efficient semantic similarity, retrieval, clustering, and classification.
|
| 19 |
|
| 20 |
+
Paper: *Loss-Guided Vocabulary Discovery for Multilingual Static Encoders* (MRL Workshop @ EMNLP 2026). Code: [BlessedTatonka/loss-guided-vocab](https://github.com/BlessedTatonka/loss-guided-vocab).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
+
## Model Specifications
|
|
|
|
|
|
|
| 23 |
|
| 24 |
+
- **Embedding dimension**: 1,024
|
| 25 |
+
- **Base vocabulary**: 257,914 rows (mmBERT tokenizer + 1,914 language markers)
|
| 26 |
+
- **Learned pair rows**: 56,071
|
| 27 |
+
- **Parameters**: 321.7M (embedding table only), FP32 safetensors, 1.29 GB
|
| 28 |
+
- **Training languages**: 176
|
| 29 |
+
- **Inference**: table lookup and mean pooling; requires a language marker at the start of each text
|
| 30 |
|
| 31 |
+
## Performance
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
+
MTEB(Multilingual, v2), 131 tasks, primary score (Mean over tasks) **50.13**, Mean over task types 43.45:
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
+
| Task type | Count | Mean score |
|
| 36 |
+
|-----------|-------|-----------|
|
| 37 |
+
| Bitext mining | 13 | 53.90 |
|
| 38 |
+
| Classification | 43 | 52.87 |
|
| 39 |
+
| Clustering | 16 | 38.91 |
|
| 40 |
+
| Instruction reranking | 3 | -1.04 |
|
| 41 |
+
| Multilabel classification | 5 | 17.64 |
|
| 42 |
+
| Pair classification | 11 | 72.69 |
|
| 43 |
+
| Reranking | 6 | 49.42 |
|
| 44 |
+
| Retrieval | 18 | 41.64 |
|
| 45 |
+
| STS | 16 | 64.99 |
|
| 46 |
|
| 47 |
+
Cross-lingual retrieval (macro F1 over language pairs): Tatoeba 57.26 (106 pairs), BUCC 98.12 (4 pairs), Flores 63.70 (193 pairs).
|
|
|
|
| 48 |
|
| 49 |
+
## Installation & Usage
|
| 50 |
|
| 51 |
+
Every input must start with a language marker `__<iso639-3>_<script>__`, for example `__eng_Latn__`, `__rus_Cyrl__`, `__arb_Arab__`, `__cmn_Hani__`. A text without a marker raises an error. The repository ships the custom embedding module, so `trust_remote_code=True` is required.
|
|
|
|
| 52 |
|
| 53 |
+
```python
|
| 54 |
+
pip install -U sentence-transformers
|
|
|
|
|
|
|
| 55 |
|
| 56 |
+
from sentence_transformers import SentenceTransformer
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
+
model = SentenceTransformer("BorisTM/loss-guided-static-multi", trust_remote_code=True)
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
+
sentences = [
|
| 61 |
+
"__eng_Latn__ The cat sleeps on the sofa.",
|
| 62 |
+
"__rus_Cyrl__ Кошка спит на диване.",
|
| 63 |
+
"__deu_Latn__ Die Katze schläft auf dem Sofa.",
|
| 64 |
+
"__eng_Latn__ The stock market fell sharply today.",
|
| 65 |
+
]
|
| 66 |
|
| 67 |
+
embeddings = model.encode(sentences, normalize_embeddings=True)
|
| 68 |
+
similarities = model.similarity(embeddings, embeddings)
|
| 69 |
+
# [[1.00, 0.44, 0.80, 0.05],
|
| 70 |
+
# [0.44, 1.00, 0.41, 0.06],
|
| 71 |
+
# [0.80, 0.41, 1.00, 0.08],
|
| 72 |
+
# [0.05, 0.06, 0.08, 1.00]]
|
| 73 |
+
```
|
|
|
|
| 74 |
|
| 75 |
+
## Citation
|
| 76 |
|
| 77 |
+
```
|
| 78 |
+
@inproceedings{malashenko2026lossguided,
|
| 79 |
+
title = {Loss-Guided Vocabulary Discovery for Multilingual Static Encoders},
|
| 80 |
+
author = {Malashenko, Boris and Jarsky, Ivan and Stumpf, Sviatoslav A. and Efimova, Valeria},
|
| 81 |
+
booktitle = {Proceedings of the 6th Workshop on Multilingual Representation Learning (MRL)},
|
| 82 |
+
year = {2026},
|
| 83 |
+
url = {https://huggingface.co/BorisTM/loss-guided-static-multi}
|
| 84 |
+
}
|
| 85 |
+
```
|
| 86 |
|
| 87 |
+
**License**: Apache 2.0
|