--- language: - ja license: apache-2.0 tags: - sentence-transformers - sentence-similarity - feature-extraction - dense - generated_from_trainer - dataset_size:15098874 - loss:MatryoshkaLoss - loss:MultipleNegativesRankingLoss pipeline_tag: sentence-similarity library_name: sentence-transformers metrics: - cosine_accuracy@1 - cosine_accuracy@3 - cosine_accuracy@5 - cosine_accuracy@10 - cosine_precision@1 - cosine_precision@3 - cosine_precision@5 - cosine_precision@10 - cosine_recall@1 - cosine_recall@3 - cosine_recall@5 - cosine_recall@10 - cosine_ndcg@10 - cosine_mrr@10 - cosine_map@100 model-index: - name: SSE Retrieval MRL results: - task: type: information-retrieval name: Information Retrieval dataset: name: NanoClimateFEVER type: NanoClimateFEVER metrics: - type: cosine_accuracy@1 value: 0.28 name: Cosine Accuracy@1 - type: cosine_accuracy@3 value: 0.52 name: Cosine Accuracy@3 - type: cosine_accuracy@5 value: 0.6 name: Cosine Accuracy@5 - type: cosine_accuracy@10 value: 0.74 name: Cosine Accuracy@10 - type: cosine_precision@1 value: 0.28 name: Cosine Precision@1 - type: cosine_precision@3 value: 0.18 name: Cosine Precision@3 - type: cosine_precision@5 value: 0.136 name: Cosine Precision@5 - type: cosine_precision@10 value: 0.096 name: Cosine Precision@10 - type: cosine_recall@1 value: 0.13066666666666665 name: Cosine Recall@1 - type: cosine_recall@3 value: 0.25733333333333336 name: Cosine Recall@3 - type: cosine_recall@5 value: 0.2973333333333333 name: Cosine Recall@5 - type: cosine_recall@10 value: 0.38366666666666666 name: Cosine Recall@10 - type: cosine_ndcg@10 value: 0.315239142219681 name: Cosine Ndcg@10 - type: cosine_mrr@10 value: 0.4258253968253968 name: Cosine Mrr@10 - type: cosine_map@100 value: 0.24171717485554775 name: Cosine Map@100 - task: type: information-retrieval name: Information Retrieval dataset: name: NanoDBPedia type: NanoDBPedia metrics: - type: cosine_accuracy@1 value: 0.66 name: Cosine Accuracy@1 - type: cosine_accuracy@3 value: 0.9 name: Cosine Accuracy@3 - type: cosine_accuracy@5 value: 0.92 name: Cosine Accuracy@5 - type: cosine_accuracy@10 value: 0.98 name: Cosine Accuracy@10 - type: cosine_precision@1 value: 0.66 name: Cosine Precision@1 - type: cosine_precision@3 value: 0.5733333333333333 name: Cosine Precision@3 - type: cosine_precision@5 value: 0.512 name: Cosine Precision@5 - type: cosine_precision@10 value: 0.45400000000000007 name: Cosine Precision@10 - type: cosine_recall@1 value: 0.062372646217630855 name: Cosine Recall@1 - type: cosine_recall@3 value: 0.15961044468883442 name: Cosine Recall@3 - type: cosine_recall@5 value: 0.21324989206033798 name: Cosine Recall@5 - type: cosine_recall@10 value: 0.32058703022246654 name: Cosine Recall@10 - type: cosine_ndcg@10 value: 0.5554005089226384 name: Cosine Ndcg@10 - type: cosine_mrr@10 value: 0.7766666666666667 name: Cosine Mrr@10 - type: cosine_map@100 value: 0.3962063771112389 name: Cosine Map@100 - task: type: information-retrieval name: Information Retrieval dataset: name: NanoFEVER type: NanoFEVER metrics: - type: cosine_accuracy@1 value: 0.34 name: Cosine Accuracy@1 - type: cosine_accuracy@3 value: 0.62 name: Cosine Accuracy@3 - type: cosine_accuracy@5 value: 0.68 name: Cosine Accuracy@5 - type: cosine_accuracy@10 value: 0.82 name: Cosine Accuracy@10 - type: cosine_precision@1 value: 0.34 name: Cosine Precision@1 - type: cosine_precision@3 value: 0.20666666666666667 name: Cosine Precision@3 - type: cosine_precision@5 value: 0.14 name: Cosine Precision@5 - type: cosine_precision@10 value: 0.08599999999999998 name: Cosine Precision@10 - type: cosine_recall@1 value: 0.33 name: Cosine Recall@1 - type: cosine_recall@3 value: 0.5766666666666667 name: Cosine Recall@3 - type: cosine_recall@5 value: 0.6466666666666667 name: Cosine Recall@5 - type: cosine_recall@10 value: 0.7866666666666667 name: Cosine Recall@10 - type: cosine_ndcg@10 value: 0.5536005709283812 name: Cosine Ndcg@10 - type: cosine_mrr@10 value: 0.4906904761904762 name: Cosine Mrr@10 - type: cosine_map@100 value: 0.4827346984465628 name: Cosine Map@100 - task: type: information-retrieval name: Information Retrieval dataset: name: NanoFiQA2018 type: NanoFiQA2018 metrics: - type: cosine_accuracy@1 value: 0.26 name: Cosine Accuracy@1 - type: cosine_accuracy@3 value: 0.42 name: Cosine Accuracy@3 - type: cosine_accuracy@5 value: 0.5 name: Cosine Accuracy@5 - type: cosine_accuracy@10 value: 0.6 name: Cosine Accuracy@10 - type: cosine_precision@1 value: 0.26 name: Cosine Precision@1 - type: cosine_precision@3 value: 0.1733333333333333 name: Cosine Precision@3 - type: cosine_precision@5 value: 0.132 name: Cosine Precision@5 - type: cosine_precision@10 value: 0.084 name: Cosine Precision@10 - type: cosine_recall@1 value: 0.166 name: Cosine Recall@1 - type: cosine_recall@3 value: 0.27241269841269844 name: Cosine Recall@3 - type: cosine_recall@5 value: 0.3109126984126984 name: Cosine Recall@5 - type: cosine_recall@10 value: 0.3927460317460318 name: Cosine Recall@10 - type: cosine_ndcg@10 value: 0.3159688646820627 name: Cosine Ndcg@10 - type: cosine_mrr@10 value: 0.3614126984126984 name: Cosine Mrr@10 - type: cosine_map@100 value: 0.2652590177216684 name: Cosine Map@100 - task: type: information-retrieval name: Information Retrieval dataset: name: NanoHotpotQA type: NanoHotpotQA metrics: - type: cosine_accuracy@1 value: 0.5 name: Cosine Accuracy@1 - type: cosine_accuracy@3 value: 0.6 name: Cosine Accuracy@3 - type: cosine_accuracy@5 value: 0.66 name: Cosine Accuracy@5 - type: cosine_accuracy@10 value: 0.72 name: Cosine Accuracy@10 - type: cosine_precision@1 value: 0.5 name: Cosine Precision@1 - type: cosine_precision@3 value: 0.26 name: Cosine Precision@3 - type: cosine_precision@5 value: 0.17199999999999996 name: Cosine Precision@5 - type: cosine_precision@10 value: 0.106 name: Cosine Precision@10 - type: cosine_recall@1 value: 0.25 name: Cosine Recall@1 - type: cosine_recall@3 value: 0.39 name: Cosine Recall@3 - type: cosine_recall@5 value: 0.45 name: Cosine Recall@5 - type: cosine_recall@10 value: 0.53 name: Cosine Recall@10 - type: cosine_ndcg@10 value: 0.47218785006592484 name: Cosine Ndcg@10 - type: cosine_mrr@10 value: 0.5668571428571428 name: Cosine Mrr@10 - type: cosine_map@100 value: 0.4136104432738101 name: Cosine Map@100 - task: type: information-retrieval name: Information Retrieval dataset: name: NanoMSMARCO type: NanoMSMARCO metrics: - type: cosine_accuracy@1 value: 0.22 name: Cosine Accuracy@1 - type: cosine_accuracy@3 value: 0.36 name: Cosine Accuracy@3 - type: cosine_accuracy@5 value: 0.46 name: Cosine Accuracy@5 - type: cosine_accuracy@10 value: 0.62 name: Cosine Accuracy@10 - type: cosine_precision@1 value: 0.22 name: Cosine Precision@1 - type: cosine_precision@3 value: 0.11999999999999998 name: Cosine Precision@3 - type: cosine_precision@5 value: 0.09200000000000001 name: Cosine Precision@5 - type: cosine_precision@10 value: 0.062 name: Cosine Precision@10 - type: cosine_recall@1 value: 0.22 name: Cosine Recall@1 - type: cosine_recall@3 value: 0.36 name: Cosine Recall@3 - type: cosine_recall@5 value: 0.46 name: Cosine Recall@5 - type: cosine_recall@10 value: 0.62 name: Cosine Recall@10 - type: cosine_ndcg@10 value: 0.3929058282479137 name: Cosine Ndcg@10 - type: cosine_mrr@10 value: 0.3237460317460317 name: Cosine Mrr@10 - type: cosine_map@100 value: 0.3370722751024129 name: Cosine Map@100 - task: type: information-retrieval name: Information Retrieval dataset: name: NanoNFCorpus type: NanoNFCorpus metrics: - type: cosine_accuracy@1 value: 0.38 name: Cosine Accuracy@1 - type: cosine_accuracy@3 value: 0.54 name: Cosine Accuracy@3 - type: cosine_accuracy@5 value: 0.56 name: Cosine Accuracy@5 - type: cosine_accuracy@10 value: 0.62 name: Cosine Accuracy@10 - type: cosine_precision@1 value: 0.38 name: Cosine Precision@1 - type: cosine_precision@3 value: 0.32666666666666666 name: Cosine Precision@3 - type: cosine_precision@5 value: 0.26799999999999996 name: Cosine Precision@5 - type: cosine_precision@10 value: 0.212 name: Cosine Precision@10 - type: cosine_recall@1 value: 0.02222619182019458 name: Cosine Recall@1 - type: cosine_recall@3 value: 0.06501272200475505 name: Cosine Recall@3 - type: cosine_recall@5 value: 0.07442407618612941 name: Cosine Recall@5 - type: cosine_recall@10 value: 0.11211635987795447 name: Cosine Recall@10 - type: cosine_ndcg@10 value: 0.2685875123578928 name: Cosine Ndcg@10 - type: cosine_mrr@10 value: 0.4583809523809523 name: Cosine Mrr@10 - type: cosine_map@100 value: 0.09615320203286419 name: Cosine Map@100 - task: type: information-retrieval name: Information Retrieval dataset: name: NanoNQ type: NanoNQ metrics: - type: cosine_accuracy@1 value: 0.24 name: Cosine Accuracy@1 - type: cosine_accuracy@3 value: 0.38 name: Cosine Accuracy@3 - type: cosine_accuracy@5 value: 0.54 name: Cosine Accuracy@5 - type: cosine_accuracy@10 value: 0.68 name: Cosine Accuracy@10 - type: cosine_precision@1 value: 0.24 name: Cosine Precision@1 - type: cosine_precision@3 value: 0.12666666666666665 name: Cosine Precision@3 - type: cosine_precision@5 value: 0.10800000000000003 name: Cosine Precision@5 - type: cosine_precision@10 value: 0.07 name: Cosine Precision@10 - type: cosine_recall@1 value: 0.23 name: Cosine Recall@1 - type: cosine_recall@3 value: 0.35 name: Cosine Recall@3 - type: cosine_recall@5 value: 0.49 name: Cosine Recall@5 - type: cosine_recall@10 value: 0.64 name: Cosine Recall@10 - type: cosine_ndcg@10 value: 0.4170472509165694 name: Cosine Ndcg@10 - type: cosine_mrr@10 value: 0.36072222222222217 name: Cosine Mrr@10 - type: cosine_map@100 value: 0.35713637451149494 name: Cosine Map@100 - task: type: information-retrieval name: Information Retrieval dataset: name: NanoQuoraRetrieval type: NanoQuoraRetrieval metrics: - type: cosine_accuracy@1 value: 0.68 name: Cosine Accuracy@1 - type: cosine_accuracy@3 value: 0.88 name: Cosine Accuracy@3 - type: cosine_accuracy@5 value: 0.9 name: Cosine Accuracy@5 - type: cosine_accuracy@10 value: 0.9 name: Cosine Accuracy@10 - type: cosine_precision@1 value: 0.68 name: Cosine Precision@1 - type: cosine_precision@3 value: 0.3399999999999999 name: Cosine Precision@3 - type: cosine_precision@5 value: 0.21999999999999997 name: Cosine Precision@5 - type: cosine_precision@10 value: 0.11599999999999998 name: Cosine Precision@10 - type: cosine_recall@1 value: 0.5806666666666667 name: Cosine Recall@1 - type: cosine_recall@3 value: 0.8140000000000001 name: Cosine Recall@3 - type: cosine_recall@5 value: 0.8453333333333333 name: Cosine Recall@5 - type: cosine_recall@10 value: 0.866 name: Cosine Recall@10 - type: cosine_ndcg@10 value: 0.7767751179247507 name: Cosine Ndcg@10 - type: cosine_mrr@10 value: 0.775 name: Cosine Mrr@10 - type: cosine_map@100 value: 0.7393296869796869 name: Cosine Map@100 - task: type: information-retrieval name: Information Retrieval dataset: name: NanoSCIDOCS type: NanoSCIDOCS metrics: - type: cosine_accuracy@1 value: 0.36 name: Cosine Accuracy@1 - type: cosine_accuracy@3 value: 0.54 name: Cosine Accuracy@3 - type: cosine_accuracy@5 value: 0.68 name: Cosine Accuracy@5 - type: cosine_accuracy@10 value: 0.74 name: Cosine Accuracy@10 - type: cosine_precision@1 value: 0.36 name: Cosine Precision@1 - type: cosine_precision@3 value: 0.27333333333333326 name: Cosine Precision@3 - type: cosine_precision@5 value: 0.212 name: Cosine Precision@5 - type: cosine_precision@10 value: 0.146 name: Cosine Precision@10 - type: cosine_recall@1 value: 0.07466666666666667 name: Cosine Recall@1 - type: cosine_recall@3 value: 0.1696666666666667 name: Cosine Recall@3 - type: cosine_recall@5 value: 0.21866666666666668 name: Cosine Recall@5 - type: cosine_recall@10 value: 0.29866666666666664 name: Cosine Recall@10 - type: cosine_ndcg@10 value: 0.29386149023566654 name: Cosine Ndcg@10 - type: cosine_mrr@10 value: 0.47735714285714287 name: Cosine Mrr@10 - type: cosine_map@100 value: 0.21967260792096244 name: Cosine Map@100 - task: type: information-retrieval name: Information Retrieval dataset: name: NanoArguAna type: NanoArguAna metrics: - type: cosine_accuracy@1 value: 0.1 name: Cosine Accuracy@1 - type: cosine_accuracy@3 value: 0.38 name: Cosine Accuracy@3 - type: cosine_accuracy@5 value: 0.46 name: Cosine Accuracy@5 - type: cosine_accuracy@10 value: 0.62 name: Cosine Accuracy@10 - type: cosine_precision@1 value: 0.1 name: Cosine Precision@1 - type: cosine_precision@3 value: 0.12666666666666665 name: Cosine Precision@3 - type: cosine_precision@5 value: 0.09200000000000001 name: Cosine Precision@5 - type: cosine_precision@10 value: 0.06200000000000001 name: Cosine Precision@10 - type: cosine_recall@1 value: 0.1 name: Cosine Recall@1 - type: cosine_recall@3 value: 0.38 name: Cosine Recall@3 - type: cosine_recall@5 value: 0.46 name: Cosine Recall@5 - type: cosine_recall@10 value: 0.62 name: Cosine Recall@10 - type: cosine_ndcg@10 value: 0.34710546994468855 name: Cosine Ndcg@10 - type: cosine_mrr@10 value: 0.26165873015873015 name: Cosine Mrr@10 - type: cosine_map@100 value: 0.27265025021140493 name: Cosine Map@100 - task: type: information-retrieval name: Information Retrieval dataset: name: NanoSciFact type: NanoSciFact metrics: - type: cosine_accuracy@1 value: 0.52 name: Cosine Accuracy@1 - type: cosine_accuracy@3 value: 0.68 name: Cosine Accuracy@3 - type: cosine_accuracy@5 value: 0.74 name: Cosine Accuracy@5 - type: cosine_accuracy@10 value: 0.78 name: Cosine Accuracy@10 - type: cosine_precision@1 value: 0.52 name: Cosine Precision@1 - type: cosine_precision@3 value: 0.24 name: Cosine Precision@3 - type: cosine_precision@5 value: 0.15600000000000003 name: Cosine Precision@5 - type: cosine_precision@10 value: 0.08599999999999998 name: Cosine Precision@10 - type: cosine_recall@1 value: 0.485 name: Cosine Recall@1 - type: cosine_recall@3 value: 0.655 name: Cosine Recall@3 - type: cosine_recall@5 value: 0.715 name: Cosine Recall@5 - type: cosine_recall@10 value: 0.76 name: Cosine Recall@10 - type: cosine_ndcg@10 value: 0.63867394141578 name: Cosine Ndcg@10 - type: cosine_mrr@10 value: 0.6126904761904761 name: Cosine Mrr@10 - type: cosine_map@100 value: 0.6000767158750212 name: Cosine Map@100 - task: type: information-retrieval name: Information Retrieval dataset: name: NanoTouche2020 type: NanoTouche2020 metrics: - type: cosine_accuracy@1 value: 0.5510204081632653 name: Cosine Accuracy@1 - type: cosine_accuracy@3 value: 0.8979591836734694 name: Cosine Accuracy@3 - type: cosine_accuracy@5 value: 0.9591836734693877 name: Cosine Accuracy@5 - type: cosine_accuracy@10 value: 0.9795918367346939 name: Cosine Accuracy@10 - type: cosine_precision@1 value: 0.5510204081632653 name: Cosine Precision@1 - type: cosine_precision@3 value: 0.5238095238095238 name: Cosine Precision@3 - type: cosine_precision@5 value: 0.5061224489795918 name: Cosine Precision@5 - type: cosine_precision@10 value: 0.4408163265306122 name: Cosine Precision@10 - type: cosine_recall@1 value: 0.031916041016838086 name: Cosine Recall@1 - type: cosine_recall@3 value: 0.09305551079805752 name: Cosine Recall@3 - type: cosine_recall@5 value: 0.15030280735845877 name: Cosine Recall@5 - type: cosine_recall@10 value: 0.2581585508738777 name: Cosine Recall@10 - type: cosine_ndcg@10 value: 0.4731723201295366 name: Cosine Ndcg@10 - type: cosine_mrr@10 value: 0.7240362811791384 name: Cosine Mrr@10 - type: cosine_map@100 value: 0.35595314535488254 name: Cosine Map@100 - task: type: nano-beir name: Nano BEIR dataset: name: NanoBEIR mean type: NanoBEIR_mean metrics: - type: cosine_accuracy@1 value: 0.3916169544740973 name: Cosine Accuracy@1 - type: cosine_accuracy@3 value: 0.5936891679748822 name: Cosine Accuracy@3 - type: cosine_accuracy@5 value: 0.6660910518053375 name: Cosine Accuracy@5 - type: cosine_accuracy@10 value: 0.7538147566718993 name: Cosine Accuracy@10 - type: cosine_precision@1 value: 0.3916169544740973 name: Cosine Precision@1 - type: cosine_precision@3 value: 0.26695970695970694 name: Cosine Precision@3 - type: cosine_precision@5 value: 0.21185557299843014 name: Cosine Precision@5 - type: cosine_precision@10 value: 0.15544740973312401 name: Cosine Precision@10 - type: cosine_recall@1 value: 0.20642422146574338 name: Cosine Recall@1 - type: cosine_recall@3 value: 0.34944292635161633 name: Cosine Recall@3 - type: cosine_recall@5 value: 0.4101453441552019 name: Cosine Recall@5 - type: cosine_recall@10 value: 0.5068159979015638 name: Cosine Recall@10 - type: cosine_ndcg@10 value: 0.4477327590762682 name: Cosine Ndcg@10 - type: cosine_mrr@10 value: 0.5088495552066982 name: Cosine Mrr@10 - type: cosine_map@100 value: 0.36750553610750447 name: Cosine Map@100 datasets: - tomaarsen/NanoBEIR-ja - hotchpotch/sentence_transformer_japanese base_model: - RikkaBotan/stable-static-embedding-fast-retrieval-mrl-ja --- ![SSE](assets/SSE_Logo.png) # 🩵 SSE: Stable Static Embedding for Retrieval MRL 日本語・量子化バージョン 🩵 ### **軽量、高速かつ強力な埋め込みモデル** **パフォーマンスの簡易解説** このモデルは NanoBEIR_ja(日本語文書検索タスク) において **NDCG@10 = 0.4477** を達成しました。 このスコアは他の静的埋め込みモデル( [`static-embedding-japanese`](https://huggingface.co/hotchpotch/static-embedding-japanese) (0.4487)など )と同水準のパフォーマンスです。 さらに、**次元数を半分**(512 vs 1024)に抑えています。 次元数の削減と、**Separable Dynamic Tanh** により、環境によっては検索速度は **約2倍高速** になっています。 このモデルは、[stable-static-embedding-fast-retrieval-mrl-ja](RikkaBotan/stable-static-embedding-fast-retrieval-mrl-ja)の重みを量子化することで、他の静的埋め込みモデルよりも**15.7倍小さいデータサイズ**になっています。 重みのデータサイズは、**たったの9MB以下**です。 | モデル | NanoBEIR NDCG@10 | 次元数 | パラメータ数 | データサイズ | 速度の優位性 | ライセンス | |-------|------------------|------------|------------|----------|-----------------|---------| | **Quantized SSE Retrieval MRL Japanese** | **0.4477** ✨ | **512** | **~17M** 🪽 | **~8.5MB** 🪽 | **検索が約2倍高速** (超効率的) | Apache 2.0 | | SSE Retrieval MRL Japanese | 0.4507 | 512 | ~17M | ~67MB | 検索が約2倍高速 (超効率的) | Apache 2.0 | | `static-embedding-japanese` | 0.4487 | 1024 | ~34M | ~134MB | ベースライン | MIT | --- ## 🩵 **SSE Retrieval MRL を選ぶ理由** 🩵 ✅ **パラメータ数の小さなモデル (<35M パラメータ) の中では高い性能(NDCG@10)** ✅ **約17M のパラメータのみ** :軽量モデルである[ruri-v3-30m](cl-nagoya/ruri-v3-30m) より約43% 小さい。 ✅ **次元数512の出力** — 次元数1024のモデルよりも豊かな表現力を持ち、[`static-embedding-japanese`](https://huggingface.co/hotchpotch/static-embedding-japanese) の **半分サイズ** ✅ **Matryoshka 対応** — 256/128/64/32 に簡単に切り替えられ、性能の緩やかな低下を実現 ✅ **Apache 2.0 ライセンス** — 商用・個人利用ともに可能 ✅ **CPU 最適化** — エッジデバイスや限られたハードウェアでも高速に動作 --- ## 🩵 モデル詳細 🩵 | プロパティ | 値 | |----------|-------| | **モデルタイプ** | Sentence Transformer (SSE アーキテクチャ) | | **最大シーケンス長** | 無制限 | | **出力次元** | 512 (Matryoshka により 次元数32 まで削減可能!) | | **類似度関数** | コサイン類似度 | | **言語** | 日本語 | | **ライセンス** | Apache 2.0 | tokenizerは下記を使用させていただきました。 [hotchpotch/xlm-roberta-japanese-tokenizer](https://huggingface.co/hotchpotch/xlm-roberta-japanese-tokenizer) ```python SentenceTransformer( (0): SSE( (embedding): EmbeddingBag(32768, 512, mode='mean') (dyt): SeparableDyT() ) ) ``` ![Architecture](assets/SSE_Architecture.png) --- ## 🩵 数学的背景 🩵 このモデルは静的埋め込みモデルの汎化性能を向上させるために、オリジナルのアーキテクチャである、**SSE: Stable Static Embedding**を採用しています。 SSEは、EmbeddingBagとSeparable Tanh Normalizationから構成されます。 Dynamic Tanh Normalization (DyT) は、静的埋め込みにおいて、強度適応型勾配流を可能にします。入力次元 x に対して、DyT は以下のように計算されます。 $$ y_k = c_k \tanh(a_k x_k + b_k) $$ ここで、a, b, c は学習可能なパラメータです。 すると、x の勾配は以下の通りになります。 $$ \frac{\partial y_k}{\partial x_k} = c_k a_k \, \mathrm{sech}^2(a_k x_k + b_k). $$ 飽和した次元 |x| > 1 の場合 $$ |a_i x_i + b_i| \gg 1 $$ は指数関数的な減衰をもたらします。 $$ \mathrm{sech}^2(z) \sim 4e^{-2|z|} $$ これにより勾配が抑制され、 $$ \partial y_i / \partial x_i \to 0 $$ となります。 対して、非飽和の次元 |x| << 1 の場合、 $$ \mathrm{sech}^2(z) \approx 1 $$ ほぼ一定の勾配を維持します。 $$ \partial y_j / \partial x_j \approx c_j a_j $$ この強度依存型のゲートは、ノイズが多く大きな成分を持つ次元からの学習信号を減衰させつつ、安定した情報を有する次元については勾配流を維持します。これは明示的なハイパーパラメータなしで、表現空間の汎化性能を高める暗黙的な正則化を可能にします。 --- ## 🩵 評価結果 (NanoBEIR_ja) 🩵 | データセット | NDCG@10 | MRR@10 | MAP@100 | |----------------------|-----------|-----------|-----------| | **NanoBEIR Mean** | **0.4477** ✨ | **0.5088** | **0.3675** | | NanoClimateFEVER | 0.3152 | 0.4258 | 0.2417 | | NanoDBPedia | 0.5554 | 0.7767 | 0.3962 | | NanoFEVER | 0.5536 | 0.4907 | 0.4827 | | NanoFiQA2018 | 0.3160 | 0.3614 | 0.2653 | | NanoHotpotQA | 0.4722 | 0.5669 | 0.4136 | | NanoMSMARCO | 0.3929 | 0.3237 | 0.3371 | | NanoNFCorpus | 0.2686 | 0.4584 | 0.0962 | | NanoNQ | 0.4170 | 0.3607 | 0.3571 | | NanoQuoraRetrieval | **0.7768** ✨ | **0.7750** | **0.7393** | | NanoSCIDOCS | 0.2939 | 0.4774 | 0.2197 | | NanoArguAna | 0.3471 | 0.2617 | 0.2727 | | NanoSciFact | 0.6387 | 0.6127 | 0.6001 | | NanoTouche2020 | 0.4732 | 0.7240 | 0.3560 | --- ## 🩵 使い方 🩵 ```python import torch from sentence_transformers import SentenceTransformer # モデルのロード(リモートコードは有効化) model = SentenceTransformer( "RikkaBotan/quantized-stable-static-embedding-fast-retrieval-mrl-ja", trust_remote_code=True, device="cuda" if torch.cuda.is_available() else "cpu", ) # 対象の文章 sentences = [ "大規模言語モデルは学習により、高い推論能力を獲得することが可能である。", "静的埋め込みモデルは、簡素なアーキテクチャにより、表現空間を高速に生成可能である。" ] with torch.no_grad(): embeddings = model.encode( sentences, convert_to_tensor=True, normalize_embeddings=True, batch_size=32 ) # コサイン類似度 # 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) ``` --- ## 🩵 検索用使用例 🩵 ```python import torch from sentence_transformers import SentenceTransformer # モデルのロード(リモートコードは有効化) model = SentenceTransformer( "RikkaBotan/quantized-stable-static-embedding-fast-retrieval-mrl-ja", trust_remote_code=True, device="cuda" if torch.cuda.is_available() else "cpu", ) # 推論 query = "安定性静的埋め込みモデルとは何ですか?" sentences = [ "安定性静的埋め込みモデルは自己注意機構を必要としません。", "安定性静的埋め込みモデルは高速に高精度な埋め込み表現を生成するためのモデルです。", "自己注意機構はトークン間の関係性をスコア化する仕組みのことです", "昨夜はアイドルの曲を聴きながらお菓子作りをしていました。", "言語モデルは一般的に、次時刻のトークンを予測するという学習が行われます。", "お気に入りのヘアアクセサリーを身に着けると、とてもテンションが上がるよね。", ] with torch.no_grad(): embeddings = model.encode( [query] + sentences, convert_to_tensor=True, normalize_embeddings=True, batch_size=32 ) print("embeddings shape:", embeddings.shape) # コサイン類似度 similarities = model.similarity(embeddings[0], embeddings[1:]) for i, similarity in enumerate(similarities[0].tolist()): print(f"{similarity:.05f}: {sentences[i]}") ``` --- ## 🩵 学習時のハイパーパラメータ 🩵 #### デフォルトと異なる設定 - `eval_strategy`: steps - `per_device_train_batch_size`: 3072 - `gradient_accumulation_steps`: 10 - `learning_rate`: 0.1 - `adam_epsilon`: 1e-10 - `num_train_epochs`: 2 - `lr_scheduler_type`: cosine - `warmup_ratio`: 0.02 - `bf16`: True - `dataloader_num_workers`: 4 - `batch_sampler`: no_duplicates --- ## 🩵 学習データセット 🩵 下記の**14個のデータセット**を使用しました。 | Dataset | |---------| | `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` | **MatryoshkaLoss**を用いて学習を行っています。 ## 🩵 学習結果 🩵 ![loss](assets/SSE_loss.png) ![ndcg](assets/SSE_ndcg.png) ## 🩵 作成者:六花牡丹(りっかぼたん) 🩵 おっとりで甘えん坊な研究者見習い。 言語モデルに関するものが主な研究分野です。 お仕事のご依頼・登壇依頼・執筆依頼に関しては、下記までご連絡ください。 X(Twitter): https://twitter.com/peony__snow ![Logo](assets/RikkaBotan_Logo.png) ## 🩵 謝辞 🩵 このモデルの学習のための計算リソースの一部は、Saldraさん、Witnessさん、Lumina Logic Minds社から提供いただきました。貴重なサポートに感謝いたします。 sentence-transformers、python、pytorchを使用させていただきました。 作成・メンテンナンスしてくださっている皆様に感謝いたします。 何よりも、このモデルにご興味を持ってくださりありがとうございます。 ## 🩵 引用 🩵 ### BibTeX #### Sentence Transformers ```bibtex @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 ```bibtex @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 ```bibtex @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} } ```