--- license: gemma base_model: google/embeddinggemma-300m pipeline_tag: feature-extraction tags: - coreml - text-embeddings - sentence-transformers --- # EmbeddingGemma → Core ML This repository contains Core ML conversions of Google's official `embeddinggemma-300m` checkpoint. Each package uses a fixed 512-token input and returns one normalized 768-dimensional embedding. Conversion scripts, validation details, and the evidence trail live in the [source repository](https://github.com/Mannyking/embeddinggemma-coreml). ## Packages | Package | Minimum platform | Saved size | | --- | --- | ---: | | `f32-ios18/EmbeddingGemmaF32.mlpackage` | iOS/iPadOS 18, macOS 15 | 1,235.3 MB | | `f16-ios15/EmbeddingGemmaF16.mlpackage` | iOS/iPadOS 15, macOS 12 | 620.4 MB | | `int4-attention-int8-ios18/EmbeddingGemmaInt4AttentionInt8.mlpackage` | iOS/iPadOS 18, macOS 15 | 216.5 MB | The F32 iOS 18 package is the source for the int4 candidate. The mixed-FP16 package uses FP16 only for `gather` and `linear` operations; attention, normalization, pooling, and outputs remain Float32. The int4 candidate uses per-block int4 linear weights, except attention Q/K/V/output projections, which remain int8. ## Tokenizer and Inputs Tokenizer assets are in [`tokenizer/`](./tree/main/tokenizer). | Name | Type and shape | | --- | --- | | `input_ids` | Int32 `[1, 512]` | | `attention_mask` | Int32 `[1, 512]` | | `embedding` | Float32 `[1, 768]` | Use right padding. Add BOS and EOS tokens; `` is ID 0, `` is ID 1, `` is ID 2, and `` is ID 3. The 512-token limit includes the prompt and special tokens. Use these prompts before tokenization as adviced by The Gemma team: - Query: `task: search result | query: ` - Document: `title: none | text: ` ## Validation The original checkpoint is pinned to [`57c266a740f537b4dc058e1b0cda161fd15afa75`](https://huggingface.co/google/embeddinggemma-300m/tree/57c266a740f537b4dc058e1b0cda161fd15afa75). The saved F32 iOS 18 package passed macOS assessment on ten fixtures, including exact 511- and 512-token inputs; its largest recorded elementwise error against the original-model baseline was `4.34e-7`. The mixed-FP16 package passed its saved-artifact assessment with cosine similarity from `0.999911` to `0.999960` against that baseline. The int4/int8 package is intentionally lossy; its exact 511- and 512-token fixtures had cosine near `0.901` against F32. ### BEIR SciFact Retrieval The F32 and int4/int8 packages were evaluated across 252 eligible SciFact claims and 4,799 abstracts. Records over the fixed 512-token limit were excluded. | Model | Saved size | Recall@1 | Recall@10 | nDCG@10 | MRR@10 | | --- | ---: | ---: | ---: | ---: | ---: | | Core ML F32 | 1,235.3 MB | 0.5742 | 0.8878 | 0.7488 | 0.7102 | | Core ML int4 / attention int8 | 216.5 MB | 0.5671 | 0.8882 | 0.7414 | 0.7037 | This is a quick, single-dataset retrieval check added to catch large quality regressions from conversion or quantization. It is not a broad benchmark, an app-quality claim, or a device-performance result. ## Source and License Based on [google/embeddinggemma-300m](https://huggingface.co/google/embeddinggemma-300m). These packages and tokenizer assets are Gemma model derivatives and are subject to the [Gemma Terms of Use](https://ai.google.dev/gemma/terms).