CoolFace
Modelpublic

Mannyking/embeddinggemma-coreml

sourceHugging Facegemmaupdated 5d agoView on Hugging Face
0likes20downloads
Model Card

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.

Packages

PackageMinimum platformSaved size
f32-ios18/EmbeddingGemmaF32.mlpackageiOS/iPadOS 18, macOS 151,235.3 MB
f16-ios15/EmbeddingGemmaF16.mlpackageiOS/iPadOS 15, macOS 12620.4 MB
int4-attention-int8-ios18/EmbeddingGemmaInt4AttentionInt8.mlpackageiOS/iPadOS 18, macOS 15216.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/`.

NameType and shape
input_idsInt32 [1, 512]
attention_maskInt32 [1, 512]
embeddingFloat32 [1, 768]

Use right padding. Add BOS and EOS tokens; <pad> is ID 0, <eos> is ID 1, <bos> is ID 2, and <unk> 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`.

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.

ModelSaved sizeRecall@1Recall@10nDCG@10MRR@10
Core ML F321,235.3 MB0.57420.88780.74880.7102
Core ML int4 / attention int8216.5 MB0.56710.88820.74140.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. These packages and tokenizer assets are Gemma model derivatives and are subject to the Gemma Terms of Use.