Modern search and RAG systems increasingly need to handle mixed content — technical docs, source code, images, video frames, and audio — without relying on heavy infrastructure. EmbeddingGemma 2 addresses this with a single, compact open model that maps all these modalities into one shared vector space.
Released under Apache 2.0 and built on Gemma 4, EmbeddingGemma 2 is a sub-1B parameter model. It produces 768-dimensional embeddings and supports modular loading so you only pull in the capacity you actually need.
What EmbeddingGemma 2 Offers
Native multimodal retrieval — Text, code, images, video, and audio all land in the same 768-dimensional space, enabling direct similarity comparison across formats.
Stronger code understanding — Noticeable gains over EmbeddingGemma 1 on code search and technical retrieval, making it practical for local codebase indexing and agentic search.
Modular size — Load only the required encoders:
270M parameters for text and code
440M for text + vision
570M for text + audio
740M for the full multimodal model
Flexible storage with Matryoshka Representation Learning (MRL) — Truncate embeddings from 768 dimensions down to 512, 256, or 128 while keeping most of the original quality. At 256 dimensions you retain the majority of performance on text and code and roughly 95% on image, video, and speech retrieval.
This combination makes the model suitable for on-device or resource-constrained environments while still delivering competitive retrieval accuracy.
How the Architecture Works

Instead of chaining separate models, EmbeddingGemma 2 uses specialized encoders that project into a shared backbone and the same 768-dimensional space:
Text and code (base 270M) — An adapted Gemma 4 decoder with an 8,192-token context window.
Vision (+170M) — Handles images, visual documents (PDFs, slides, charts), and video frames.
Audio (+300M) — Processes raw speech and sound directly.
Modular loading — Disabled encoders are never loaded into memory, reducing both weight size and peak allocation.
Shared components with Gemma 4 — When used together in an on-device RAG pipeline, the models can share the text tokenizer and audio encoder architecture, further lowering the total memory footprint.
All modalities end up in a compatible vector space, so a text query can be matched directly against image or audio embeddings (and vice versa).
Using EmbeddingGemma 2 with sentence-transformers
The recommended path is the sentence-transformers library (version 6.1.0 or later).
Load the model
Python
from sentence_transformers import SentenceTransformer
# Full multimodal model
model = SentenceTransformer("google/embeddinggemma-2")
# Or load only what you need to save memory
model = SentenceTransformer(
"google/embeddinggemma-2",
config_kwargs={"vision_config": None, "audio_config": None} # text/code only
)Embed text and code with task prompts
EmbeddingGemma 2 is trained with short task instructions. Use prompt_name to apply them automatically:
Python
# For retrieval, use different prompts for queries and documents
query_emb = model.encode("How does the authentication flow work?", prompt_name="query")
doc_emb = model.encode(code_snippet, prompt_name="document")Embed images, video, audio, or mixed inputs
Pass media as a dictionary. For interleaved content, use special tokens (<|image|>, <|video|>, <|audio|>) to mark positions:
Python
# Single modality
image_emb = model.encode({"image": "path/or/url/to/image.jpg"})
# Mixed example
mixed_emb = model.encode({
"text": "Describe this diagram: <|image|>",
"image": image_path
})Embeddings from different modalities remain comparable because they share the same dimensional space.
Truncate dimensions with Matryoshka
Python
# At encode time
short_emb = model.encode(texts, truncate_dim=256, normalize_embeddings=True)
# Or set permanently at load time
model = SentenceTransformer("google/embeddinggemma-2", truncate_dim=256)Storage impact is significant. In bfloat16, one million 768-dimensional vectors occupy roughly 1.5 GB. Truncating to 128 dimensions drops that to about 250 MB — a 6× reduction.
Choosing the Right Configuration
All encoder combinations load from the same checkpoint and share the same vector space. A query embedded with the 270M text-only version can be matched against documents embedded with the full model.
Which encoders to load
Start with only the modalities present in your data. If you later add images or audio, reload with the additional encoder enabled. Existing embeddings do not need to be recomputed.
Which dimension to use
768 or 512 — Best for multimodal or visual document retrieval when recall is the priority.
256 — Good balance for storage-constrained indexes. Retains most quality on text/code and ~95% on image/video/speech.
128 — Suitable for large text-only indexes or first-stage shortlisting before re-ranking. Text and code quality stays around 90%; multimodal quality drops more noticeably (validate on your data).
Input limits
All modalities share the 8,192-token context window. Video defaults to 1 frame per second; audio expects 16 kHz mono. Media can be supplied as file paths, URLs, or in-memory objects (PIL images, arrays, tensors).

Performance Snapshot
On MTEB (Code), EmbeddingGemma 2 scores approximately 14% higher than EmbeddingGemma 1. It adds competitive image, video, and audio retrieval while preserving the multilingual text performance of the previous version. Exact numbers will vary by dataset, so testing on your own data remains essential.
Getting Started
Model weights: Available on Hugging Face under Apache 2.0 (google/embeddinggemma-2).
Documentation: Official Gemma docs cover additional details and integration patterns.
Runtime options: Works with vLLM, Hugging Face Transformers, sentence-transformers, SGLang, MLX, Ollama, LM Studio, and LiteRT.
Fine-tuning: Unsloth provides efficient fine-tuning support for rapid experimentation.
Demos: On-device examples such as Instant Media Search and Video Moments Finder are available in the Google AI Edge Gallery.
EmbeddingGemma 2 is designed for developers who need solid multimodal retrieval without the overhead of large models or complex multi-model pipelines. Load only what you need, truncate when storage matters, and keep everything in one compatible vector space. That combination makes it a practical default for many modern search and RAG workloads.

No feedback yet — submit the first.