SSE

🩵 SSE: Stable Static Embedding for Retrieval MRL Bilingual quantized version (English & Japanese) 🩵

A lightweight, faster and powerful embedding model

🩵 SSE: Stable Static Embedding for Retrieval MRL バイリンガル・量子化バージョン(英語&日本語) 🩵

軽量、高速かつ強力な埋め込みモデル

Performance Snapshot
Our SSE model achieves NDCG@10 = 0.5049 on NanoBEIR EN and NDCG@10 = 0.4493 on NanoBEIR JA — slightly outperforming the popular language-specific static-retrieval-mrl-en-v1 (0.5032) and static-embedding-japanese (0.4487) while using half the dimensions (512 vs 1024)! 💫 Plus, we're ~2× faster in retrieval thanks to our compact 512D embeddings and Separable Dynamic Tanh.

This model outperforms related models known for their light weight, while using 5.3x smaller data size.

The weight data size is just under 26MB!

パフォーマンスの簡易解説
このモデルは NanoBEIR_en(英語文書検索タスク)において、NDCG@10 = 0.5049を達成し、かつ、NanoBEIR_ja(日本語文書検索タスク) において NDCG@10 = 0.4493 を達成しました。 このスコアは他の言語特化の静的埋め込みモデル( static-retrieval-mrl-en-v1 (0.5032)、static-embedding-japanese (0.4487)など )を上回るパフォーマンスです。 さらに、次元数を半分(512 vs 1024)に抑えています。 次元数の削減と、Separable Dynamic Tanh により、環境によっては検索速度は 約2倍高速 になっています。

このモデルは、RikkaBotan/stable-static-embedding-fast-retrieval-mrl-bilingual-ja-enの重みを量子化することで、他の静的埋め込みモデルよりも5.3倍小さいデータサイズになっています。

重みのデータサイズは、たったの26MB以下です。

Model NanoBEIR EN NDCG@10 NanoBEIR JA NDCG@10 Dimensions Parameters Datasize Speed Advantage License
Quantized SSE Retrieval MRL Bilingual 0.5049 0.4493 512 ~50M 🪽 ~25MB 🪽 ~2x faster retrieval (ultra-efficient!) Apache 2.0
SSE Retrieval MRL Bilingual 0.5073 0.4511 512 ~50M ~198MB ~2x faster retrieval (ultra-efficient!) Apache 2.0
static-retrieval-mrl-en-v1 0.5032 - 1024 ~33M ~133MB baseline Apache 2.0
static-embedding-japanese - 0.4487 1024 ~34M ~134MB baseline MIT

🩵 Why Choose SSE Retrieval MRL? 🩵

Higher NDCG@10 than other static embedding models in both Japanese and English

Only ~50M parameters

512D native output — richer than 1024D models, yet half the size of static-retrieval-mrl-en-v1 and static-embedding-japanese

Matryoshka-ready — smoothly truncate to 256D/128D/64D/32D with graceful degradation

Apache 2.0 licensed — free for commercial & personal use

CPU-optimized — runs faster on edge devices & modest hardware

🩵 SSE Retrieval MRL を選ぶ理由 🩵

日本語・英語の両言語で他の静的埋め込みモデルを超える高い性能(NDCG@10)

約50M のパラメータのみ

次元数512の出力 — 次元数1024のモデルよりも豊かな表現力を持ち、static-retrieval-mrl-en-v1static-embedding-japanese半分のサイズ

Matryoshka 対応 — 256/128/64/32 に簡単に切り替えられ、性能の緩やかな低下を実現

Apache 2.0 ライセンス — 商用・個人利用ともに可能

CPU 最適化 — エッジデバイスや限られたハードウェアでも高速に動作


🩵 Model Details 🩵

Property Value
Model Type Sentence Transformer (SSE architecture)
Max Sequence Length ∞ tokens
Output Dimension 512 (with Matryoshka truncation down to 32D!)
Similarity Function Cosine Similarity
Language English & Japanese
License Apache 2.0

🩵 モデル詳細 🩵

プロパティ
モデルタイプ Sentence Transformer (SSE アーキテクチャ)
最大シーケンス長 無制限
出力次元 512 (Matryoshka により 次元数32 まで削減可能!)
類似度関数 コサイン類似度
言語 英語&日本語
ライセンス Apache 2.0

I used below tokenizer.

tokenizerは下記を使用させていただきました。

llm-jp/hf-fast-tokenizer-v22b2

SentenceTransformer(
  (0): SSE(
    (embedding): EmbeddingBag(96867, 512, mode='mean')
    (dyt): SeparableDyT()
  )
)

Architecture


🩵 Mathematical formulations 🩵

Dynamic Tanh Normalization (DyT) enables magnitude-adaptive gradient flow for static embeddings. For input dimension x, DyT computes yk=cktanh(akxk+bk) y_k = c_k \tanh(a_k x_k + b_k) with learnable parameters. The gradient of x is:

ykxk=ckaksech2(akxk+bk). \frac{\partial y_k}{\partial x_k} = c_k a_k \, \mathrm{sech}^2(a_k x_k + b_k).

For saturated dimensions |x| > 1 aixi+bi1 |a_i x_i + b_i| \gg 1 yields exponential decay sech2(z)4e2z \mathrm{sech}^2(z) \sim 4e^{-2|z|} suppressing gradients as yi/xi0 \partial y_i / \partial x_i \to 0 For non-saturated dimensions |x| << 1 , sech2(z)1 \mathrm{sech}^2(z) \approx 1 preserves near-constant gradients yj/xjcjaj \partial y_j / \partial x_j \approx c_j a_j This magnitude-dependent gating attenuates learning signals from noisy, large-magnitude dimensions while maintaining full gradient flow for stable, informative dimensions—providing implicit regularization that enhances generalization without explicit hyperparameters.

🩵 数学的背景 🩵

このモデルは静的埋め込みモデルの汎化性能を向上させるために、オリジナルのアーキテクチャである、SSE: Stable Static Embeddingを採用しています。 SSEは、EmbeddingBagとSeparable Tanh Normalizationから構成されます。 Dynamic Tanh Normalization (DyT) は、静的埋め込みにおいて、強度適応型勾配流を可能にします。入力次元 x に対して、DyT は以下のように計算されます。

yk=cktanh(akxk+bk) y_k = c_k \tanh(a_k x_k + b_k)

ここで、a, b, c は学習可能なパラメータです。 すると、x の勾配は以下の通りになります。

ykxk=ckaksech2(akxk+bk). \frac{\partial y_k}{\partial x_k} = c_k a_k \, \mathrm{sech}^2(a_k x_k + b_k).

飽和した次元 |x| > 1 の場合

aixi+bi1 |a_i x_i + b_i| \gg 1

は指数関数的な減衰をもたらします。

sech2(z)4e2z \mathrm{sech}^2(z) \sim 4e^{-2|z|}

これにより勾配が抑制され、

yi/xi0 \partial y_i / \partial x_i \to 0

となります。

対して、非飽和の次元 |x| << 1 の場合、

sech2(z)1 \mathrm{sech}^2(z) \approx 1

ほぼ一定の勾配を維持します。

yj/xjcjaj \partial y_j / \partial x_j \approx c_j a_j

この強度依存型のゲートは、ノイズが多く大きな成分を持つ次元からの学習信号を減衰させつつ、安定した情報を有する次元については勾配流を維持します。これは明示的なハイパーパラメータなしで、表現空間の汎化性能を高める暗黙的な正則化を可能にします。


🩵 Evaluation Results (NanoBEIR English) / 評価結果(NanoBEIR 英語) 🩵

Dataset NDCG@10 MRR@10 MAP@100
NanoBEIR Mean 0.5049 0.5526 0.4197
NanoClimateFEVER 0.3166 0.3874 0.2511
NanoDBPedia 0.5604 0.7321 0.4244
NanoFEVER 0.6511 0.5871 0.5595
NanoFiQA2018 0.3179 0.3541 0.2617
NanoHotpotQA 0.6840 0.7459 0.6191
NanoMSMARCO 0.4417 0.3616 0.3748
NanoNFCorpus 0.2939 0.4535 0.1202
NanoNQ 0.4952 0.4287 0.4251
NanoQuoraRetrieval 0.8528 0.8533 0.8190
NanoSCIDOCS 0.3335 0.5460 0.2551
NanoArguAna 0.3978 0.3202 0.3326
NanoSciFact 0.6076 0.5842 0.5733
NanoTouche2020 0.6105 0.8298 0.4406

🩵 Evaluation Results (NanoBEIR Japanese) / 評価結果(NanoBEIR 日本語) 🩵

Dataset NDCG@10 MRR@10 MAP@100
NanoBEIR Mean 0.4493 0.5083 0.3744
NanoClimateFEVER 0.2883 0.3860 0.2218
NanoDBPedia 0.5458 0.7632 0.4048
NanoFEVER 0.4956 0.4403 0.4421
NanoFiQA2018 0.3224 0.3667 0.2640
NanoHotpotQA 0.4866 0.5444 0.4117
NanoMSMARCO 0.4578 0.4085 0.4226
NanoNFCorpus 0.2731 0.4844 0.1138
NanoNQ 0.3944 0.3406 0.3436
NanoQuoraRetrieval 0.8003 0.8179 0.7766
NanoSCIDOCS 0.3156 0.5133 0.2325
NanoArguAna 0.3635 0.2758 0.2871
NanoSciFact 0.6341 0.6020 0.5903
NanoTouche2020 0.4628 0.6646 0.3566

🩵 How to use? / 使い方 🩵

import torch
from sentence_transformers import SentenceTransformer

# load (remote code enabled)
model = SentenceTransformer(
    "RikkaBotan/quantized-stable-static-embedding-fast-retrieval-mrl-bilingual-ja-en",
    trust_remote_code=True,
    device="cuda" if torch.cuda.is_available() else "cpu",
)

# inference
sentences = [
    "Stable Static embedding is interesting.",
    "SSE works without attention."
]

with torch.no_grad():
    embeddings = model.encode(
        sentences,
        convert_to_tensor=True,
        normalize_embeddings=True,
        batch_size=32
    )

# cosine similarity
# cosine_sim = embeddings[0] @ embeddings[1].T
cosine_sim = model.similarity(embeddings, embeddings)

print("embeddings shape:", embeddings.shape)
print("cosine similarity matrix:")
print(cosine_sim)

🩵 Retrieval usage / 検索用使用例 🩵

import torch
from sentence_transformers import SentenceTransformer

# load (remote code enabled)
model = SentenceTransformer(
    "RikkaBotan/quantized-stable-static-embedding-fast-retrieval-mrl-bilingual-ja-en",
    trust_remote_code=True,
    device="cuda" if torch.cuda.is_available() else "cpu",
)

# inference
query = "What is Stable Static Embedding?"
sentences = [
    "SSE: Stable Static embedding works without attention.",
    "Stable Static Embedding is a fast embedding method designed for retrieval tasks.",
    "Static embeddings are often compared with transformer-based sentence encoders.",
    "I cooked pasta last night while listening to jazz music.",
    "Large language models are commonly trained using next-token prediction objectives.",
    "Instruction tuning improves the ability of LLMs to follow human-written prompts.",
]


with torch.no_grad():
    embeddings = model.encode(
        [query] + sentences,
        convert_to_tensor=True,
        normalize_embeddings=True,
        batch_size=32
    )

print("embeddings shape:", embeddings.shape)

# cosine similarity
similarities = model.similarity(embeddings[0], embeddings[1:])
for i, similarity in enumerate(similarities[0].tolist()):
    print(f"{similarity:.05f}: {sentences[i]}")

🩵 Training Hyperparameters / 学習時のハイパーパラメータ 🩵

Non-Default Hyperparameters / デフォルトと異なる設定

Stage 1

  • eval_strategy: steps
  • per_device_train_batch_size: 1536
  • gradient_accumulation_steps: 10
  • learning_rate: 0.1
  • adam_epsilon: 1e-10
  • num_train_epochs: 2
  • lr_scheduler_type: cosine
  • warmup_ratio: 0.01
  • bf16: True
  • dataloader_num_workers: 4
  • batch_sampler: no_duplicates

Stage 2

  • eval_strategy: steps
  • per_device_train_batch_size: 3072
  • gradient_accumulation_steps: 6
  • learning_rate: 0.03
  • adam_epsilon: 1e-10
  • num_train_epochs: 1
  • lr_scheduler_type: cosine
  • bf16: True
  • dataloader_num_workers: 4
  • batch_sampler: no_duplicates

🩵 Training Datasets / 学習データセット 🩵

We learned from 29 datasets.

下記の29個のデータセットを使用しました。

Dataset
squad
trivia_qa
allnli
pubmedqa
hotpotqa
miracl
mr_tydi
msmarco
msmarco_10m
msmarco_hard
mldr
s2orc
swim_ir
paq
nq
scidocs
hpprc_emb__auto-wiki-nli-triplet
hpprc_emb__jqara
hpprc_emb__jagovfaqs
hpprc_emb__jsquad
hpprc_emb__jaquad
hpprc_emb__mkqa-triplet
hpprc_llmjp-kaken
hpprc_msmarco_ja
hpprc_emb__auto-wiki-qa-nemotron
mldr_ja
mrtydi_ja
miracl_ja
mmarco_ja
mmarco_ja_hard
hpprc_wiki

All trained with MatryoshkaLoss — learning representations at multiple scales like Russian nesting dolls!

MatryoshkaLossを用いて学習を行っています。

🩵 Training results / 学習結果 🩵

Stage 1 (Pre-training / 事前学習)

Training loss

loss1

NanoBEIR_ja NDCG@10

ndcg1

Stage 2 (Fine-tuning / 微調整)

Training loss

loss2

NanoBEIR_ja NDCG@10

ndcg2

🩵 About me / 作成者:六花牡丹(りっかぼたん) 🩵

Japanese independent researcher having shy and pampered personality. Twin-tail hair is a charm point. Interested in nlp. Usually using python and C.

おっとりで甘えん坊な研究者見習い。 言語モデルに関するものが主な研究分野です。 お仕事のご依頼・登壇依頼・執筆依頼に関しては、下記までご連絡ください。

X(Twitter): https://twitter.com/peony__snow

Logo

🩵 Acknowledgements / 謝辞 🩵

The author acknowledge the support of Saldra, Witness and Lumina Logic Minds for providing computational resources used in this work.

I thank the developers of sentence-transformers, python and pytorch.

I thank all the researchers for their efforts to date.

I thank Japan's high standard of education.

And most of all, thank you for your interest in this repository.

このモデルの学習のための計算リソースの一部は、Saldraさん、Witnessさん、Lumina Logic Minds社から提供いただきました。貴重なサポートに感謝いたします。

sentence-transformers、python、pytorchを使用させていただきました。 作成・メンテンナンスしてくださっている皆様に感謝いたします。

何よりも、このモデルにご興味を持ってくださりありがとうございます。

🩵 Citation / 引用 🩵

BibTeX

Sentence Transformers

@inproceedings{reimers-2019-sentence-bert,
    title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
    author = "Reimers, Nils and Gurevych, Iryna",
    booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
    month = "11",
    year = "2019",
    publisher = "Association for Computational Linguistics",
    url = "https://arxiv.org/abs/1908.10084",
}

MatryoshkaLoss

@misc{kusupati2024matryoshka,
    title={Matryoshka Representation Learning},
    author={Aditya Kusupati and Gantavya Bhatt and Aniket Rege and Matthew Wallingford and Aditya Sinha and Vivek Ramanujan and William Howard-Snyder and Kaifeng Chen and Sham Kakade and Prateek Jain and Ali Farhadi},
    year={2024},
    eprint={2205.13147},
    archivePrefix={arXiv},
    primaryClass={cs.LG}
}

MultipleNegativesRankingLoss

@misc{henderson2017efficient,
    title={Efficient Natural Language Response Suggestion for Smart Reply},
    author={Matthew Henderson and Rami Al-Rfou and Brian Strope and Yun-hsuan Sung and Laszlo Lukacs and Ruiqi Guo and Sanjiv Kumar and Balint Miklos and Ray Kurzweil},
    year={2017},
    eprint={1705.00652},
    archivePrefix={arXiv},
    primaryClass={cs.CL}
}
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Datasets used to train RikkaBotan/quantized-stable-static-embedding-fast-retrieval-mrl-bilingual-ja-en

Collection including RikkaBotan/quantized-stable-static-embedding-fast-retrieval-mrl-bilingual-ja-en

Papers for RikkaBotan/quantized-stable-static-embedding-fast-retrieval-mrl-bilingual-ja-en

Evaluation results