Instructions to use thealper2/embeddinggemma-2-tr with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use thealper2/embeddinggemma-2-tr with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("thealper2/embeddinggemma-2-tr") 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
EmbeddingGemma 2 โ Turkish retrieval (eg2_ft_primary)
A text-only fine-tune of google/embeddinggemma-2 for Turkish semantic search, trained with a contrastive objective on two public Turkish retrieval sets: MS MARCO-TR (search query โ web passage) and MLSUM-TR (news title or summary โ article). Only the text pathway (token embeddings, 24 bidirectional transformer layers, per-layer embeddings, 512โ768 projection) was trained; the vision and audio encoders of the original checkpoint are not included and were never loaded during training.
Read the evaluation section before using the numbers. The main benchmark (Track A) uses held-out MS MARCO-TR queries (machine-translated) and MLSUM-TR news titles/summaries with one labelled document each; it is not a complete human relevance benchmark.
Usage
from sentence_transformers import SentenceTransformer
import torch
model = SentenceTransformer("thealper2/embeddinggemma-2-tr", model_kwargs={"dtype": torch.bfloat16})
model.max_seq_length = 512
queries = ["Merkez Bankasฤฑ faiz kararฤฑ ne oldu"]
docs = ["Tรผrkiye Cumhuriyet Merkez Bankasฤฑ politika faizini sabit tuttu..."]
q = model.encode(queries, prompt_name="SearchQuery") # "task: search result | query: "
d = model.encode(docs, prompt_name="Document") # "title: none | text: "
print(model.similarity(q, d))
# Matryoshka: 512 / 256 / 128 dims (re-normalised)
q128 = model.encode(queries, prompt_name="SearchQuery", truncate_dim=128, normalize_embeddings=True)
- Use the same prompts as training:
SearchQueryfor queries andDocument(title: none | text: โฆ) for articles without titles. If a real title exists, format the document astitle: {title} | text: {body}(base-model convention; titled documents were not seen in fine-tuning). - Use bfloat16 or float32, never float16 (the base model's activations overflow fp16).
- Requires
sentence-transformers >= 6.1andtransformers >= 5.19(nativeEmbeddingGemma2Model).
Model details
| Base model | google/embeddinggemma-2 (text pathway only) |
| Parameters in this checkpoint | 271,002,624 |
| Trainable during fine-tuning | 271,002,624 (full) |
| Output | 768-d, mean pooling (prompt tokens included), L2-normalised; MRL dims 512/256/128 |
| Max sequence length (training) | 512 tokens |
| Similarity | cosine |
| Checkpoint size | 1.0 GiB |
Parameter groups (from trainable_parameters.json): {"token_embeddings": {"params": 134217728, "trainable": 134217728, "tensors": 1}, "per_layer_embeddings": {"params": 6291968, "trainable": 6291968, "tensors": 2}, "transformer_layers": {"params": 130099200, "trainable": 130099200, "tensors": 384}, "projection": {"params": 393216, "trainable": 393216, "tensors": 1}, "norm": {"params": 512, "trainable": 512, "tensors": 1}}
Training data
- MS MARCO-TR (
parsak/msmarco-tr, apache-2.0): machine-translated MS MARCO passage ranking. Labelled training queries: 305309; passages sharing a query form one cluster, and validation/test queries are held out per cluster so their positives never appear in training. Training queries used: 60000. - MLSUM-TR (
reciTAL/mlsum,tu): Turkish news with title, summary and body; the query is the title (or the summary for a share of articles) and the positive is the body. The dataset's own train/validation/test splits are kept; training articles whose text or query duplicates a held-out article were dropped (34). Training queries used: 30000. - Training rows: 69,183 (query, positive, hard negative) rows, per source {'msmarco_tr': 49504, 'mlsum_tr': 19679}; each batch is drawn from a single source (proportional sampling), so in-batch negatives come from the same domain. Provenance is saved in
train_provenance.jsonl.
| document encoding | query encoding p50 | search (exact, GPU) | peak GPU during encoding |
|---|---|---|---|
| 178.8 docs/s | 58.69 ms | 0.006 ms/query | 8.18 GiB |
Limitations and risks
- Translation: MS MARCO-TR is machine-translated; some queries and passages are awkward or garbled, and the topics follow English web search (US-centric).
- Incomplete relevance labels: MS MARCO has about one labelled passage per query and MLSUM exactly one article per title, so other relevant documents count as errors; scores are lower bounds.
- Domain: news (MLSUM, 2010-2019) and general web passages. Other domains were not optimised; the MTEB check above quantifies general-domain change where it was run.
- Truncation: documents longer than 512 tokens are truncated (many MLSUM articles are longer).
- Data rights: MLSUM is restricted to non-commercial research use and its articles remain the copyright of the publishers; MS MARCO's original terms are non-commercial as well. Check both before any commercial use of this model.
Citation
Base model: Google DeepMind, EmbeddingGemma 2 model card, https://ai.google.dev/gemma/docs/embeddinggemma/model_card_2.
Contrastive objective: Henderson et al. (2017), Oord et al. (2018); GradCache: Gao et al. (2021); Matryoshka: Kusupati et al. (2022). Full references and the complete methodology are in the accompanying LaTeX report (latex/main.pdf).
- Downloads last month
- 15
Model tree for thealper2/embeddinggemma-2-tr
Base model
google/embeddinggemma-2Evaluation results
- ndcg_at_10 on MS MARCO-TR + MLSUM-TR held-out queries (Track A)test set self-reported0.833
- mrr_at_10 on MS MARCO-TR + MLSUM-TR held-out queries (Track A)test set self-reported0.802
- recall_at_1 on MS MARCO-TR + MLSUM-TR held-out queries (Track A)test set self-reported0.719
- recall_at_10 on MS MARCO-TR + MLSUM-TR held-out queries (Track A)test set self-reported0.931