mlboydaisuke commited on
Commit
1af9c5f
·
verified ·
1 Parent(s): 1f8a297

Add files using upload-large-folder tool

Browse files
Files changed (9) hide show
  1. LICENSE +202 -0
  2. NOTICE +19 -0
  3. README.md +140 -0
  4. RELEASE.md +131 -0
  5. SHA256SUMS +9 -0
  6. reader.pt +3 -0
  7. reader_config.json +79 -0
  8. vocab.txt +0 -0
  9. word_table.npy +3 -0
LICENSE ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
NOTICE ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ EmbeddingGemma-2-Transcribe-Reader — NOTICE
2
+
3
+ This repository holds reader v1 of EmbeddingGemma 2 Transcribe, licensed under the Apache License, Version 2.0
4
+ (see LICENSE).
5
+
6
+ - reader.pt: reader weights trained by mlboydaisuke (john-rocky), 2026-10, with CTC on LibriSpeech train-clean-100:
7
+ V. Panayotov, G. Chen, D. Povey, S. Khudanpur, "Librispeech: an ASR corpus based on public domain audio books",
8
+ ICASSP 2015, https://www.openslr.org/12, licensed under CC BY 4.0
9
+ (https://creativecommons.org/licenses/by/4.0/). The audio is not redistributed here.
10
+ - word_table.npy: text embeddings of the vocabulary words computed with EmbeddingGemma 2
11
+ (google/embeddinggemma-2, revision 914f7f89142e33e77833254d9c9b90c3cef7303b, Google DeepMind), licensed under the
12
+ Apache License, Version 2.0. Deployments of EmbeddingGemma 2 must adhere to the Gemma Prohibited Use Policy
13
+ (https://ai.google.dev/gemma/prohibited_use_policy).
14
+ - vocab.txt: the words of the LibriSpeech lexicon (https://www.openslr.org/11, public domain), lower case.
15
+ - The reader reads soft tokens produced by the EmbeddingGemma 2 audio encoder, which is not part of this repository.
16
+
17
+ Code: the reader/train directory of the eg2-transcribe repository (train.py, model.py, make_table.py, eval_wer.py).
18
+
19
+ Keep this NOTICE together with the LICENSE file when redistributing.
README.md ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ pipeline_tag: automatic-speech-recognition
6
+ base_model: google/embeddinggemma-2
7
+ base_model_relation: adapter
8
+ datasets:
9
+ - openslr/librispeech_asr
10
+ tags: [embeddinggemma, speech-recognition, ctc, word-embeddings, on-device, core-ai, litert]
11
+ ---
12
+
13
+ # EmbeddingGemma 2 Transcribe — reader v1
14
+
15
+ A 13.3 M-parameter reader that turns the audio soft tokens of Google's
16
+ [EmbeddingGemma 2](https://huggingface.co/google/embeddinggemma-2) into English words: each 40 ms token is mapped
17
+ into the model's 768-d text-embedding space and read as the closest of 200,000 words, or as blank, with greedy CTC
18
+ decoding and no language model. The EmbeddingGemma 2 encoder stays frozen; only the reader is trained.
19
+
20
+ The idea comes from Shahir's post (2026-10-13) and the *Embedding Gemma Transcribe* Mac app (eg2.haku.sh), whose
21
+ code and weights are not public. This reader is an independent reproduction, trained from scratch on LibriSpeech. It
22
+ is not affiliated with Google.
23
+
24
+ These weights are framework-neutral (a PyTorch state dict and a NumPy table). The converted builds that run them on
25
+ a device:
26
+
27
+ | Build | Repository |
28
+ |---|---|
29
+ | Core AI (iOS 27 / macOS 27): the EmbeddingGemma 2 audio encoder and this reader with its word table, as `.aimodel` bundles | [mlboydaisuke/EmbeddingGemma-2-Transcribe-CoreAI](https://huggingface.co/mlboydaisuke/EmbeddingGemma-2-Transcribe-CoreAI) |
30
+ | LiteRT (Android) | [mlboydaisuke/EmbeddingGemma-2-Transcribe-LiteRT](https://huggingface.co/mlboydaisuke/EmbeddingGemma-2-Transcribe-LiteRT) |
31
+
32
+ ## Files
33
+
34
+ | File | Bytes | SHA-256 | What |
35
+ |---|---:|---|---|
36
+ | `reader.pt` | 53,095,605 | `67a06a857b9aeb066347f8947e4faeed11d2ec3e89e0c23974be0a2c20243d5b` | the reader: a PyTorch `state_dict`, float32 |
37
+ | `word_table.npy` | 307,200,128 | `b2d0b13cc70c492f1444b8a42deab437d25254eac47d752d777d27b65377faa8` | float16 `[200000, 768]`, one L2-normalized row per word |
38
+ | `vocab.txt` | 1,737,588 | `bb3b3c70379082333e1bbd90d07ca69fe5c0096bd1c3b2b3f83edd65f1062a68` | the 200,000 words, one per line; the line number is the word index |
39
+ | `reader_config.json` | 2,019 | `68efaabae4c2eaa8ae2a5abf8f85fab115791b13178ee3a22e57a0cec727b94e` | the contract for ports: input, output, logits, decoding, the window policy, the WER |
40
+ | `RELEASE.md` | 12,584 | | the release note: WER details, the reader's output on the 20 fixture utterances, training log, weaknesses |
41
+
42
+ `SHA256SUMS` lists every file. `RELEASE.md` is the release note of the `reader/` directory of the [eg2-transcribe](https://github.com/john-rocky/eg2-transcribe)
43
+ repository; the paths in it (`train/`, `fixtures/`) are relative to that directory.
44
+
45
+ ## Contract
46
+
47
+ - **Input**: EmbeddingGemma 2 audio soft tokens, float32 `[T, 512]`, 25 per second: the `embed_audio` output of
48
+ `google/embeddinggemma-2` at revision `914f7f89142e33e77833254d9c9b90c3cef7303b`
49
+ (`model.get_audio_features(input_features, input_features_mask).pooler_output`; transformers 5.19.0 with the
50
+ default attention, not `eager`, whose audio mask is inverted in that version).
51
+ - **Body**: LayerNorm → Linear 512→512, 4 pre-LayerNorm transformer layers (width 512, 8 heads, FFN 2048 with GELU,
52
+ rotary positions with base 10000), LayerNorm → Linear 512→768. Attention covers the whole input window in both
53
+ directions. 13,268,994 parameters.
54
+ - **Output per token**: a unit vector in the 768-d text space and a blank logit.
55
+ - **Logits**: word `w` scores `scale × cos(vector, word_table[w])`, with `scale = exp(log_scale) = 91.218`
56
+ (learned); blank is class 200,000 and scores `blank_logit`.
57
+ - **Decoding**: per token, blank where `blank_logit > top-1 word logit` (a tie reads the word), else the top-1 word;
58
+ merge repeats, drop blanks. No language model, no punctuation, no casing.
59
+ - **Long audio**: 30 s encoder windows (750 tokens), each starting 96 tokens (3.84 s) before the end of the previous
60
+ one, keeping only its new tokens and dropping its last token: the encoder is causal, so the start of a window lacks
61
+ its left context and the last token of a 30 s cut misses one input frame. `reader_config.json` → `window`.
62
+ - **Weights file**: `reader.pt` keys `body.*` (the reader body), `blank.weight [1, 768]`, `blank.bias [1]`,
63
+ `log_scale`; the module is `Reader(arch, n_vocab, k)` of `reader/train/model.py` in the eg2-transcribe repository
64
+ (arch `a`).
65
+
66
+ ## WER
67
+
68
+ Greedy, no language model, every utterance of each set. Reference and hypothesis are lower-cased with runs of spaces
69
+ collapsed; words outside the vocabulary stay in the references and count as errors.
70
+
71
+ | Set | Utterances | Reference words | WER | Substitutions | Deletions | Insertions |
72
+ |---|---:|---:|---:|---:|---:|---:|
73
+ | dev-clean (model selection) | 2,703 | 54,402 | 6.57 % | 2,823 | 375 | 374 |
74
+ | dev-other | 2,864 | 50,948 | 14.93 % | 5,885 | 1,089 | 631 |
75
+ | test-clean | 2,620 | 52,576 | 6.81 % | 2,789 | 412 | 378 |
76
+ | test-other | 2,939 | 52,343 | 15.10 % | 6,040 | 1,141 | 724 |
77
+ | fixtures `test-clean-20` | 20 | 541 | 4.81 % | 22 | 1 | 3 |
78
+
79
+ On a 3,257.4 s LibriVox recording (*The Adventure of the Speckled Band*), read in 125 windows of 30 s as above through
80
+ the Core AI build on an Apple M4 Max, the WER against the Project Gutenberg text is 5.80 %, next to 5.78 % for the
81
+ float32 PyTorch path on the same windows (9,889 reference words; the LibriVox intro and outro are in the audio only).
82
+
83
+ ## Training
84
+
85
+ - Data: LibriSpeech train-clean-100 (CC BY 4.0), 28,539 utterances, 100.65 h. The 2,117 utterances with a word
86
+ outside the vocabulary were left out: 26,422 utterances, 92.8 h, 8,351,376 tokens. Soft tokens computed once in
87
+ float32, stored as float16.
88
+ - dev-clean chose the reader body and the epoch; test-clean and test-other were decoded once, after training.
89
+ - Objective: CTC over the 200,000 words and blank (`torch.nn.functional.ctc_loss`, float32, `zero_infinity`, mean of
90
+ loss / target length).
91
+ - Optimizer: AdamW, peak learning rate 0.0003, weight decay 0.01 on matrices, 500 warmup steps, then cosine to zero at
92
+ step 16,520; batches of 16 utterances bucketed by length; gradient clipping 1.0; float32 throughout.
93
+ - 8 epochs, 13,216 steps; the best dev-clean WER came at epoch 8 (these weights). Training stopped on its active-time
94
+ budget (2.72 h of 3.0 h).
95
+ - Hardware: one Apple M4 Max (128 GB), torch 2.11.0 on MPS, macOS 27.0 (26A428); 3.64 h of wall clock, 1.02 h of it
96
+ paused while other jobs measured on the same Mac.
97
+ - Body chosen after one epoch each of three candidates on dev-clean: a 4-layer transformer from scratch (13.48 %, this
98
+ one), EmbeddingGemma 2 text layers 0–3 (14.60 %), a per-token MLP (25.21 %).
99
+
100
+ The command that continued the chosen body, from the `reader/train/` directory of the eg2-transcribe repository:
101
+
102
+ ```sh
103
+ mkdir -p runs/v1 && cp runs/cmp_a/ckpt_epoch1.pt runs/v1/
104
+ for e in $(seq 2 10); do # one process per epoch
105
+ .venv/bin/python -I train.py --arch a --cache cache --vocab ../vocab.txt --table ../word_table.npy \
106
+ --run-dir runs/v1 --resume runs/v1/ckpt_epoch$((e - 1)).pt --epochs $e --schedule-epochs 10 \
107
+ --max-hours 3 --patience 2 || break
108
+ [ "$(jq -r .stop_reason runs/v1/metrics.json)" = "reached $e epochs" ] || break # early stop or budget
109
+ done
110
+ ```
111
+
112
+ ## Word table
113
+
114
+ - `vocab.txt`: every word of the LibriSpeech lexicon (openslr.org/resources/11, public domain), lower case, sorted by
115
+ code point, apostrophes kept.
116
+ - `word_table.npy`: the EmbeddingGemma 2 text embedding of each word with the prompt `task: search result | query: `
117
+ (sentence-transformers, float32, then stored as float16 and L2-normalized). Each of 100 random words, embedded
118
+ again, comes back at rank 1.
119
+ - Out of vocabulary: test-clean 220 of 52,576 words (0.42 %), test-other 283 of 52,343 (0.54 %). These are always
120
+ errors.
121
+
122
+ ## Limits
123
+
124
+ - By word length: on 2,518 aligned words of 100 test-clean utterances, the word error rate is 2.8 % for words of 1–2
125
+ tokens (up to 80 ms), 3.4 % for 3–5 tokens and 9.7 % for 6 or more.
126
+ - The most frequent substitutions on test-clean are function words (in → and 41, and → in 39, the → a 20); homophones
127
+ are 12.4 % of all substitutions, which a reader without a language model cannot tell apart.
128
+ - English read speech only (audiobooks); trained on utterances of up to 24.5 s and measured on utterances of up to
129
+ 35.2 s; longer audio goes through the 30 s windows above.
130
+
131
+ ## License and credits
132
+
133
+ - This repository: Apache-2.0 (`LICENSE`); see `NOTICE`.
134
+ - LibriSpeech: V. Panayotov, G. Chen, D. Povey, S. Khudanpur, "Librispeech: an ASR corpus based on public domain
135
+ audio books", ICASSP 2015, https://www.openslr.org/12, CC BY 4.0. The reader weights are trained on
136
+ train-clean-100.
137
+ - LibriSpeech lexicon: https://www.openslr.org/11, public domain.
138
+ - EmbeddingGemma 2 (`google/embeddinggemma-2`, Google DeepMind): Apache 2.0. It produces the soft tokens the reader
139
+ reads and the word table. Deployments must adhere to the
140
+ [Gemma Prohibited Use Policy](https://ai.google.dev/gemma/prohibited_use_policy).
RELEASE.md ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Reader v1
2
+
3
+ Released 2026-10-14. Reads EmbeddingGemma 2 audio soft tokens as words. Greedy decoding, no language model: **test-clean WER 6.81 %, test-other WER 15.10 %**.
4
+
5
+ Pre-registered v1 line: test-clean <= 10 % and test-other <= 20 % (greedy, no LM). test-clean meets it (6.81 %), test-other meets it (15.10 %).
6
+
7
+ ## Files
8
+
9
+ | File | Bytes | SHA-256 |
10
+ |---|---:|---|
11
+ | `vocab.txt` | 1,737,588 | `bb3b3c70379082333e1bbd90d07ca69fe5c0096bd1c3b2b3f83edd65f1062a68` |
12
+ | `word_table.npy` | 307,200,128 | `b2d0b13cc70c492f1444b8a42deab437d25254eac47d752d777d27b65377faa8` |
13
+ | `reader.pt` | 53,095,605 | `67a06a857b9aeb066347f8947e4faeed11d2ec3e89e0c23974be0a2c20243d5b` |
14
+ | `reader_config.json` | 2,019 | `68efaabae4c2eaa8ae2a5abf8f85fab115791b13178ee3a22e57a0cec727b94e` |
15
+
16
+ `reader.pt` and `word_table.npy` are ignored by git (`*.pt`, `*.npy` in `.gitignore`); the SHA-256 above identifies them. `reader_config.json` is the contract for ports: input, output, logits, decoding and the 30 s window policy of the encoder.
17
+
18
+ ## What the reader is
19
+
20
+ - Input: EmbeddingGemma 2 audio soft tokens, float32 `[T, 512]`, 25 per second (`embed_audio` output of `google/embeddinggemma-2` revision 914f7f89; the encoder is frozen).
21
+ - Body: a bidirectional transformer encoder trained from scratch: LayerNorm -> Linear 512->512, 4 pre-LayerNorm layers (d 512, 8 heads, FFN 2048 GELU, rotary (base 10000) positions), LayerNorm -> Linear 512->768. Attention covers the whole input. 13,268,994 parameters in total.
22
+ - Output per token: a unit vector in the 768-d text space and a blank logit. Logits over the 200,000 words = scale x cosine to `word_table.npy`, scale = 91.218 (learned); blank is class N. Decoding: argmax per token, merge repeats, drop blanks.
23
+
24
+ ## WER
25
+
26
+ Greedy, no language model, every utterance of each set. Normalization of reference and hypothesis: lower case, runs of spaces collapsed, nothing else (LibriSpeech transcripts have no punctuation and keep apostrophes). Words outside the vocabulary stay in the references and count as errors.
27
+
28
+ | Set | Utterances | Reference words | WER | Substitutions | Deletions | Insertions |
29
+ |---|---:|---:|---:|---:|---:|---:|
30
+ | dev-clean (model selection) | 2,703 | 54,402 | 6.57 % | 2,823 | 375 | 374 |
31
+ | dev-other | 2,864 | 50,948 | 14.93 % | 5,885 | 1,089 | 631 |
32
+ | test-clean | 2,620 | 52,576 | 6.81 % | 2,789 | 412 | 378 |
33
+ | test-other | 2,939 | 52,343 | 15.10 % | 6,040 | 1,141 | 724 |
34
+ | fixtures `test-clean-20` | 20 | 541 | 4.81 % | 22 | 1 | 3 |
35
+
36
+ The fixture row decodes `fixtures/test-clean-20/<id>/soft_tokens.npy` (the float32 CPU reference soft tokens). The reader's output on each of them, for comparing ports of the reader:
37
+
38
+ | Utterance | Word errors | Reader output |
39
+ |---|---:|---|
40
+ | `1089-134686-0000` | 2 / 28 | he hoped there would be stew for dinner turnips and carrots and bruised potatoes and fat muttered pieces to be ladled out in thick peppered flour fatten sauce |
41
+ | `1089-134686-0002` | 3 / 18 | after early nightfall fall all the yellow lamps would light up here and there the squalid quarter of the brawls |
42
+ | `1188-133604-0000` | 2 / 19 | you will find me continually speaking of four men tion sublime turner and tintoret in almost the same terms |
43
+ | `1188-133604-0001` | 2 / 18 | the unite every quality and sometimes you will find me referring to them as colorists sometimes as curio |
44
+ | `121-121726-0000` | 2 / 17 | also a popular can drives whereby love making may be suspended but not stopped during the picnic season |
45
+ | `121-121726-0001` | 1 / 8 | hurrah the tiresome product of a tireless tongue |
46
+ | `1221-135766-0000` | 1 / 37 | how strange it seemed to the sad woman as she watched the growth and the beauty that became every day more brilliant and the intelligence that through its quivering sunshine over the tiny features of this child |
47
+ | `1221-135766-0001` | 2 / 48 | god as a direct consequence of the sin which man thus punished had given her a lovely child whose place was on that same dishonored bottom to connect her parent for ever with the race and descent of mortals and to be finally a blessed soul in heaven |
48
+ | `1284-1180-0000` | 0 / 24 | he wore blue silk stockings blue knee pants with gold buckles a blue ruffled waist and a jacket of bright blue braided with gold |
49
+ | `1284-1180-0001` | 1 / 26 | his hat had a peaked crown at a flat brim and around the brim was a row of tiny golden bells that tinkled when he moved |
50
+ | `1320-122612-0000` | 1 / 41 | since the period of art tale the active spirit of the country has surrounded it with a belt of rich and thriving settlements though none but the hunter or the savage is ever known even now to penetrate its wild recesses |
51
+ | `1320-122612-0001` | 0 / 30 | the dews were suffered to exhale and the sun had dispersed the mists and was shedding a strong and clear light in the forest when the travelers resumed their journey |
52
+ | `1580-141083-0000` | 2 / 30 | i will endeavor in my statement to avoid such terms as would serve to limit the events to any particular place or give a clew as to the people concerned |
53
+ | `1580-141083-0001` | 0 / 34 | i had always known him to be restless in his manner but on this particular occasion he was in such a state of uncontrollable agitation that it was clear something very unusual had occurred |
54
+ | `1995-1826-0000` | 0 / 27 | in the debate between the senior societies her defence of the fifteenth amendment had been not only a notable bit of reasoning but delivered with real enthusiasm |
55
+ | `1995-1826-0001` | 1 / 27 | the south she had not thought of seriously and yet knowing of its delightful hospitality and mild climate she was not averse to charlestown or new orleans |
56
+ | `2094-142345-0001` | 0 / 21 | but the windows are patched with wooden panes and the door i think is like the gate it is never opened |
57
+ | `2094-142345-0002` | 2 / 42 | for it is a solid heavy handsome door and must once have been in the habit of shedding with a sonorous bang behind the liveried lackey who had just seen his master and mistress off the grounds in a carriage and pair |
58
+ | `2300-131720-0000` | 1 / 13 | the paris plant like that of the crystal palace was a temporary exhibit |
59
+ | `2300-131720-0001` | 3 / 33 | the london plat was last temporary but not permanent supplying before it was torn out no fewer than three thousand lamps in hotels churches stores and dwellings in the vicinity of holborn |
60
+
61
+ ## Training
62
+
63
+ - Data: LibriSpeech train-clean-100 (CC BY 4.0), 28,539 utterances, 100.65 h. The 2,117 utterances with a word outside the vocabulary were left out: 26,422 utterances, 92.8 h, 8,351,376 tokens. Soft tokens computed once (float32, stored float16).
64
+ - Dev: dev-clean, used for the choice of the reader body and for early stopping. test-clean and test-other were decoded once, after training.
65
+ - Objective: CTC over the 200,000 words + blank (`torch.nn.functional.ctc_loss`, float32, zero_infinity, mean of loss / target length).
66
+ - Optimizer: AdamW, peak learning rate 0.0003, weight decay 0.01 on matrices, linear warmup over 500 steps, then cosine to zero at step 16,520, batch 16 utterances bucketed by length, gradient clipping 1.0, float32 throughout.
67
+ - Length: 8 epochs, 13,216 steps; best dev-clean WER at epoch 8 (the released weights). Stop: active-time budget: 2.72 h used over 8 epochs, one more (~0.34 h) would pass 3.0 h.
68
+ - Time: 3.64 h of training wall clock (1.02 h of it paused while other jobs measured on the same Mac) plus 6 min of dev decoding. Apple M4 Max (128 GB), torch 2.11.0 MPS, macOS 27.0 (26A428).
69
+
70
+ | Epoch | Steps | Train loss (last 100) | dev-clean WER | Wall (min) | Paused (min) |
71
+ |---:|---:|---:|---:|---:|---:|
72
+ | 1 | 1,652 | 1.103 | 13.48 % | 22.2 | 3.0 |
73
+ | 2 | 3,304 | 0.434 | 9.24 % | 22.2 | 2.0 |
74
+ | 3 | 4,956 | 0.281 | 7.99 % | 45.7 | 21.9 |
75
+ | 4 | 6,608 | 0.199 | 7.24 % | 22.0 | 3.4 |
76
+ | 5 | 8,260 | 0.136 | 7.07 % | 34.5 | 16.7 |
77
+ | 6 | 9,912 | 0.094 | 6.84 % | 20.8 | 2.8 |
78
+ | 7 | 11,564 | 0.057 | 6.74 % | 20.1 | 1.0 |
79
+ | 8 | 13,216 | 0.028 | 6.57 % | 31.1 | 10.2 |
80
+
81
+ Command that continued the chosen body (paths as in `train/README.md`):
82
+
83
+ ```sh
84
+ mkdir -p runs/v1 && cp runs/cmp_a/ckpt_epoch1.pt runs/v1/
85
+ for e in $(seq 2 10); do # one process per epoch, see train/README.md "Memory on Apple silicon"
86
+ .venv/bin/python -I train.py --arch a --cache cache --vocab ../vocab.txt --table ../word_table.npy \
87
+ --run-dir runs/v1 --resume runs/v1/ckpt_epoch$((e - 1)).pt --epochs $e --schedule-epochs 10 \
88
+ --max-hours 3 --patience 2 || break
89
+ [ "$(jq -r .stop_reason runs/v1/metrics.json)" = "reached $e epochs" ] || break # early stop or budget
90
+ done
91
+ ```
92
+
93
+ ### Candidates (one epoch each, the same data and schedule)
94
+
95
+ | Body | Parameters | dev-clean WER after 1 epoch | Train loss (last 100) | Epoch, min (paused) | Peak MPS (GB) |
96
+ |---|---:|---:|---:|---:|---:|
97
+ | a: transformer from scratch (4 layers) | 13,268,994 | 13.48 % | 1.103 | 19.3 (3.0) | 38.6 |
98
+ | b: EmbeddingGemma 2 text layers 0..3 | 22,427,394 | 14.60 % | 2.104 | 23.6 (4.6) | 28.9 |
99
+ | c: per-token MLP | 1,314,306 | 25.21 % | 1.788 | 16.2 (26.6) | 10.0 |
100
+
101
+ Epoch minutes count training only (no dev decoding); the paused time, while other jobs measured on the same Mac, is shown in parentheses and not counted.
102
+
103
+ Chosen: `cmp_a` (lowest dev-clean WER (greedy, no LM) after one epoch; tie -> fewer parameters; test sets not used).
104
+
105
+ ## Vocabulary and word table
106
+
107
+ - `vocab.txt`: 200,000 words = every word of the LibriSpeech lexicon (openslr.org/resources/11, public domain), lower case, sorted by code point, apostrophes kept.
108
+ - `word_table.npy`: EmbeddingGemma 2 text embedding of each word with the prompt `task: search result | query: ` (sentence-transformers, float32, then stored as float16, L2-normalized). Check: each of 100 random words, embedded again, comes back at rank 1 (top-1 1.000).
109
+ - Out of vocabulary: test-clean 220 of 52,576 words (0.42 %), test-other 283 of 52,343 (0.54 %); fixtures 1 word (`chiaroscurists`). These are always errors.
110
+
111
+ ## Known weaknesses
112
+
113
+ - Long words err most: on the 2,518 aligned words of 100 test-clean utterances, the word error rate rises with word length: 2.8 % for words of 1-2 tokens (<= 80 ms, n 824), 3.4 % for 3-5 tokens (n 700) and 9.7 % for 6+ tokens (n 994). The frozen-embedding probe before training had the opposite profile (short words hardest); the trained reader reverses it.
114
+ - Substitutions on test-clean: 2,789 in 2,234 distinct pairs; most frequent in -> and (41), and -> in (39), the -> a (20), an -> and (20), a -> the (14), is -> as (11), of -> a (10), this -> the (8). Homophones (same lexicon pronunciation): 2 of the top 20 pairs, 12.4 % of all substitutions; a reader without a language model cannot tell them apart.
115
+ - No language model, no punctuation or casing; trained only on read English audiobook speech.
116
+ - Trained on whole LibriSpeech utterances of up to 24.5 s and measured on whole utterances of up to 35.2 s. Long audio goes through the encoder in 30 s windows (see `reader_config.json` window and "Long audio in 30 s windows" below).
117
+
118
+ ## Long audio in 30 s windows
119
+
120
+ The long fixture `fixtures/long-speckled-band` (a 3,257.4 s LibriVox recording) was read in 125 windows of 30 s, each stepping 653 tokens with a 96-token left overlap and its last token dropped, through the Core AI conversion of the encoder (GPU) and of this reader (fp16, Neural Engine) on an Apple M4 Max: WER 5.80 % against the book text (9,889 words; the LibriVox intro and outro are in the audio only), next to 5.78 % for the torch float32 path on the same windows. The labels of the 81,436 tokens are identical whether the windows run one at a time or two in flight. Records: `exports/pipeline/pipeline_long_fp16_ane_overlap.json` and `exports/pipeline/pipeline_long_torch.json` of the Core AI conversion work (not in this repository).
121
+
122
+ ## Reproduce
123
+
124
+ `train/README.md` lists the environment, the data downloads and every command; `train/model.py --self-test` checks the CTC objective.
125
+
126
+ ## Licenses and credits
127
+
128
+ - LibriSpeech: V. Panayotov, G. Chen, D. Povey, S. Khudanpur, "Librispeech: an ASR corpus based on public domain audio books", ICASSP 2015, https://www.openslr.org/12, CC BY 4.0. The reader weights are trained on train-clean-100.
129
+ - LibriSpeech lexicon: https://www.openslr.org/11, public domain.
130
+ - EmbeddingGemma 2 (`google/embeddinggemma-2`, Google DeepMind): Apache 2.0; it produces the soft tokens and the word table. Deployments must adhere to the Gemma Prohibited Use Policy (https://ai.google.dev/gemma/prohibited_use_policy).
131
+ - `reader.pt` and `word_table.npy` are this repository's own artifacts: the reader weights were trained with `train/train.py` on the LibriSpeech data above, and the table was computed with `train/make_table.py` from EmbeddingGemma 2 and the lexicon words.
SHA256SUMS ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ # EmbeddingGemma-2-Transcribe-Reader, staged 2026-10-14. Verify with: shasum -a 256 -c SHA256SUMS
2
+ cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 LICENSE
3
+ 941840e4078a82c5fe6c1c9a0254af231e1cb01d8455a49250565243523c1106 NOTICE
4
+ 55e63adcaff0822e40a3d800be4f7e9e2c53a77c24ae39fd016c9110a3f23dfc README.md
5
+ 7ee442009c39d6942dbafdc4e7c004bd7a7f7447ca5407c7d22a8ff24e54f0c4 RELEASE.md
6
+ 67a06a857b9aeb066347f8947e4faeed11d2ec3e89e0c23974be0a2c20243d5b reader.pt
7
+ 68efaabae4c2eaa8ae2a5abf8f85fab115791b13178ee3a22e57a0cec727b94e reader_config.json
8
+ bb3b3c70379082333e1bbd90d07ca69fe5c0096bd1c3b2b3f83edd65f1062a68 vocab.txt
9
+ b2d0b13cc70c492f1444b8a42deab437d25254eac47d752d777d27b65377faa8 word_table.npy
reader.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:67a06a857b9aeb066347f8947e4faeed11d2ec3e89e0c23974be0a2c20243d5b
3
+ size 53095605
reader_config.json ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": "v1",
3
+ "input": {
4
+ "shape": "[T, 512]",
5
+ "dtype": "float32",
6
+ "what": "EmbeddingGemma 2 audio soft tokens (embed_audio output), 25 per second"
7
+ },
8
+ "context": "bidirectional within the window",
9
+ "architecture": {
10
+ "name": "a",
11
+ "kind": "transformer encoder from scratch",
12
+ "layers": 4,
13
+ "d_model": 512,
14
+ "heads": 8,
15
+ "ffn": 2048,
16
+ "activation": "gelu",
17
+ "norm": "pre-LayerNorm",
18
+ "positions": "rotary (base 10000)",
19
+ "input": "LayerNorm -> Linear 512->512",
20
+ "output": "LayerNorm -> Linear 512->768",
21
+ "params": 13268994
22
+ },
23
+ "output": {
24
+ "vector": "[T, 768] L2-normalized",
25
+ "blank_logit": "[T]"
26
+ },
27
+ "logits": "scale * cos(vector, table[w]) for w in vocab; blank from blank_logit",
28
+ "scale": 91.21830749511719,
29
+ "vocab": "vocab.txt",
30
+ "table": {
31
+ "file": "word_table.npy",
32
+ "dtype": "float16",
33
+ "shape": "[200000, 768]",
34
+ "prompt": "task: search result | query: ",
35
+ "normalized": true
36
+ },
37
+ "decode": "greedy argmax over N+1, collapse repeats, drop blank",
38
+ "window": {
39
+ "seconds": 30,
40
+ "left_overlap_tokens": 96,
41
+ "right_extra_tokens": 1,
42
+ "note": "encoder is causal; the 83 tokens at the start of a window and its last token differ from a continuous run (fixtures/long-speckled-band: soft_tokens_w30 vs soft_tokens_continuous)"
43
+ },
44
+ "weights": {
45
+ "file": "reader.pt",
46
+ "format": "torch state_dict, float32",
47
+ "code": "train/model.py Reader(arch, n_vocab, k)",
48
+ "keys": "body.* (reader body), blank.weight [1, 768], blank.bias [1], log_scale (scale = exp(log_scale))"
49
+ },
50
+ "n_vocab": 200000,
51
+ "wer": {
52
+ "dev-clean": {
53
+ "wer": 0.06566,
54
+ "utterances": 2703,
55
+ "ref_words": 54402
56
+ },
57
+ "dev-other": {
58
+ "wer": 0.14927,
59
+ "utterances": 2864,
60
+ "ref_words": 50948
61
+ },
62
+ "test-clean": {
63
+ "wer": 0.06807,
64
+ "utterances": 2620,
65
+ "ref_words": 52576
66
+ },
67
+ "test-other": {
68
+ "wer": 0.15102,
69
+ "utterances": 2939,
70
+ "ref_words": 52343
71
+ },
72
+ "fixtures": {
73
+ "wer": 0.04806,
74
+ "utterances": 20,
75
+ "ref_words": 541
76
+ },
77
+ "decode": "greedy, no language model"
78
+ }
79
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff
 
word_table.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b2d0b13cc70c492f1444b8a42deab437d25254eac47d752d777d27b65377faa8
3
+ size 307200128