EmbeddingGemma 2
Embed text, images, audio, and video into one vector space with EmbeddingGemma 2
EmbeddingGemma 2 (google/embeddinggemma-2:bf16-safetensors-bundle-v1) is Antfly's default embedder. It embeds text, images, audio, video,
and ordered combinations of them into one vector space. Use it when a single
index should hold mixed media, or when you want one embedding per document
rather than one per part. Antfly runs it on CPU, Metal, and CUDA (Ampere or
newer).
Pull the model
antfly inference pull hf:google/embeddinggemma-2:bf16-safetensors-bundle-v1
The weights keep their upstream license.
Embed
Flat inputs return one vector per text or media part. A group returns one vector
for all of its ordered content. Post this to /ai/v1/embed:
{
"model": "google/embeddinggemma-2:bf16-safetensors-bundle-v1",
"task_type": "RETRIEVAL_DOCUMENT",
"dimensions": 256,
"input": [
{
"title": "Account recovery",
"content": [
{"type": "text", "text": "How to reset a forgotten password."},
{"type": "image_url", "image_url": {"url": "https://example.com/reset.png"}}
]
}
]
}
dimensionsis 768 (default), 512, 256, or 128.task_typeisRETRIEVAL_DOCUMENT(default),RETRIEVAL_QUERY,QUESTION_ANSWERING,FACT_VERIFICATION,CODE_RETRIEVAL_QUERY,SEMANTIC_SIMILARITY,CLASSIFICATION, orCLUSTERING. Index with the document role and search with the query role; Antfly does this automatically for index embedders.titleapplies only toRETRIEVAL_DOCUMENTgroups that contain text.- A request holds up to 64 groups of up to 64 parts, and a group must fit 8192 tokens including expanded media. Inputs that overflow fail rather than truncate.
- Video (MP4, MOV, or WebM) goes in a group as a
mediapart and is sampled at 1 FPS, up to 32 frames. CUDA video needs Linux NVDEC and an H.264 MP4 of at most 60 seconds.
From the CLI, point antfly inference embed at the installed model directory:
MODEL_DIR=$(ls -d ~/.antfly/inference/models/google/embeddinggemma-2--antfly-*)
antfly inference embed "$MODEL_DIR" --group \
--title 'Account recovery' --dimensions 256 \
--text 'Reset a forgotten password.' --image reset.png
CPU services
Native F32 text and image serving was qualified on the ARM GB10 reference host.
Select native for CPU preloads and pin the returned CPU identity; CUDA uses a
different recipe identity. On this host, the ten-minute text soak reached
11.5 queries/sec at four clients (386 ms p95); images reached 0.44 images/sec
at two clients (4.75 s p95). The first image took about 20 s after model preload,
so prewarm with an image when warm-image latency matters. See the qualification
note for resource budgets and tested inputs. x86, hard pod CPU/memory limits,
and mixed text/image latency guarantees require separate qualification.
Pin the model in an index
Each response includes a model_identity hash for the exact weights, processor,
and execution recipe. Set it as the index embedder's model_identity so that a
different model generation is rejected instead of silently mixing vectors.
Rebuild the index when you change models, dimensions, or task profile.
Similarity decisions
EmbeddingGemma 2 can answer choice and multi_choice questions on
/ai/v1/decisions with decision_method: "embedding_similarity": each choice is
a description or a few examples, and the answer reports cosine similarities and
a margin. Scores are similarities, not probabilities; set min_similarity,
min_margin, or similarity_thresholds from your own evaluation. See
Typed Decisions for the request format, batches, and
SQL use.
Qualification evidence and benchmarks are in the EmbeddingGemma 2 history.