What Is EmbeddingGemma 2
EmbeddingGemma 2 is Google's open-source native multimodal Embedding model, based on the Gemma 4 architecture, mapping text, code, images, video, and audio into a unified vector space to enable cross-modal semantic retrieval. EmbeddingGemma 2 has a modular design, with only 740M parameters for all modalities, an 8K token context, and after quantization it takes up only about 567MB of memory on a phone. EmbeddingGemma 2 is the strongest multimodal vector model under 1B parameters, with code retrieval improving by nearly 10 points over the previous generation, making it suitable for on-device RAG, semantic search, photo album retrieval, and other scenarios.
Main Features of EmbeddingGemma 2
- Cross-Modal Semantic Retrieval: Maps text, code, images, video, and audio into the same vector space, supporting retrieval of other modalities using any one modality.
- On-Device Local Execution: Only 740M parameters for all modalities, and after quantization it takes up only about 567MB of memory on a Pixel 11 Pro, enabling inference on phones and laptops without an internet connection.
- Local RAG Pipeline: Shares the tokenizer and audio encoder with Gemma 4, and the two can be combined to build a multimodal retrieval-augmented generation system locally, ensuring data privacy.
- Semantic Photo Album/Media Search: In Instant Media Search in Google AI Edge Gallery, you can enter text to search for images in your phone's photo album, or use the camera to photograph an object to find similar photos.
- Video Moment Localization: Video Moments Finder supports text or audio queries and automatically marks semantically matching video segments in a video.
- Real-Time Decision Engine: Performs real-time classification, routing, and prediction through the MediaPipe Decision Task API; in the demo, a single decision takes only 43 milliseconds, far faster than an LLM's 640 milliseconds.
Technical Principles of EmbeddingGemma 2
- Unified Multimodal Embedding Space: The model follows the technical approach of the Gemini Embedding series, encoding inputs from different modalities into the same high-dimensional vector space, so that semantically similar content is close in the vector space, while semantically unrelated content is farther apart. Cross-modal retrieval can be simplified into a unified vector nearest-neighbor search problem, with no need to maintain a separate model for each modality.
- Modular Encoder-Decoder Architecture: The model is built on the Gemma 4 architecture and is assembled from three parts: a 270M-parameter text backbone, a 170M-parameter vision encoder, and a 300M-parameter audio encoder. The vision and audio modules can be loaded as needed, so actual deployments have four configurations: text-only, text+image (440M), text+audio, and all modalities; text tasks do not need to pay the memory overhead for the vision and audio modules.
- Shared Components with Gemma 4: EmbeddingGemma 2 and the generative model Gemma 4 share the same set of text tokenizer and audio encoder, and the two can be chained into a unified on-device RAG pipeline. EmbeddingGemma 2 is responsible for encoding local multimodal files into the database, while Gemma 4 is responsible for context reasoning after retrieval, and the shared components reduce the total memory usage during combined deployment.
- Matryoshka Representation Learning and Dynamic Truncation: The model uses MRL training, outputs 768-dimensional vectors, and supports dynamic truncation to 512, 256, or 128 dimensions during inference. When truncated to 256 dimensions, performance is basically lossless, and vector database storage can be reduced to as little as one-sixth of the original.
- 5. Long Context and Long Input Segmentation: The model supports an 8K token context window, 4 times that of the previous generation, and can process approximately 5.5 minutes of audio, 29 images, 58 frames of video, or interleaved combinations of the above in a single pass. Text input also supports task prefixes, enabling the same piece of text to generate different vector representations for different tasks.
Follow WeChat and reply "open source" to join theAI Open Source Project Exchange Group
How to use EmbeddingGemma 2
- Download model weights: Get the model files for
google/embeddinggemma-2from Hugging Face or Kaggle; for an on-device optimized version, go to the LiteRT Community page. - Choose a runtime framework: The model can be loaded directly through mainstream tools such as transformers, sentence-transformers, MLX, vLLM, llama.cpp, SGLang, Ollama, LM Studio, etc.
- Write inference code: Taking sentence-transformers as an example, after loading the model, use
prompt_name="SearchQuery"and"Document"to encode the query and document respectively, then callsimilarity()to compute vector similarity. - Build a retrieval system: Store the generated embeddings in a vector database (such as Qdrant) to implement semantic search, codebase indexing, or multimodal retrieval.
- On-device deployment: On mobile, Google AI Edge MediaPipe can be used to directly integrate embedding, retrieval, and decision-making tasks, or LiteRT can be used for custom integration; on the browser side, run it via transformers.js / WebGPU.
- Build local RAG: Used in combination with Gemma 4, EmbeddingGemma 2 handles local file retrieval, while Gemma 4 handles context reasoning; the shared components between the two reduce total memory usage.
Core advantages of EmbeddingGemma 2
-
Native omni-modal unification: A single model simultaneously covers five modalities—text, code, images, video, and audio—and maps them into the same vector space, replacing the previous拼接 scheme of "one model per modality".
-
Extremely lightweight and capable of on-device operation: The full modality set has only 740M parameters, and after quantization it occupies only about 567MB of memory on the Pixel 11 Pro, enabling multimodal inference offline on a phone.
-
Strongest performance at the same size: It is the strongest multimodal Embedding model under 1B parameters, and on some tasks even surpasses specialized models more than twice its size.
-
Major leap in code capability: Code retrieval scores improved by nearly 10 points compared with the previous generation, making it very suitable for local codebase indexing and coding agent retrieval.
-
Modular loading on demand: The vision and audio encoders can be detached independently; text tasks require only 270M, avoiding memory costs for unnecessary modalities.
-
Low storage cost: Based on Matryoshka representation learning, 768-dimensional vectors can be truncated to 128 dimensions, reducing vector database storage to as little as one-sixth of the original.
-
Long context support: The 8K token context window is 4 times that of the previous generation, and it can process about 5.5 minutes of audio or 29 images in a single pass.
-
Naturally synergistic with Gemma 4: They share a tokenizer and audio encoder, resulting in lower total memory usage when the two are combined to build local RAG.
EmbeddingGemma 2 project address
- Project official website:https://blog.google/innovation-and-ai/technology/developers-tools/embeddinggemma-2/
- HuggingFace model repository:https://huggingface.co/google/embeddinggemma-2
- Technical paper:https://ai.google.dev/gemma/docs/embeddinggemma/model_card_2
Comparison with Competing Products of EmbeddingGemma 2
| Comparison Dimension | EmbeddingGemma 2 (Google) | WeMM-Embedding(Tencent WeChat) |
|---|---|---|
| Parameter Specifications | Single specification 740M (text-only 270M, modularly separable) | Family-based: three tiers of 2B / 4B / 9B |
| Base Architecture | Based on Gemma 4 | Fine-tuned based on Alibaba Qwen3.5 |
| Supported Modalities | Text, code, image, video,audio | Text, image, video, visual documents, interleaved input (audio not supported) |
| Vector Dimensions | 768 (MRL can truncate to 128) | 2B:2048 / 4B:2560 / 9B:4096(MRL 64~4096) |
| Context Window | 8K token | 32K tokens (inherited from Qwen3.5) |
| MMEB-v2 Score | 59.01 | 77.9 (2B) / 79.2 (4B) / 80.6 (9B, ranked first on the leaderboard) |
| MTEB Multilingual Score | 61.36 | Not reported separately (focus on multimodal tasks) |
| Deployment Positioning | On-device: after quantization, all modalities total about 567MB, and it can run on a Pixel 11 Pro | Server-side: 2B requires about 4GB of VRAM, 9B about 18GB, and it relies on vLLM/SGLang for serving |
| Production Validation | Official Demo (album search, video localization, etc.) | Already deployed at large scale in WeChat Channels, Official Accounts, Moments, and e-commerce search, with over 1 billion daily calls and all 14 A/B tests positive |
Application Scenarios of EmbeddingGemma 2
-
On-device multimodal semantic search: Search the local media library in a phone album using text or a live photo, entirely offline without uploading private data.
-
Video content retrieval and moment localization: In surveillance footage, online course recordings, or meeting recordings, use text or audio queries to quickly locate target segments (such as the scene of "a sea turtle eating"), eliminating the need for manual frame-by-frame searching.
-
Local RAG knowledge base: Build an offline RAG system together with Gemma 4, uniformly indexing local documents, images, and audio, suitable for scenarios that cannot use the cloud, such as enterprise intranets and confidential environments.
-
Codebase semantic indexing and Agent retrieval: Build a vector index for a local codebase to support semantic code search for coding agents, with code retrieval scores improving by nearly 10 points over the previous generation.