mlboydaisuke/embeddinggemma-300m-CoreAI

Model

0

stars

7

commits

4

linked in READMEs

Sep 7, 2026

updated

apple-silicon
coreai
coreai-aimodel
feature-extraction
on-device
sentence-similarity

README

Core AI is Apple's on-device ML runtime in iOS 27 / macOS 27 and the successor to Core ML: PyTorch models are exported with Apple's coreai-torch (LLMs: coreai.llm.export) into .aimodel bundles that run on the GPU or the Neural Engine, e.g. Qwen3-8B 4-bit decodes at 94 tok/s on an M4 Max GPU, MLX 90 under the same protocol (apple-silicon-llm-bench, macOS 27 beta, 2026-06).

EmbeddingGemma 300m — Core AI export

google/embeddinggemma-300m as a single static Core AI graph: the full sentence-transformers pipeline (transformer → mean pooling → dense projection → L2 normalize) runs in-graph, so one call returns a normalized 768-d embedding. On-device semantic search / RAG for macOS 27 / iOS 27 beta.

Runs out of the box with CoreAIKit's TextEmbedder:

let embedder = try await TextEmbedder()   // downloads this repo
let doc = try await embedder.embed(document: "Tokyo is the capital of Japan.")
let query = try await embedder.embed(query: "what is the capital of Japan")
let score = TextEmbedder.cosineSimilarity(doc, query)

Retrieval prompt prefixes (task: search result | query: / title: none | text: ) are applied automatically by TextEmbedder.

Bundle layout

model/
├── embeddinggemma-300m_float32_static.aimodel
├── tokenizer/            (HF tokenizer files)
└── reference.json        (torch reference cosines used by the parity test)

Graph contract

nameshapedtype
inputinput_ids[1, 256]int32 (pad id 0, mask 0 over padding)
inputattention_mask[1, 256]int32
outputembedding[1, 768]fp32, L2-normalized

Precision: fp32. Cross-runtime parity vs the torch SentenceTransformer pipeline is exact to 6 decimal places (see reference.json). fp16 variants (full cast AND mixed-precision autocast) produce NaN embeddings on-device — Gemma3 activations overflow half precision — so fp32 is shipped; a smaller int8 variant is future work.

License

Gemma Terms of Use (see the upstream model card). Conversion script: this repo's sibling, based on apple/coreai-models' recipe patterns (BSD-3-Clause).


More models in this format: Core AI Model Zoo — 75 models, each with the recipe that produced it.

Want a different model on-device? Open a request — free, open weights only; the export and its measured numbers get published publicly.

Contributors

mlboydaisuke

7 commits

mlboydaisuke/embeddinggemma-300m-CoreAI

Model

0

stars

7

commits

4

linked in READMEs

Sep 7, 2026

updated

apple-silicon
coreai
coreai-aimodel
feature-extraction
on-device
sentence-similarity

README

Core AI is Apple's on-device ML runtime in iOS 27 / macOS 27 and the successor to Core ML: PyTorch models are exported with Apple's coreai-torch (LLMs: coreai.llm.export) into .aimodel bundles that run on the GPU or the Neural Engine, e.g. Qwen3-8B 4-bit decodes at 94 tok/s on an M4 Max GPU, MLX 90 under the same protocol (apple-silicon-llm-bench, macOS 27 beta, 2026-06).

EmbeddingGemma 300m — Core AI export

google/embeddinggemma-300m as a single static Core AI graph: the full sentence-transformers pipeline (transformer → mean pooling → dense projection → L2 normalize) runs in-graph, so one call returns a normalized 768-d embedding. On-device semantic search / RAG for macOS 27 / iOS 27 beta.

Runs out of the box with CoreAIKit's TextEmbedder:

let embedder = try await TextEmbedder()   // downloads this repo
let doc = try await embedder.embed(document: "Tokyo is the capital of Japan.")
let query = try await embedder.embed(query: "what is the capital of Japan")
let score = TextEmbedder.cosineSimilarity(doc, query)

Retrieval prompt prefixes (task: search result | query: / title: none | text: ) are applied automatically by TextEmbedder.

Bundle layout

model/
├── embeddinggemma-300m_float32_static.aimodel
├── tokenizer/            (HF tokenizer files)
└── reference.json        (torch reference cosines used by the parity test)

Graph contract

nameshapedtype
inputinput_ids[1, 256]int32 (pad id 0, mask 0 over padding)
inputattention_mask[1, 256]int32
outputembedding[1, 768]fp32, L2-normalized

Precision: fp32. Cross-runtime parity vs the torch SentenceTransformer pipeline is exact to 6 decimal places (see reference.json). fp16 variants (full cast AND mixed-precision autocast) produce NaN embeddings on-device — Gemma3 activations overflow half precision — so fp32 is shipped; a smaller int8 variant is future work.

License

Gemma Terms of Use (see the upstream model card). Conversion script: this repo's sibling, based on apple/coreai-models' recipe patterns (BSD-3-Clause).


More models in this format: Core AI Model Zoo — 75 models, each with the recipe that produced it.

Want a different model on-device? Open a request — free, open weights only; the export and its measured numbers get published publicly.

Contributors

mlboydaisuke

7 commits