🦉 CodeModernBERT‑Owl 3.0 SentenceTransformer

多言語・長文コードを対象としたエンコーダ CodeModernBERT‑Owl 3.0 をベースに Sentence Transformer(STS)形式で微調整したモデルです。1024 token までのソースコード/自然言語を 768 次元の密ベクトルに写像し、コード検索・類似度計算・クラスタリングなど幅広い下流タスクに活用できます。

A multilingual, long‑context SentenceTransformer fine‑tuned from CodeModernBERT‑Owl 3.0. It encodes code and natural‑language snippets (≤ 1024 tokens) into 768‑dimensional vectors for semantic search, similarity, clustering, and more.


🔥 ハイライト / Highlights

⚙️ 仕様
最大シーケンス長 1024 tokens
埋め込み次元 768 d │ Cosine Similarity
プーリング CLS トークン(pooling_mode_cls_token = True
学習データ 7,059,200 正例ペア(CodeSearchNet + 自作データセット)
ロス関数 MultipleNegativesRankingLoss (scale = 20.0)
学習エポック 3 epochs (@ batch size 200, fp16)
基盤モデル Shuu12121/CodeModernBERT‑Owl 3.0

📊 評価結果 / Evaluation

MTEB CodeSearchNet (CSN) ―

Metric COIR Version CSN
Main Score (NDCG@10) 0.8023 0.8928
NDCG@1 0.7175 0.8125
NDCG@3 0.7795 0.8798
NDCG@5 0.7917 0.8879
NDCG@20 0.8085 0.8950
MAP@10 0.7759 0.8707
Recall@10 0.8839 0.9593
MRR@10 0.7759 0.8707

どちらも公式スコアに提出しているCodeSearch-ModernBERT-Crow-Plusと同等以上の成績を残しています.


🚀 使い方 / Quick Start

from sentence_transformers import SentenceTransformer, util

model = SentenceTransformer("Shuu12121/CodeModernBERT-Owl-3.0-ST")

queries = ["get test root"]
docs = [
    "function getRootPath(){ … }",
    "protected Object parseKeyElement(Element keyEle, …)",
]

q_emb = model.encode(queries, normalize_embeddings=True)
d_emb = model.encode(docs,   normalize_embeddings=True)

scores = util.cos_sim(q_emb, d_emb)
print(scores)

🛠️ ファインチューニング / Fine‑tuning

  • ロス関数: MultipleNegativesRankingLoss はミニバッチ内のネガティブを暗黙的に構成するため大規模ペア生成が不要。

  • ハイパーパラメータ (主要):

    learning_rate: 5e‑5
    per_device_train_batch_size: 200
    fp16: true
    warmup_ratio: 0.0
    max_grad_norm: 1.0
    

⚖️ ライセンス / License

Apache 2.0

Downloads last month
13
Safetensors
Model size
152M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Shuu12121/CodeSearch-ModernBERT-Owl-3.0-Plus

Finetuned
(1)
this model

Dataset used to train Shuu12121/CodeSearch-ModernBERT-Owl-3.0-Plus

Collection including Shuu12121/CodeSearch-ModernBERT-Owl-3.0-Plus