Loading…
Welcome EmbeddingGemma, Google's new efficient embedding model
Hugging FaceTom Aarsen, Joshua, Alvaro Bartolome, Aritra Roy Gosthipaty, Pedro Cuenca, Sergio Paniego
Summary
Google DeepMind released EmbeddingGemma, a multilingual embedding model with 308 million parameters and a 2048-token context window designed for on-device applications. Based on the Gemma3 transformer backbone, the architecture replaces causal attention with bidirectional attention to function as an encoder, followed by mean pooling and two dense layers producing 768-dimensional vectors. The model incorporates Matryoshka Representation Learning, allowing outputs to be truncated down to 512, 256, or 128 dimensions for reduced memory and storage footprints. Trained on approximately 320 billion multilingual tokens across more than 100 languages, the quantized model operates under 200 MB of RAM. In domain-specific evaluations on the MIRIAD dataset, fine-tuning increased NDCG@10 from 0.8340 to 0.8862, outperforming larger baselines.
Context
Text embedding models enable semantic search, clustering, and retrieval across corpora, but on-device use cases and mobile retrieval-augmented generation pipelines require compact, low-latency multilingual models that operate within strict memory constraints.
Approach / What changed
Google adapted the Gemma3 transformer backbone into a bidirectional encoder, adding mean pooling and two dense layers to produce 768-dimensional embeddings. The model was trained on roughly 320 billion tokens covering over 100 languages using Matryoshka Representation Learning, which enables dynamic truncation down to 512, 256, or 128 dimensions while requiring task-specific prompt prefixes during inference.
Takeaways
- EmbeddingGemma contains 308 million parameters, supports a 2048-token context window across more than 100 languages, and consumes under 200 MB of RAM when quantized.
- The architecture modifies Gemma3 from a causal decoder to a bidirectional encoder, using mean pooling and dense layers to yield 768-dimensional embeddings truncatable to 512, 256, or 128 dimensions via Matryoshka Representation Learning.
- Fine-tuning EmbeddingGemma on the MIRIAD medical retrieval dataset boosted retrieval performance from 0.8340 to 0.8862 NDCG@10, exceeding the performance of multiple larger baseline models on the task.
Related reading
huggingface.co ·
Getting Started With Embeddings
Embeddings represent unstructured information such as text and images as numerical vectors in a shared semantic space. To demonstrate their utility, a simple semantic search engine is built over US Social Security Medicare frequently asked questions. The system generates 384-dimensional vector representations for thirteen FAQ entries by dispatching POST requests to the Hugging Face Inference API using the sentence-transformers/all-MiniLM-L6-v2 model. Incoming user queries are converted into matching vector representations and evaluated against stored dataset vectors using the util.semantic_search function from the Sentence Transformers library. By calculating cosine similarity scores, the system retrieves and ranks the five most semantically relevant questions without requiring custom keyword rules or massive labeled training sets.
Omar EspejelSentence Transformers is joining Hugging Face!
Sentence Transformers is officially transitioning its stewardship from the Ubiquitous Knowledge Processing Lab at TU Darmstadt to Hugging Face. The open-source embedding library was introduced in 2019 by Nils Reimers using a Siamese network architecture to overcome standard BERT limitations on sentence-level semantics. Tom Aarsen of Hugging Face has maintained the project since late 2023 and will continue leading its development. Under Hugging Face, the project retains its Apache 2.0 license and leverages infrastructure such as continuous integration and automated testing. Sentence Transformers currently serves over one million monthly unique users, with more than 16,000 community models publicly hosted on the Hugging Face Hub.