On-Device Semantic Search on iPhone with Core ML and EmbeddingGemma
Run semantic search fully on-device on iOS: convert EmbeddingGemma to Core ML, store vectors with SimilaritySearchKit, quantize to fit memory.
Topic
Models, dimensions, caching, and fine-tuning the representations retrieval runs on.
Run semantic search fully on-device on iOS: convert EmbeddingGemma to Core ML, store vectors with SimilaritySearchKit, quantize to fit memory.
Matryoshka Representation Learning packs meaning into early dimensions so you can truncate one embedding to many sizes for fast, cheap retrieval.
Add sparse/keyword search to dense embeddings only when your eval shows lexical misses on IDs, rare terms, acronyms, code, or names.
Pick an embedding model and dimension by trading MTEB quality against RAM, latency, and re-embedding cost — with a decision tree.
On normalized embeddings all three metrics rank identically, so pick dot product for speed; magnitude only matters with unnormalized vectors.
The common chunking approaches for retrieval, when each one helps, and the tradeoffs — a quick reference you can come back to.