Skip to main content

Model guide

EmbeddingGemma 300M

EmbeddingGemma 300M is a compact multilingual model for document search, similarity and classification features. It creates vectors rather than chat answers, so choose it as the retrieval part of a workflow. Keep chunks within its input limit and preserve the documented query and document formatting.

0.31BEmbedding2,048 token contextView the model card →

At a glance

Parameters
0.31B
Accepts
Text
Returns
Vectors
Published context limit
2,048 tokens
Model format
safetensors · GGUF
Software and download hosts
Ollama · sentence-transformers · TEI. Follow the exact setup below; this list does not establish support for every format, input type or software version.
Model-weight download
1.21 GB of F32 weights · native workflow
Languages
100+ languages
License
Gemma

Record memory while indexing a batch of your usual passage length. Time one query separately.

Best for

  • Build a searchable index of short text passages on-device. Keep each input within the 2,048-token limit and inspect the first retrieved passage.

Choose something else when

  • For images, use a multimodal embedding model. EmbeddingGemma accepts text.

Using this model for document search

Select this model for the document-search step in an app that supports it. Keep the model that generates answers separate. Check document chunk length and any required query or document prefixes in the model’s instructions.

Changing the embedding model changes the document vectors. Rebuild the document index rather than mixing vectors from different models.

First setup

EmbeddingGemma is a 308-million-parameter text embedding model, not a chat model. For an app-based start, download it with ollama pull embeddinggemma, keep Ollama running, then enter this in PowerShell:

$body = @{model='embeddinggemma'; input=@('The meeting starts at 10:30.')} | ConvertTo-Json
$result = Invoke-RestMethod -Uri http://localhost:11434/api/embed -Method Post -ContentType 'application/json' -Body $body
$result.embeddings[0].Count

Expect a numeric vector (768 values with the standard package), not prose. The model's 2,048-token limit applies to each chunk. For query/document retrieval with automatic prompts, accept Google's model license on Hugging Face, sign in using hf auth login if access is requested, and install sentence-transformers:

from sentence_transformers import SentenceTransformer
model = SentenceTransformer("google/embeddinggemma-300m", device="cpu")
query = model.encode_query(["When does the meeting start?"])
documents = model.encode_document(["The meeting starts at 10:30.", "Lunch is at noon."])
print(model.similarity(query, documents))

The CPU example uses float32; use float32 or bfloat16, not float16. Google's sub-200 MB quantized deployment example is not the memory requirement of this Python program. The model can be used on CPU; a document collection and its index require additional memory and storage. If access is denied, resolve the license/account permission rather than retrying a different model name.

Save the Python example as example.py, then run python example.py in the environment where you installed its packages. The first run downloads model files; later local execution still needs the cached files. Start with these short inputs and batch size 1. If loading runs out of memory, close other model processes or use a smaller model; do not interpret missing output as an empty search result. See the publisher model card for the full workflow.

Other models for this task