HiramKHackenbacker commited on
Commit
05f464d
Β·
verified Β·
1 Parent(s): e274046

model card: standard structure, measured facts, verified license declarations

Browse files
Files changed (1) hide show
  1. README.md +100 -58
README.md CHANGED
@@ -1,8 +1,10 @@
1
  ---
2
  license: gemma
 
3
  base_model: google/embeddinggemma-300m
 
4
  library_name: coreml
5
- pipeline_tag: sentence-similarity
6
  tags:
7
  - coreml
8
  - core-ml
@@ -13,37 +15,36 @@ tags:
13
  - int8
14
  - embeddings
15
  - sentence-embedding
 
 
 
 
 
16
  ---
17
 
18
  # embeddinggemma-300m β€” Core ML (int8, seq 128, ANE)
19
 
20
- `google/embeddinggemma-300m` as a compiled Core ML encoder for Apple silicon, mirrored and
21
  rebuild-verified by [visible-cx](https://huggingface.co/visible-cx). One call in, one 768-d
22
  L2-normalised embedding out.
23
 
24
- **Weights reproduce bit-exactly from the published recipe**: an independent rebuild on a
25
- different OS and CPU architecture produced a `weight.bin` identical to the published one,
26
- SHA-256 `f81f60eb…`, 0 of 308,616,576 bytes differing.
 
 
27
 
28
- ## Provenance
29
-
30
- | | |
31
- |---|---|
32
- | Base checkpoint | `google/embeddinggemma-300m` |
33
- | Upstream bundle | `mlboydaisuke/embeddinggemma-300m-coreml` @ `3fa12f0b97b8afe23264f76800afe14af4615ca5` |
34
- | Recipe | `john-rocky/CoreML-LLM` β†’ `conversion/build_embeddinggemma_bundle.py --max-seq-len 128 --quantize int8` |
35
- | Format | Core ML `.mlmodelc` (compiled), int8 weights |
36
- | Sequence length | **128** (static) |
37
- | Output | 768-d embedding, mean pooling β†’ dense stack β†’ L2 normalise |
38
- | ANE residency | ~99.80%, 1950/1954 ops (upstream published claim, not re-measured here) |
39
-
40
- The mirror was verified byte-exact against upstream on all six files of the published
41
- artifact.
42
 
43
  ## Contents
44
 
45
- **`3fa12f0b97b8afe23264f76800afe14af4615ca5/`** β€” the pinned upstream artifact, byte for
46
- byte, under its upstream revision as the directory name. 309,358,096 B total.
47
 
48
  | File | Bytes |
49
  |---|---:|
@@ -55,8 +56,8 @@ byte, under its upstream revision as the directory name. 309,358,096 B total.
55
  | `model_config.json` | 2,351 |
56
 
57
  **`rebuild-verification/2026-08-17/`** β€” an independent rebuild of the same recipe on a
58
- different operating system and CPU architecture, published so the reproducibility claim can
59
- be checked. 309,346,242 B total.
60
 
61
  | File | Bytes |
62
  |---|---:|
@@ -67,39 +68,50 @@ be checked. 309,346,242 B total.
67
  | `SHA256SUMS` | 427 |
68
  | `VERIFICATION.md` | 2,878 |
69
 
70
- The shapes differ deliberately: the pinned artifact is a **compiled** `.mlmodelc`, the
71
- rebuild is the **uncompiled** `.mlpackage` the recipe emits. Compilation
72
- (`xcrun coremlcompiler`) is a macOS-only step and was not performed on the rebuild host.
73
 
74
- ## Requirements
75
 
76
- - **Apple silicon**, Core ML runtime. The encoder is shaped for the Neural Engine.
77
- - **Static sequence length 128.** Inputs must be padded or truncated to 128 tokens; this is
78
- a compile-time property of the artifact, not a runtime option.
79
- - Weights β‰ˆ 0.31 GB resident. **Minimum practical machine memory: 8 GB.**
80
- - `model_config.json` beside the encoder carries the pooling/dense/normalisation contract
81
- the host must honour: mean pooling β†’ dense stack β†’ L2 normalise, 768-d out.
 
 
 
82
 
83
- Note the sequence-length difference from the Core AI artifact in this org, which is
84
- **seq 256**. The two are not drop-in substitutes for each other.
 
85
 
86
- ## Performance
 
 
 
 
 
 
87
 
88
- **No throughput or latency figure is published here.** The ANE residency figure above is
89
- the upstream published claim, not a measurement made here.
 
90
 
91
- A cross-runtime quality datapoint on record is a cosine of **~0.966** on short text between
92
- this Core ML encoder and the LiteRT `.tflite` of the same base model, measured against
93
- previously installed copies rather than against the files in this repo.
94
 
95
- ## Status
 
96
 
97
- | Artifact | Status |
98
- |---|---|
99
- | `3fa12f0b…/encoder.mlmodelc` + `model_config.json` | **SHIP** β€” byte-exact mirror of the pinned upstream revision, with the `weight.bin` SHA-256 matching and independently reproduced. |
100
- | `rebuild-verification/2026-08-17/encoder.mlpackage` | **VERIFICATION EVIDENCE, not a runtime artifact** β€” uncompiled and never executed. |
 
101
 
102
- ### Verification
103
 
104
  Weights and config reproduce bit-exactly from the recipe, across operating systems and CPU
105
  architectures:
@@ -113,19 +125,49 @@ architectures:
113
 
114
  So the claim is scoped precisely: **everything the recipe produces reproduces exactly; the
115
  remaining four files are a macOS compile step that was not run.** Closing that gap means
116
- compiling `rebuild-verification/2026-08-17/encoder.mlpackage` on a Mac and diffing the
117
- resulting `encoder.mlmodelc` against the pinned artifact.
 
 
 
 
 
 
 
 
 
 
 
 
 
118
 
119
- This is the exception in this org. Core AI `.aimodel` bundles are not byte-reproducible β€”
120
- the exporter is not deterministic even against itself β€” so their integrity rests on
121
- per-file SHA-256 of the exact published bytes. For this artifact, "verify by rebuilding" is
122
- genuinely available for the weights.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
 
124
  ## License
125
 
126
- EmbeddingGemma is Gemma-family. These files are a derivative of
127
- `google/embeddinggemma-300m` and use is subject to the
128
  [Gemma Terms of Use](https://ai.google.dev/gemma/terms) and the
129
- [Gemma Prohibited Use Policy](https://ai.google.dev/gemma/prohibited_use_policy). Those
130
- terms travel with the artifact and with any redistribution of it. The contribution here is
131
- the mirror and the rebuild verification, not the weights.
 
1
  ---
2
  license: gemma
3
+ license_link: https://ai.google.dev/gemma/terms
4
  base_model: google/embeddinggemma-300m
5
+ base_model_relation: quantized
6
  library_name: coreml
7
+ pipeline_tag: feature-extraction
8
  tags:
9
  - coreml
10
  - core-ml
 
15
  - int8
16
  - embeddings
17
  - sentence-embedding
18
+ - sentence-similarity
19
+ extra_gated_heading: Access EmbeddingGemma on Hugging Face
20
+ extra_gated_description: >-
21
+ This artifact is a derivative of google/embeddinggemma-300m and is governed by
22
+ the Gemma Terms of Use, the Gemma Prohibited Use Policy and the Gemma license.
23
  ---
24
 
25
  # embeddinggemma-300m β€” Core ML (int8, seq 128, ANE)
26
 
27
+ `google/embeddinggemma-300m` as a compiled **Core ML** encoder for Apple silicon, mirrored and
28
  rebuild-verified by [visible-cx](https://huggingface.co/visible-cx). One call in, one 768-d
29
  L2-normalised embedding out.
30
 
31
+ **This is the one artifact in this org whose weights reproduce bit-exactly from the published
32
+ recipe.** An independent rebuild on a different operating system and CPU architecture produced a
33
+ `weight.bin` identical to the published one β€” SHA-256 `f81f60eb…`, **0 of 308,616,576 bytes
34
+ differing**. Every Core AI `.aimodel` bundle in this org has to rest on digests instead, because
35
+ that exporter is not deterministic even against itself.
36
 
37
+ > **This is Core ML, not Core AI.** It is an `.mlmodelc` loaded through `MLModel`, and the
38
+ > `CoreAIKitEmbeddings.TextEmbedder` used by the sibling
39
+ > [`visible-cx/embeddinggemma-300m-CoreAI`](https://huggingface.co/visible-cx/embeddinggemma-300m-CoreAI)
40
+ > repo will not load it β€” that type looks for a `*.aimodel` in the bundle directory. Pooling,
41
+ > the dense stack and L2 normalisation are inside this graph, so there is no host-side pooling
42
+ > to implement either way.
 
 
 
 
 
 
 
 
43
 
44
  ## Contents
45
 
46
+ **`3fa12f0b97b8afe23264f76800afe14af4615ca5/`** β€” the pinned upstream artifact, byte for byte,
47
+ under its upstream revision as the directory name. **309,358,096 B** total.
48
 
49
  | File | Bytes |
50
  |---|---:|
 
56
  | `model_config.json` | 2,351 |
57
 
58
  **`rebuild-verification/2026-08-17/`** β€” an independent rebuild of the same recipe on a
59
+ different operating system and CPU architecture, published so the reproducibility claim can be
60
+ checked rather than taken on faith. **309,346,242 B** total.
61
 
62
  | File | Bytes |
63
  |---|---:|
 
68
  | `SHA256SUMS` | 427 |
69
  | `VERIFICATION.md` | 2,878 |
70
 
71
+ The shapes differ deliberately: the pinned artifact is a **compiled** `.mlmodelc`, the rebuild is
72
+ the **uncompiled** `.mlpackage` the recipe emits. Compilation (`xcrun coremlcompiler`) is a
73
+ macOS-only step and was not performed on the rebuild host.
74
 
75
+ ## Provenance
76
 
77
+ | | |
78
+ |---|---|
79
+ | Base checkpoint | `google/embeddinggemma-300m` |
80
+ | Upstream bundle | [`mlboydaisuke/embeddinggemma-300m-coreml`](https://huggingface.co/mlboydaisuke/embeddinggemma-300m-coreml) @ `3fa12f0b97b8afe23264f76800afe14af4615ca5` |
81
+ | Recipe | `john-rocky/CoreML-LLM` β†’ `conversion/build_embeddinggemma_bundle.py --max-seq-len 128 --quantize int8` |
82
+ | Format | Core ML `.mlmodelc` (compiled), int8 weights |
83
+ | Sequence length | **128** (static) |
84
+ | Output | 768-d embedding; mean pooling β†’ dense stack β†’ L2 normalise, all in-graph |
85
+ | ANE residency | ~99.80%, 1950/1954 ops β€” **upstream's published claim, not re-measured here** |
86
 
87
+ The mirror was verified byte-exact against upstream on all six files of the published artifact.
88
+
89
+ ## Requirements
90
 
91
+ - **Apple silicon**, Core ML runtime. The encoder is shaped for the Neural Engine.
92
+ - **Static sequence length 128.** Inputs must be padded or truncated to 128 tokens; this is a
93
+ compile-time property of the artifact, not a runtime option.
94
+ - Weights β‰ˆ 0.31 GB resident. **No KV cache** β€” this is an encoder, so there is no per-token
95
+ memory growth and no context ladder. **Minimum practical machine memory: 8 GB.**
96
+ - `model_config.json` beside the encoder carries the pooling / dense / normalisation contract the
97
+ host must honour.
98
 
99
+ Note the sequence-length difference from the Core AI artifact in this org, which is **seq 256**.
100
+ The two are not drop-in substitutes for each other, and vectors from one should not be compared
101
+ against vectors from the other.
102
 
103
+ ## Measurements
 
 
104
 
105
+ **No throughput or latency figure is published here**, and none has been taken. The ANE residency
106
+ figure above is upstream's published claim, not a measurement made here.
107
 
108
+ One cross-runtime quality datapoint is on record: a cosine of **~0.966** on short text between
109
+ this Core ML encoder and the LiteRT `.tflite` of the same base model β€” measured against
110
+ previously installed copies rather than against the files in this repo, so read it as an
111
+ indication that the two runtimes agree closely on short text, not as a parity gate on these
112
+ bytes.
113
 
114
+ ## Verification
115
 
116
  Weights and config reproduce bit-exactly from the recipe, across operating systems and CPU
117
  architectures:
 
125
 
126
  So the claim is scoped precisely: **everything the recipe produces reproduces exactly; the
127
  remaining four files are a macOS compile step that was not run.** Closing that gap means
128
+ compiling `rebuild-verification/2026-08-17/encoder.mlpackage` on a Mac and diffing the resulting
129
+ `encoder.mlmodelc` against the pinned artifact. `SHA256SUMS` and `VERIFICATION.md` in that folder
130
+ carry the rebuild's own receipts.
131
+
132
+ ## Usage
133
+
134
+ Core ML, no third-party package required. Load the compiled `.mlmodelc` directly and honour the
135
+ contract in `model_config.json`:
136
+
137
+ ```swift
138
+ import CoreML
139
+
140
+ let url = /* …/3fa12f0b97b8afe23264f76800afe14af4615ca5/encoder.mlmodelc */
141
+ let config = MLModelConfiguration()
142
+ config.computeUnits = .cpuAndNeuralEngine // the encoder is shaped for the ANE
143
 
144
+ let encoder = try MLModel(contentsOf: url, configuration: config)
145
+ // inputs: token ids + attention mask, padded/truncated to 128
146
+ // output: a 768-d L2-normalised embedding β€” cosine == dot product
147
+ ```
148
+
149
+ Pooling, the dense stack and normalisation are already in the graph, so the output is directly
150
+ comparable; do not re-normalise or re-pool.
151
+
152
+ Two things to hold onto:
153
+
154
+ - **Pad or truncate to exactly 128 tokens.** The length is compiled in.
155
+ - **Apply EmbeddingGemma's query and document prompt prefixes yourself.** Unlike the Core AI
156
+ sibling β€” where `TextEmbedder` supplies them β€” nothing here does it for you, and embedding a
157
+ query with the document prefix quietly degrades retrieval.
158
+
159
+ ## Status
160
+
161
+ | Artifact | Status |
162
+ |---|---|
163
+ | `3fa12f0b…/encoder.mlmodelc` + `model_config.json` | **SHIP** β€” byte-exact mirror of the pinned upstream revision, with the `weight.bin` SHA-256 matching and independently reproduced. |
164
+ | `rebuild-verification/2026-08-17/encoder.mlpackage` | **VERIFICATION EVIDENCE, not a runtime artifact** β€” uncompiled and never executed. |
165
 
166
  ## License
167
 
168
+ EmbeddingGemma is Gemma-family and the upstream checkpoint is **gated** on Hugging Face. These
169
+ files are a derivative of `google/embeddinggemma-300m` and use is subject to the
170
  [Gemma Terms of Use](https://ai.google.dev/gemma/terms) and the
171
+ [Gemma Prohibited Use Policy](https://ai.google.dev/gemma/prohibited_use_policy). Those terms
172
+ travel with the artifact and with any redistribution of it. The contribution here is the mirror
173
+ and the rebuild verification, not the weights.