Downloads · 30 days
62
20% of all-time downloads
jhgan/ko-sroberta-sts-mrl
ko-sroberta-sts-mrl is a sentence similarity model from jhgan. Use it when you need a score for how close two texts are. It is set up for sentence-transformers. The card lists the license as cc-by-sa-4.0.
This is a sentence-transformers model fine-tuned with Matryoshka Representation Learning (MRL) on top of klue/roberta-base. The model produces 768-dim embeddings, but the first m dims for m ∈ {768, 512, 256, 128, 64,…
Downloads · 30 days
62
20% of all-time downloads
All-time downloads
311
Public
Parameters
111M
442 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors442 MB · 100%
From the Hugging Face model README
This is a sentence-transformers model fine-tuned with
Matryoshka Representation Learning (MRL)
on top of klue/roberta-base. The model produces 768-dim embeddings, but the first
m dims for m ∈ {768, 512, 256, 128, 64, 32} are themselves valid
sentence representations — you can slice the embedding to trade accuracy for
storage/latency without retraining.
All values are reported as percentages (×100).
| dim | cosine_pearson | cosine_spearman | euclidean_pearson | euclidean_spearman | manhattan_pearson | manhattan_spearman | dot_pearson | dot_spearman |
|---|---|---|---|---|---|---|---|---|
| 768 | 82.02 | 81.84 | 81.42 | 81.44 | 81.38 | 81.40 | 78.66 | 77.88 |
| 512 | 81.79 | 81.68 | 81.48 | 81.46 | 81.47 | 81.46 | 78.07 | 77.26 |
| 256 | 81.44 | 81.44 | 81.29 | 81.28 | 81.19 | 81.19 | 76.77 | 76.13 |
| 128 | 80.43 | 80.72 | 80.82 | 80.85 | 80.63 | 80.71 | 73.76 | 73.35 |
| 64 | 78.55 | 79.37 | 79.54 | 79.68 | 79.13 | 79.38 | 69.65 | 69.37 |
| 32 | 75.81 | 77.50 | 77.02 | 77.41 | 76.30 | 76.91 | 64.91 | 64.81 |
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("jhgan/ko-sroberta-sts-mrl")
embeddings = model.encode(["안녕하세요", "반갑습니다"])
print(embeddings.shape) # (2, 768)
import torch.nn.functional as F
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("jhgan/ko-sroberta-sts-mrl")
emb = model.encode(["안녕하세요", "반갑습니다"], convert_to_tensor=True)
# Slice to the first 64 dims and re-normalise for cosine similarity
emb_64 = F.normalize(emb[:, :64], p=2, dim=1)
Or fix the truncation at load time
(requires sentence-transformers >= 2.7.0):
model = SentenceTransformer("jhgan/ko-sroberta-sts-mrl", truncate_dim=64)
@inproceedings{kusupati2022matryoshka,
title = {Matryoshka Representation Learning},
author = {Kusupati, Aditya and Bhatt, Gantavya and Rege, Aniket and
Wallingford, Matthew and Sinha, Aditya and Ramanujan, Vivek and
Howard-Snyder, William and Chen, Kaifeng and Kakade, Sham and
Jain, Prateek and Farhadi, Ali},
booktitle = {Advances in Neural Information Processing Systems},
year = {2022},
url = {https://arxiv.org/abs/2205.13147}
}
This model is part of the
ko-sentence-transformers
project; see the repository for training scripts and the non-MRL baselines
(jhgan/ko-sroberta-sts, jhgan/ko-sroberta-nli, jhgan/ko-sroberta-multitask).