# EmbeddingGemma (Gemma)

> A 308M multilingual embedding model small enough to run on-device

- Category: Retrieval & Knowledge (RAG) / Embedding Models & Inference
- Language: Python
- Licence: Gemma
- Repository: https://github.com/google-deepmind/gemma
- Website: https://ai.google.dev/gemma/docs/embeddinggemma
- Canonical page: https://ai-tldr.dev/tools/embeddinggemma-gemma/
- Updated: 2026-10-06

## In short

EmbeddingGemma (Gemma) is a 308M multilingual embedding model small enough to run on-device. It turns text into dense vectors that you can use for semantic search, retrieval-augmented generation (RAG), clustering, and similarity comparison. It sits in the Embedding Models & Inference category of the Retrieval & Knowledge (RAG) tools and is open-source, written in Python and licensed Gemma.

## Overview

EmbeddingGemma is a 308M-parameter text embedding model from Google DeepMind, based on Gemma 3. It turns text into dense vectors that you can use for semantic search, retrieval-augmented generation (RAG), clustering, and similarity comparison. It was trained on data covering over 100 languages, so it works across multilingual content.

Because it is small, it is meant to run on-device or on modest hardware (CPU, GPU, or TPU) rather than requiring a large server. It also supports Matryoshka Representation Learning, which lets you shorten the output vector (for example from 768 down to 128 dimensions) to trade a little accuracy for lower storage and faster search.

It fits the embedding-models category: you generate embeddings once for your documents, store them in a vector index, and compare them against query embeddings at search time. The recommended way to run it is through the sentence-transformers library using the open weights published on Hugging Face.

EmbeddingGemma 2 (google/embeddinggemma-2) extends the family beyond text. It has 740M parameters — a 270M text backbone built on the Gemma 4 architecture plus optional 170M vision and 300M audio encoders — and places text, code, images, audio and video in one shared 768-dimension space. It has an 8K-token context window and is released under the Apache 2.0 license.

## What it does

- 308M-parameter embedding model based on Gemma 3, suited to on-device and CPU/GPU/TPU use
- Trained on data spanning over 100 languages for multilingual text
- Matryoshka Representation Learning: truncate output dimensions from 768 down to 128 to save storage
- Open weights licensed for commercial use, published on Hugging Face as google/embeddinggemma-300M
- Runs through the standard sentence-transformers API with model.encode() and model.similarity()
- Built for RAG, semantic search, clustering, and similarity tasks

## Getting started

EmbeddingGemma is loaded through the sentence-transformers library. Install the dependencies, then load the model from Hugging Face and call encode().

1. Install sentence-transformers

   Install sentence-transformers along with the transformers build that supports EmbeddingGemma.

```bash
pip install -U sentence-transformers git+https://github.com/huggingface/transformers@v4.56.0-Embedding-Gemma-preview
```

2. Generate embeddings

   Load the model by its Hugging Face ID and call encode() on your text. Use similarity() to compare two embeddings.

```python
import torch
from sentence_transformers import SentenceTransformer

device = "cuda" if torch.cuda.is_available() else "cpu"
model = SentenceTransformer("google/embeddinggemma-300M").to(device=device)

texts = ["apple", "banana", "car"]
embeddings = model.encode(texts)

similarities = model.similarity(embeddings[0], embeddings[1])
```

3. Shrink the embedding dimension (optional)

   Pass truncate_dim to get shorter vectors via Matryoshka Representation Learning, which reduces storage and speeds up search.

```python
embeddings = model.encode(texts, truncate_dim=512)
```

## When to use it

- Build a RAG pipeline: embed your documents, store them in a vector index, and retrieve the closest chunks for a user query
- Add semantic search to an app so results match meaning rather than exact keywords
- Run embeddings on-device or on a CPU where a larger model would be too heavy
- Embed multilingual content for cross-language search, clustering, or deduplication

## Version history

- 2026-10-06 EmbeddingGemma 2: EmbeddingGemma 2 adds image, audio and video input to the text model, grows to 740M parameters with an 8K-token context, and ships under Apache 2.0. Its MTEB Code score rises from 68.76 to 78.68.
