EmbeddingGemma 300M release notes

TL;DR

Google released EmbeddingGemma, a 308 M‑parameter multilingual text‑only embedding model with a 2 K token context window, designed for on‑device retrieval, agents, and other low‑latency applications. It tops the Massive Text Embedding Benchmark (MTEB) for models under 500 M parameters and supports more than 100 languages.


Introduction – A compact, high‑performing multilingual embedder

EmbeddingGemma is the newest small‑scale multilingual embedding model from Google DeepMind. At 308 M parameters and under 200 MB RAM when quantized, it delivers state‑of‑the‑art performance on the Massive Multilingual Text Embedding Benchmark (MMTEB) while remaining small enough for mobile and edge deployment. The model processes 2048 tokens per forward pass and outputs 768‑dimensional vectors, with optional truncation to 512, 256, or 128 dimensions via Matryoshka Representation Learning (MRL).


Architecture – Encoder‑only Gemma3 with mean‑pooling and dense heads

EmbeddingGemma reuses the Gemma3 transformer backbone but switches from causal to bi‑directional attention, turning the decoder architecture into an encoder. This encoder produces token‑level embeddings that are mean‑pooled into a single text embedding, followed by two dense layers that map the pooled vector to a 768‑dimensional output. The model was trained on a curated ~320 billion‑token multilingual corpus that mixes public web text, code, technical documentation, and synthetic task‑specific examples, with rigorous filtering for CSAM, sensitive data, and low‑quality content.


Evaluation – Best‑in‑class results for sub‑500 M models

EmbeddingGemma was benchmarked on both the Multilingual MTEB (v2) and English MTEB (v2) suites. Despite its modest size, it consistently outperforms comparable baselines and is the highest‑ranking text‑only multilingual embedding model under 500 M parameters on the official MTEB leaderboard. The blog post includes performance plots for both multilingual and English tracks and notes that any model trained on more than 20 % of the MTEB data was excluded to avoid over‑fitting.


Prompt design – Task‑specific prefixes are required

EmbeddingGemma was trained with a set of task‑specific prompts that must be prepended to inputs for optimal performance. The most common prompts are:

  • query: "task: search result | query: "
  • document: "title: none | text: "

Other prompts cover BitextMining, Clustering, Classification, InstructionRetrieval, MultilabelClassification, PairClassification, Reranking, STS, and Summarization. In the Sentence‑Transformers library, model.encode_query and model.encode_document automatically add the query and document prompts; other frameworks require manual specification.


Usage across ecosystems – Ready‑to‑run examples

EmbeddingGemma is integrated with many popular retrieval and LLM toolkits. Below are concise, self‑contained snippets that demonstrate how to obtain embeddings and perform similarity search.

Sentence‑Transformers (Python)

from sentence_transformers import SentenceTransformer
model = SentenceTransformer("google/embeddinggemma-300m")
query = "Which planet is known as the Red Planet?"
documents = [
    "Venus is often called Earth's twin because of its similar size and proximity.",
    "Mars, known for its reddish appearance, is often referred to as the Red Planet.",
    "Jupiter, the largest planet in our solar system, has a prominent red spot.",
    "Saturn, famous for its rings, is sometimes mistaken for the Red Planet."
]
q_emb = model.encode_query(query)
d_emb = model.encode_document(documents)
print(q_emb.shape, d_emb.shape)  # (768,) (4, 768)
print(model.similarity(q_emb, d_emb))

The example ranks the documents correctly, with the highest similarity for the sentence about Mars.

Dimensionality truncation (Matryoshka)

model = SentenceTransformer("google/embeddinggemma-300m", truncate_dim=256)
q_emb = model.encode_query(query)
d_emb = model.encode_document(documents)
print(q_emb.shape, d_emb.shape)  # (256,) (4, 256)

Truncating to 256 dimensions reduces storage and compute cost while preserving ranking order.

LangChain (Python)

from langchain_huggingface.embeddings import HuggingFaceEmbeddings
embedder = HuggingFaceEmbeddings(
    model_name="google/embeddinggemma-300m",
    query_encode_kwargs={"prompt_name": "query"},
    encode_kwargs={"prompt_name": "document"}
)
# Use with FAISS vector store for retrieval as shown in the blog post.

LangChain users must explicitly set the query and document prompts.

LlamaIndex (Python)

from llama_index.embeddings.huggingface import HuggingFaceEmbedding
emb = HuggingFaceEmbedding(
    model_name="google/embeddinggemma-300m",
    query_instruction="task: search result | query: ",
    text_instruction="title: none | text: "
)

The same prompt strings are required for correct embedding generation.

Haystack, txtai, Transformers.js, ONNX Runtime, and TEI

The blog provides ready‑to‑run scripts for each of these runtimes. All of them follow the same pattern: download the model from the Hub, configure the appropriate prompt, compute embeddings, and perform inner‑product similarity (the training objective). The Text Embeddings Inference (TEI) Docker images (cpu-1.8.1, cuda-1.8.1, etc.) expose an OpenAI‑compatible /v1/embeddings endpoint, and the /embed endpoint additionally supports the prompt_name and dimensions parameters for on‑the‑fly truncation.


Finetuning – Domain adaptation on the MIRIAD medical dataset

EmbeddingGemma can be fine‑tuned with the Sentence‑Transformers library. The blog demonstrates a full pipeline that:

  1. Loads the base model (google/embeddinggemma-300m).
  2. Loads the MIRIAD medical instruction‑and‑retrieval dataset (100 k training pairs, 1 k eval, 1 k test).
  3. Uses CachedMultipleNegativesRankingLoss for efficient in‑batch negative sampling.
  4. Trains for 1 epoch on an RTX 3090 (≈5.5 h) with mixed‑precision (fp16).
  5. Evaluates with InformationRetrievalEvaluator, reporting NDCG@10.

The base model achieved 0.8340 NDCG@10 on the MIRIAD test split. After fine‑tuning, the model (sentence‑transformers/embeddinggemma-300m‑medical) reached 0.8862 NDCG@10, surpassing all listed general‑purpose embedding models, including larger ones such as Qwen3‑Embedding‑0.6B (596 M parameters).


Implications – Enabling on‑device multilingual retrieval

EmbeddingGemma’s combination of compact size, 2 K context, and multilingual coverage makes it uniquely suited for scenarios where latency, memory, and bandwidth are constrained:

  • Mobile RAG pipelines can embed queries and documents locally, reducing reliance on cloud APIs.
  • Edge agents (e.g., voice assistants, AR/VR apps) can perform semantic search without transmitting raw text.
  • Cross‑language retrieval becomes feasible on low‑power devices, thanks to support for >100 languages.
  • Matryoshka truncation allows developers to trade off accuracy for storage and compute, enabling large‑scale vector databases on modest hardware.

Overall, EmbeddingGemma lowers the barrier for deploying high‑quality multilingual embeddings in production environments that demand speed and efficiency.


Further reading


Quick start checklist

  1. Install the preview Transformers package (pip install git+https://github.com/huggingface/transformers@v4.56.0-Embedding-Gemma-preview).
  2. Choose a framework (Sentence‑Transformers, LangChain, LlamaIndex, etc.).
  3. Load google/embeddinggemma-300m from the Hub.
  4. Apply the appropriate prompt (query for searches, document for corpus items).
  5. Optionally truncate embeddings via truncate_dim (256, 512, or 128).
  6. Deploy with TEI or ONNX Runtime for production scaling.

Conclusion

EmbeddingGemma delivers a rare blend of multilingual capability, on‑device efficiency, and benchmark‑leading quality in a sub‑500 M‑parameter package. Its open‑source availability, extensive integration with major retrieval frameworks, and straightforward fine‑tuning pipeline make it a practical choice for developers building next‑generation semantic search and retrieval‑augmented generation systems on constrained hardware.

Sources