Instructions to use lethalbeats/embeddinggemma-2-3.3bpw-multimodal with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use lethalbeats/embeddinggemma-2-3.3bpw-multimodal with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="lethalbeats/embeddinggemma-2-3.3bpw-multimodal")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModel processor = AutoProcessor.from_pretrained("lethalbeats/embeddinggemma-2-3.3bpw-multimodal") model = AutoModel.from_pretrained("lethalbeats/embeddinggemma-2-3.3bpw-multimodal", device_map="auto") - Notebooks
- Google Colab
- Kaggle
EmbeddingGemma-2 Multimodal · 3.3 BPW
EmbeddingGemma-2 quantized to 3.32 bits per weight (294.27 MiB total, 4.82× smaller than BF16), with CPU and CUDA inference for text, image/video, and audio in a shared 768-dimensional embedding space.
| Property | Value |
|---|---|
| Total checkpoint size (all 3 shards) | 294.27 MiB (3.3163 BPW) |
| Total weight size reduction vs BF16 | 79.27% (4.82× smaller vs 1,419.78 MiB) |
| Parameters in full model | 744,371,488 |
| Output dimensions | 768 |
| Similarity | Cosine |
Modular Shards & Lazy Towers
Weights are split into 3 SHA-256-verified safetensors shards. core_text.safetensors stays resident as the shared backbone, while tower_vision.safetensors and tower_audio.safetensors are downloaded and loaded on demand (and can be unloaded to reclaim memory).
| Shard / Modality Combination | Stored Size | BF16 Baseline | Compression vs BF16 | Loading Mode |
|---|---|---|---|---|
core_text.safetensors (Text only) |
90.12 MiB |
516.90 MiB |
5.74× smaller (-82.6%) |
Always resident |
tower_vision.safetensors (Vision tower) |
68.31 MiB |
319.97 MiB |
4.68× smaller (-78.7%) |
Lazy on-demand |
tower_audio.safetensors (Audio tower) |
135.85 MiB |
582.91 MiB |
4.29× smaller (-76.7%) |
Lazy on-demand |
Text + Vision (core_text + tower_vision) |
158.43 MiB |
836.87 MiB |
5.28× smaller (-81.1%) |
Selective / lazy |
Text + Audio (core_text + tower_audio) |
225.97 MiB |
1,099.81 MiB |
4.87× smaller (-79.5%) |
Selective / lazy |
Text + Vision + Audio (All shards) |
294.27 MiB |
1,419.78 MiB |
4.82× smaller (-79.3%) |
Full / lazy |
All combinations share the same core_text.safetensors backbone and projection, so vectors encoded in text-only mode (90.12 MiB) match vision, audio, and full multimodal queries without re-indexing.
Evaluation Results
1. Multimodal End-to-End Benchmarks (vs Base FP32)
Evaluated end-to-end directly from the packed 3-shard checkpoint (294.27 MiB, 3.32 BPW) on frozen held-out test splits against the untouched Base FP32 reference (google/embeddinggemma-2, 2,839.56 MiB FP32 / 1,419.78 MiB BF16):
| Benchmark | Base FP32 | 3.3 BPW Multimodal | Retention vs FP32 |
|---|---|---|---|
FiQA Test (R@10 / R@50) |
68.10% / 89.04% |
65.15% / 84.71% |
95.7% / 95.1% |
FiQA Test (nDCG@10) |
0.6343 |
0.5886 |
92.8% |
| MMLU-Pro STEM (120) | 67.50% |
77.50% |
114.8% |
Flickr8k (T→I / I→T R@1) |
91.0% / 92.0% |
91.0% / 89.0% |
100.0% / 96.7% |
CIFAR-10 (Top-1 / Top-5) |
89.0% / 99.0% |
83.0% / 97.0% (+ms) |
93.3% / 98.0% |
ESC-50 (Top-1 / Top-5) |
18.7% / 52.0% |
19.3% / 49.3% |
103.2% / 94.8% |
Linear CKA (T / V / A) |
1.00 / 1.00 / 1.00 |
0.934 / 0.970 / 0.951 |
>= 0.93 |
2. Blind STEM Domain Routing (core_text, MMLU-Pro Held-Out: 120 Unseen Questions)
Zero-shot cosine similarity between question embeddings (task: classification | query: ) and 6 canonical discipline prototypes (20 unseen questions per discipline):
| Model | Global (120) | CS (20) | Eng (20) | Bio (20) | Chem (20) | Phys (20) | Math (20) |
|---|---|---|---|---|---|---|---|
Base FP32 (google/embeddinggemma-2) |
67.50% (81) |
50.0% |
60.0% |
50.0% |
85.0% |
70.0% |
90.0% |
3.3 BPW Multimodal (core_text) |
77.50% (93) |
90.0% |
70.0% |
65.0% |
85.0% |
75.0% |
80.0% |
| Retention vs FP32 | 114.8% |
180.0% |
116.7% |
130.0% |
100.0% |
107.1% |
88.9% |
Evaluation Scope
- Measured splits: FiQA Test (
131queries /2,048candidate documents, 256-token limit), MMLU-Pro STEM Held-Out (120questions across 6 disciplines, 512-token limit), Flickr8k Test (100image-caption pairs), CIFAR-10 Test (100balanced images, 10 classes), and ESC-50 (15016 kHz mono clips across 50 classes). - Limitations: These are reduced-corpus evaluations. The model is not yet validated on full MTEB/BEIR benchmarks or million-scale production corpora.
- Per-modality
mean_shiftvectors (1.5 KiBeach) were calibrated on strictly disjoint subsets (40Flickr8k pairs for vision,50ESC-50 clips for audio) and can be toggled viaapply_mean_shift.
Quantization
Pure post-training quantization (no end-to-end retraining) combining activation-aware scaling inspired by AWQ, block-64 Walsh-Hadamard rotation inspired by QuaRot with 3-bit Gaussian Lloyd-Max centroids, and Top-K projection surgery inspired by DARE:
- Text backbone (
core_text.safetensors): 3-bit QuaRotH64+ AWQ linear layers, 2-bit asymmetricg128row-gathered token embeddings, and FP16 DAREembedding_projection. - Vision tower (
tower_vision.safetensors): 3-bit QuaRotH64+ AWQ linear layers, 4-bit asymmetricg64position_embedding_table, and an optional1.5 KiBheld-outmean_shiftvector. - Audio tower (
tower_audio.safetensors): 3.5-bit mixed Conformer (4-bit asymmetricg64attention/conv projections, 3-bit QuaRotH64+ AWQ FFN layers) and an optional1.5 KiBheld-outmean_shiftvector.
Runtime Memory
EmbeddingGemma2LazyMultimodal runs directly on CPU or CUDA into standard 768D FP32 vectors (3,072 bytes/vector). The shard sizes above measure stored weights on disk; active runtime memory also includes inference activations, temporary dequantized blocks during layer execution, and approximately 200 to 350 MB of baseline CUDA context overhead when running on GPU (device="cuda"). Text-only mode (modalities=("text",)) does not require Pillow or torchvision. Calling unload_tower("audio") or unload_tower("vision") immediately frees the corresponding tower weights from RAM/VRAM.
Usage
import numpy as np
from PIL import Image
from modeling_embeddinggemma2 import EmbeddingGemma2LazyMultimodal
# Load text backbone only (90.12 MiB, no Pillow/torchvision required)
model = EmbeddingGemma2LazyMultimodal.from_pretrained(
"./embeddinggemma-2-3.3bpw-multimodal", # or HF repo ID
modalities=("text",),
device="cpu", # or "cuda"
verify=True,
)
txt_vec = model.encode_text(
["Quantum mechanics and linear algebra"],
prompt_prefix="task: search result | query: ",
)
# Vision and audio shards load on demand on first call
img_vec = model.encode_image(Image.open("example.jpg"), apply_mean_shift=True)
aud_vec = model.encode_audio(np.zeros(16000, dtype=np.float32), sampling_rate=16000)
# Reclaim memory when media towers are no longer needed
model.unload_tower("audio")
model.unload_tower("vision")
To preload specific modalities upfront:
model = EmbeddingGemma2LazyMultimodal.from_pretrained(repo_id, modalities=("text", "vision"), device="cuda")
# or modalities="all"
Base model: Google DeepMind · EmbeddingGemma-2 · Apache 2.0.
- Downloads last month
- -
Model tree for lethalbeats/embeddinggemma-2-3.3bpw-multimodal
Base model
google/embeddinggemma-2