GemmaEmbed: EmbeddingGemma 2 text, image and audio embeddings in Swift + Metal

I’ve open sourced GemmaEmbed, a Swift package that runs EmbeddingGemma 2 locally on Apple Silicon Macs. It produces text, image and audio embeddings in the same vector space, and can embed an ordered mix of all three as one document.

The package implements its own Metal kernels and runs inference in your app’s process, with no dependencies beyond the Apple SDK. It loads the Q8_0 GGUF weights from ggml-org/embeddinggemma-2-GGUF. The weights are downloaded separately.

The current release is 0.4.0 and requires Swift 6 and macOS 14 or later on Apple Silicon. It includes an async batching API, cancellation between batches, a command-line tool, and 768-dimensional output with truncation to 512, 256 or 128 dimensions. iOS and visionOS support are still on the roadmap.

The README includes text, image, audio and mixed-input examples, output comparisons with llama.cpp, and benchmark methods and limitations. The code is Apache-2.0 licensed; model weights have their own licensing terms.

Repository and installation instructions: GitHub - maralski/gemma-embed-swift: EmbeddingGemma 2 text, image and audio embeddings in-process optimised for Apple Silicon: a dependency-free Swift package with its own Metal kernels · GitHub

I’d welcome feedback from anyone building local search with Gemma, especially on the Swift API and multimodal integration.

1 Like