← All models Β· EmbeddingGemma

use case Β· practical

Practical: on-device search, and how small the vectors can get

Semantic search over your own passages, entirely in the browser: EmbeddingGemma embeds each passage once (as a document), your query once (as a query), and ranks by cosine. The twist is the Matryoshka slider β€” drop the stored vector from 768 down to 128 dimensions and see the ranking barely change. That is the on-device win: a 4–6Γ— smaller index with almost the same results.

768 β†’ 512 β†’ 256 β†’ 128. Re-ranks instantly from the cached full vectors; no re-embedding.

Everything here is local: the corpus never leaves the tab, the vectors live in memory, and the slider re-ranks from the cached 768-d vectors by truncating + re-normalizing β€” so you're comparing the exact same embeddings at different budgets. In a real app you would store the truncated vectors in IndexedDB.

← Basics Β· EmbeddingGemma Β· Next: Wild β†’