In-browser Semantic Search with EmbeddingGemma
A browser-only demo that runs Google's EmbeddingGemma model through Transformers.js to rank a set of documents against a search query by semantic similarity, with no server and no data leaving the device.
This project demonstrates semantic search entirely in the browser, using the EmbeddingGemma model through Transformers.js so no document or query is sent to a remote server. A user adds documents in a documents section, enters a query, and the application computes embeddings for the query and every document, then ranks the documents by similarity.
After a search, the application visualizes the embedding vectors for the query and each document as a grid of colored squares, showing only the first 128 of each vector's values, since EmbeddingGemma is a Matryoshka model whose embeddings can be truncated to a smaller dimension with only a small accuracy cost. By default the model files are fetched from the Hugging Face Hub, though the application can also be configured to use a local model.