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

Reader v2: 6 layers, LibriSpeech 960 h (test-clean WER 4.21 %, test-other 10.42 %)

Browse files
Files changed (6) hide show
  1. NOTICE +3 -2
  2. README.md +49 -53
  3. RELEASE.md +98 -68
  4. SHA256SUMS +6 -6
  5. reader.pt +2 -2
  6. reader_config.json +11 -11
NOTICE CHANGED
@@ -1,9 +1,10 @@
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.
 
1
  EmbeddingGemma-2-Transcribe-Reader — NOTICE
2
 
3
+ This repository holds reader v2 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
+ train-clean-360 and train-other-500:
8
  V. Panayotov, G. Chen, D. Povey, S. Khudanpur, "Librispeech: an ASR corpus based on public domain audio books",
9
  ICASSP 2015, https://www.openslr.org/12, licensed under CC BY 4.0
10
  (https://creativecommons.org/licenses/by/4.0/). The audio is not redistributed here.
README.md CHANGED
@@ -10,34 +10,38 @@ datasets:
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.
@@ -48,11 +52,11 @@ repository; the paths in it (`train/`, `fixtures/`) are relative to that directo
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.
@@ -60,54 +64,46 @@ repository; the paths in it (`train/`, `fixtures/`) are relative to that directo
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
 
@@ -115,17 +111,17 @@ done
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
@@ -133,7 +129,7 @@ done
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
 
10
  tags: [embeddinggemma, speech-recognition, ctc, word-embeddings, on-device, core-ai, litert]
11
  ---
12
 
13
+ # EmbeddingGemma 2 Transcribe — reader v2
14
 
15
+ A 19.6 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. Reader v2 is
19
+ trained on the three LibriSpeech training sets (960 h): test-clean WER 4.21 %, test-other 10.42 %.
20
 
21
  The idea comes from Shahir's post (2026-10-13) and the *Embedding Gemma Transcribe* Mac app (eg2.haku.sh), whose
22
  code and weights are not public. This reader is an independent reproduction, trained from scratch on LibriSpeech. It
23
  is not affiliated with Google.
24
 
25
+ Reader v1 (4 layers, 13.3 M parameters, trained on train-clean-100 alone; test-clean 6.81 %, test-other 15.10 %) is
26
+ revision `1af9c5f5` of this repository.
27
+
28
  These weights are framework-neutral (a PyTorch state dict and a NumPy table). The converted builds that run them on
29
  a device:
30
 
31
  | Build | Repository |
32
  |---|---|
33
  | 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) |
34
+ | LiteRT (Android), with reader v1 | [mlboydaisuke/EmbeddingGemma-2-Transcribe-LiteRT](https://huggingface.co/mlboydaisuke/EmbeddingGemma-2-Transcribe-LiteRT) |
35
 
36
  ## Files
37
 
38
  | File | Bytes | SHA-256 | What |
39
  |---|---:|---|---|
40
+ | `reader.pt` | 78,323,637 | `d605f6fba8687497be6b5fd717ea6c51beaee5d5f69c30a64225da96ebe0d8c2` | the reader: a PyTorch `state_dict`, float32 |
41
+ | `word_table.npy` | 307,200,128 | `b2d0b13cc70c492f1444b8a42deab437d25254eac47d752d777d27b65377faa8` | float16 `[200000, 768]`, one L2-normalized row per word (the file of v1) |
42
+ | `vocab.txt` | 1,737,588 | `bb3b3c70379082333e1bbd90d07ca69fe5c0096bd1c3b2b3f83edd65f1062a68` | the 200,000 words, one per line; the line number is the word index (the file of v1) |
43
+ | `reader_config.json` | 2,080 | `3aede371f7fc1b69bd948a3fce6f861e44eedb237d7b6dce360063ea007a90ed` | the contract for ports: input, output, logits, decoding, the window policy, the WER |
44
+ | `RELEASE.md` | 15,575 | `9d0ac2a5d246d8b35f6456891e9a2ae2f199ef44a51087d1fa367f4cd1f35994` | the release note: WER details, the reader's output on the 20 fixture utterances, training log, weaknesses |
45
 
46
  `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)
47
  repository; the paths in it (`train/`, `fixtures/`) are relative to that directory.
 
52
  `google/embeddinggemma-2` at revision `914f7f89142e33e77833254d9c9b90c3cef7303b`
53
  (`model.get_audio_features(input_features, input_features_mask).pooler_output`; transformers 5.19.0 with the
54
  default attention, not `eager`, whose audio mask is inverted in that version).
55
+ - **Body**: LayerNorm → Linear 512→512, 6 pre-LayerNorm transformer layers (width 512, 8 heads, FFN 2048 with GELU,
56
  rotary positions with base 10000), LayerNorm → Linear 512→768. Attention covers the whole input window in both
57
+ directions. 19,573,762 parameters.
58
  - **Output per token**: a unit vector in the 768-d text space and a blank logit.
59
+ - **Logits**: word `w` scores `scale × cos(vector, word_table[w])`, with `scale = exp(log_scale) = 216.351`
60
  (learned); blank is class 200,000 and scores `blank_logit`.
61
  - **Decoding**: per token, blank where `blank_logit > top-1 word logit` (a tie reads the word), else the top-1 word;
62
  merge repeats, drop blanks. No language model, no punctuation, no casing.
 
64
  one, keeping only its new tokens and dropping its last token: the encoder is causal, so the start of a window lacks
65
  its left context and the last token of a 30 s cut misses one input frame. `reader_config.json` → `window`.
66
  - **Weights file**: `reader.pt` keys `body.*` (the reader body), `blank.weight [1, 768]`, `blank.bias [1]`,
67
+ `log_scale`; the module is `Reader(arch, n_vocab, k, layers)` of `reader/train/model.py` in the eg2-transcribe
68
+ repository (arch `a`, `layers` 6; `reader_config.json` → `architecture.layers`).
69
 
70
  ## WER
71
 
72
  Greedy, no language model, every utterance of each set. Reference and hypothesis are lower-cased with runs of spaces
73
  collapsed; words outside the vocabulary stay in the references and count as errors.
74
 
75
+ | Set | Utterances | Reference words | WER | Substitutions | Deletions | Insertions | v1 WER |
76
+ |---|---:|---:|---:|---:|---:|---:|---:|
77
+ | dev-clean (model selection) | 2,703 | 54,402 | 3.75 % | 1,621 | 210 | 211 | 6.57 % |
78
+ | dev-other | 2,864 | 50,948 | 10.26 % | 4,109 | 679 | 441 | 14.93 % |
79
+ | test-clean | 2,620 | 52,576 | 4.21 % | 1,739 | 247 | 226 | 6.81 % |
80
+ | test-other | 2,939 | 52,343 | 10.42 % | 4,249 | 655 | 551 | 15.10 % |
81
+ | fixtures `test-clean-20` | 20 | 541 | 3.70 % | 18 | 1 | 1 | 4.81 % |
82
 
83
+ Long audio, in the 30 s windows of the contract: *The Adventure of the Speckled Band* (LibriVox, 3,257.4 s, 125
84
+ windows), scored against the Project Gutenberg text (9,889 words; the LibriVox intro and outro are in the audio only):
85
+ 3.81 % through the float32 PyTorch path, 3.80 % through the Core AI build (the encoder on the GPU and this reader in
86
+ float16 on the Neural Engine of an Apple M4 Max, two windows in flight). Reader v1: 5.78 % and 5.80 %.
87
 
88
  ## Training
89
 
90
+ - Data: LibriSpeech train-clean-100, train-clean-360 and train-other-500 (CC BY 4.0), 281,241 utterances, 961.6 h,
91
+ read as one set per epoch. The 19,755 utterances with a word outside the vocabulary were left out: 261,486
92
+ utterances, 890.2 h, 80,121,094 tokens. Soft tokens computed once in float32 (TF32 off), stored as float16.
93
  - dev-clean chose the reader body and the epoch; test-clean and test-other were decoded once, after training.
94
  - Objective: CTC over the 200,000 words and blank (`torch.nn.functional.ctc_loss`, float32, `zero_infinity`, mean of
95
  loss / target length).
96
  - Optimizer: AdamW, peak learning rate 0.0003, weight decay 0.01 on matrices, 500 warmup steps, then cosine to zero at
97
+ step 163,430; batches of 16 utterances bucketed by length; gradient clipping 1.0; float32 weights and activations,
98
+ the training matmuls in TF32 (A100); the dev, test and fixture WER are decoded in full float32.
99
+ - 9 epochs, 147,087 steps; the best dev-clean WER came at epoch 7 (these weights); early stop after 2 epochs without
100
+ a better dev-clean WER.
101
+ - Hardware: one NVIDIA A100-SXM4-80GB (Google Colab), torch 2.11.0+cu130, CUDA 13.0; 4.38 h of training plus 2 min of
102
+ dev decoding.
103
+ - Body chosen on dev-clean between two bodies trained the same way: 4 layers (13.3 M parameters, 3.88 % at its best
104
+ epoch 8) and 6 layers (19.6 M, 3.75 % at epoch 7, these weights).
105
+
106
+ The command of the released run is in `RELEASE.md`.
 
 
 
 
 
 
 
 
 
107
 
108
  ## Word table
109
 
 
111
  code point, apostrophes kept.
112
  - `word_table.npy`: the EmbeddingGemma 2 text embedding of each word with the prompt `task: search result | query: `
113
  (sentence-transformers, float32, then stored as float16 and L2-normalized). Each of 100 random words, embedded
114
+ again, comes back at rank 1. Both files are those of v1.
115
  - Out of vocabulary: test-clean 220 of 52,576 words (0.42 %), test-other 283 of 52,343 (0.54 %). These are always
116
  errors.
117
 
118
  ## Limits
119
 
120
+ - By word length: on 2,518 aligned words of 100 test-clean utterances, the word error rate is 1.8 % for words of 1–2
121
+ tokens (up to 80 ms), 2.0 % for 3–5 tokens and 6.1 % for 6 or more.
122
+ - The most frequent substitutions on test-clean are function words (and → in 27, in → and 22, a → the 16); homophones
123
+ are 12.9 % of all substitutions, which a reader without a language model cannot tell apart.
124
+ - English read speech only (audiobooks); trained on utterances of up to 29.7 s and measured on utterances of up to
125
  35.2 s; longer audio goes through the 30 s windows above.
126
 
127
  ## License and credits
 
129
  - This repository: Apache-2.0 (`LICENSE`); see `NOTICE`.
130
  - LibriSpeech: V. Panayotov, G. Chen, D. Povey, S. Khudanpur, "Librispeech: an ASR corpus based on public domain
131
  audio books", ICASSP 2015, https://www.openslr.org/12, CC BY 4.0. The reader weights are trained on
132
+ train-clean-100, train-clean-360 and train-other-500.
133
  - LibriSpeech lexicon: https://www.openslr.org/11, public domain.
134
  - EmbeddingGemma 2 (`google/embeddinggemma-2`, Google DeepMind): Apache 2.0. It produces the soft tokens the reader
135
  reads and the word table. Deployments must adhere to the
RELEASE.md CHANGED
@@ -1,8 +1,29 @@
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
 
@@ -10,16 +31,16 @@ Pre-registered v1 line: test-clean <= 10 % and test-other <= 20 % (greedy, no LM
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
 
@@ -27,105 +48,114 @@ Greedy, no language model, every utterance of each set. Normalization of referen
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.
 
1
+ # Reader v2
2
 
3
+ Released 2026-10-15. Reads EmbeddingGemma 2 audio soft tokens as words. Greedy decoding, no language model: **test-clean WER 4.21 %, test-other WER 10.42 %**. Trained on the three LibriSpeech training sets (960 h; 890 h after leaving out the utterances with a word outside the vocabulary); reader v1 was trained on train-clean-100 only.
4
 
5
+ Pre-registered v2 line: test-clean <= 5.5 % and test-other <= 12 % (greedy, no LM). test-clean meets it (4.21 %), test-other meets it (10.42 %).
6
+
7
+ ## v2 and v1
8
+
9
+ Same encoder, vocabulary, word table, objective, optimizer settings and decoding; the training data and the machine differ (and the body depth, when the table says so).
10
+
11
+ | Set | v1 WER | v2 WER | Change (points) |
12
+ |---|---:|---:|---:|
13
+ | dev-clean | 6.57 % | 3.75 % | -2.81 |
14
+ | dev-other | 14.93 % | 10.26 % | -4.66 |
15
+ | test-clean | 6.81 % | 4.21 % | -2.60 |
16
+ | test-other | 15.10 % | 10.42 % | -4.68 |
17
+ | fixtures `test-clean-20` | 4.81 % | 3.70 % | -1.11 |
18
+
19
+ | | v1 | v2 |
20
+ |---|---|---|
21
+ | Training data | train-clean-100, 26,422 utterances, 92.8 h | 960 h set, 261,486 utterances, 890.2 h |
22
+ | Body | arch a, 4 layers, 13,268,994 parameters | arch a, 6 layers, 19,573,762 parameters |
23
+ | Epochs (released) | 8 (8) | 9 (7) |
24
+ | Steps per epoch | 1,652 | 16,343 |
25
+ | Machine | Apple M4 Max, torch 2.11.0 MPS | NVIDIA A100-SXM4-80GB, torch 2.11.0+cu130 CUDA 13.0 |
26
+ | Precision | float32 (MPS) | training matmuls in TF32 (A100), evaluation in fp32 |
27
 
28
  ## Files
29
 
 
31
  |---|---:|---|
32
  | `vocab.txt` | 1,737,588 | `bb3b3c70379082333e1bbd90d07ca69fe5c0096bd1c3b2b3f83edd65f1062a68` |
33
  | `word_table.npy` | 307,200,128 | `b2d0b13cc70c492f1444b8a42deab437d25254eac47d752d777d27b65377faa8` |
34
+ | `reader.pt` | 78,323,637 | `d605f6fba8687497be6b5fd717ea6c51beaee5d5f69c30a64225da96ebe0d8c2` |
35
+ | `reader_config.json` | 2,080 | `3aede371f7fc1b69bd948a3fce6f861e44eedb237d7b6dce360063ea007a90ed` |
36
 
37
+ `vocab.txt` and `word_table.npy` are the files of v1, unchanged. `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.
38
 
39
  ## What the reader is
40
 
41
  - 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).
42
+ - Body: a bidirectional transformer encoder trained from scratch: LayerNorm -> Linear 512->512, 6 pre-LayerNorm layers (d 512, 8 heads, FFN 2048 GELU, rotary (base 10000) positions), LayerNorm -> Linear 512->768. Attention covers the whole input. 19,573,762 parameters in total.
43
+ - 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 = 216.351 (learned); blank is class N. Decoding: argmax per token, merge repeats, drop blanks.
44
 
45
  ## WER
46
 
 
48
 
49
  | Set | Utterances | Reference words | WER | Substitutions | Deletions | Insertions |
50
  |---|---:|---:|---:|---:|---:|---:|
51
+ | dev-clean (model selection) | 2,703 | 54,402 | 3.75 % | 1,621 | 210 | 211 |
52
+ | dev-other | 2,864 | 50,948 | 10.26 % | 4,109 | 679 | 441 |
53
+ | test-clean | 2,620 | 52,576 | 4.21 % | 1,739 | 247 | 226 |
54
+ | test-other | 2,939 | 52,343 | 10.42 % | 4,249 | 655 | 551 |
55
+ | fixtures `test-clean-20` | 20 | 541 | 3.70 % | 18 | 1 | 1 |
56
 
57
  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:
58
 
59
  | Utterance | Word errors | Reader output |
60
  |---|---:|---|
61
+ | `1089-134686-0000` | 2 / 28 | he hoped there would bestow stew for dinner turnips and carrots and bruised potatoes and fat mutton pieces to be ladled out in thick peppered flour fatten sauce |
62
+ | `1089-134686-0002` | 1 / 18 | after early nightfall the yellow lamps would light up here and there the squalid quarter of the broths |
63
+ | `1188-133604-0000` | 2 / 19 | you will find me continually speaking of four men titian holborn turner and tintoret a in almost the same terms |
64
+ | `1188-133604-0001` | 1 / 18 | they unite every quality and sometimes you will find me referring to them as colorists sometimes as kio |
65
+ | `121-121726-0000` | 0 / 17 | also a popular contrivance whereby love making may be suspended but not stopped during the picnic season |
66
+ | `121-121726-0001` | 0 / 8 | harangue the tiresome product of a tireless tongue |
67
+ | `1221-135766-0000` | 0 / 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 threw its quivering sunshine over the tiny features of this child |
68
+ | `1221-135766-0001` | 1 / 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 dishonoured bottom to connect her parent for ever with the race and descent of mortals and to be finally a blessed soul in heaven |
69
+ | `1284-1180-0000` | 1 / 24 | he wore blue silk stockings blue knee pans with gold buckles a blue ruffled waist and a jacket of bright blue braided with gold |
70
+ | `1284-1180-0001` | 1 / 26 | his hat had a peaked crown in a flat brim and around the brim was a row of tiny golden bells that tinkled when he moved |
71
+ | `1320-122612-0000` | 1 / 41 | since the period of our 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 |
72
+ | `1320-122612-0001` | 2 / 30 | the dews were suffered to exhale and the sun had dispersed the mists and was shedding a strong and clear light in the forests when the travellers resumed their journey |
73
+ | `1580-141083-0000` | 1 / 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 clue as to the people concerned |
74
  | `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 |
75
  | `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 |
76
+ | `1995-1826-0001` | 0 / 27 | the south she had not thought of seriously and yet knowing of its delightful hospitality and mild climate she was not averse to charleston or new orleans |
77
+ | `2094-142345-0001` | 1 / 21 | but the windows are patched with wooden panes and the door i think is like the gate it isn't never opened |
78
+ | `2094-142345-0002` | 3 / 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 pear |
79
+ | `2300-131720-0000` | 2 / 13 | but paris plant like that of the crystal palace was a temporary exhibit |
80
+ | `2300-131720-0001` | 1 / 33 | the london plant 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 viaduct |
81
 
82
  ## Training
83
 
84
+ - Data: LibriSpeech train-clean-100, train-clean-360 and train-other-500 (CC BY 4.0), 281,241 utterances, 961.6 h, read as one set per epoch. Utterances with a word outside the vocabulary were left out: 261,486 utterances, 890.2 h, 80,121,094 tokens in training.
85
+
86
+ | Split | Utterances | Hours | Left out (word outside the vocabulary) | In training | Hours in training |
87
+ |---|---:|---:|---:|---:|---:|
88
+ | train-clean-100 | 28,539 | 100.65 | 2,117 | 26,422 | 92.79 |
89
+ | train-clean-360 | 104,014 | 363.82 | 7,532 | 96,482 | 336.45 |
90
+ | train-other-500 | 148,688 | 497.17 | 10,106 | 138,582 | 461.00 |
91
+
92
+ - Soft tokens: computed once on the training machine in float32 with TF32 off (stored float16), 16 utterances of similar length per encoder call (checked against one at a time: per-token cosine min 0.999999994, max |difference| 0.00051). Check before use: the 20 fixture utterances (5,036 tokens) against the float32 CPU reference soft tokens: per-token cosine min 0.9999999978, max |difference| 0.00036.
93
+ - The cache index (ids, samples, frames, tokens, transcripts) of dev-clean, dev-other, test-clean, test-other and train-clean-100 is identical to the v1 cache index.
94
  - 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.
95
  - Objective: CTC over the 200,000 words + blank (`torch.nn.functional.ctc_loss`, float32, zero_infinity, mean of loss / target length).
96
+ - Optimizer: AdamW, peak learning rate 0.0003, weight decay 0.01 on matrices, linear warmup over 500 steps, then cosine to zero at step 163,430, batch 16 utterances bucketed by length, gradient clipping 1.0, float32 weights and activations; training matmuls in TF32 (A100), evaluation in fp32: the dev, test and fixture WER are decoded in full float32, as in v1.
97
+ - Length: 9 epochs, 147,087 steps; best dev-clean WER at epoch 7 (the released weights). Stop: early stop: no better dev-clean WER for 2 epochs.
98
+ - Time: 4.38 h of training plus 2 min of dev decoding on one NVIDIA A100-SXM4-80GB (Google Colab, torch 2.11.0+cu130, CUDA 13.0).
99
+ - Colab compute units: 95.7 in total (both runtimes: soft tokens, training, evaluation), 6.77 per hour per A100 runtime; about 22 of them were the two runtimes waiting idle after the work, before they were deleted.
100
 
101
+ | Epoch | Steps | Train loss (last 100) | dev-clean WER | Training (min) | Dev decoding (s) |
102
  |---:|---:|---:|---:|---:|---:|
103
+ | 1 | 16,343 | 0.318 | 6.08 % | 29.2 | 15 |
104
+ | 2 | 32,686 | 0.242 | 5.16 % | 29.5 | 12 |
105
+ | 3 | 49,029 | 0.203 | 4.57 % | 29.3 | 12 |
106
+ | 4 | 65,372 | 0.170 | 4.38 % | 29.2 | 12 |
107
+ | 5 | 81,715 | 0.154 | 4.10 % | 29.2 | 12 |
108
+ | 6 | 98,058 | 0.103 | 3.83 % | 29.2 | 12 |
109
+ | 7 | 114,401 | 0.082 | 3.75 % | 29.1 | 12 |
110
+ | 8 | 130,744 | 0.052 | 3.77 % | 29.2 | 12 |
111
+ | 9 | 147,087 | 0.037 | 3.79 % | 29.2 | 12 |
112
+
113
+ Command of the released run (paths as on the training machine):
114
 
115
  ```sh
116
+ python -u /content/r7/code/train/train.py --arch a --layers 6 --cache /content/r7/cache --vocab /content/r7/assets/reader/vocab.txt --table /content/r7/assets/reader/word_table.npy --run-dir /content/r7/runs/v2a6 --device cuda --train-split train-clean-100,train-clean-360,train-other-500 --dev-split dev-clean --epochs 10 --schedule-epochs 10 --patience 2 --max-hours 4.727 --matmul tf32 --log-every 500 --stop-file /content/r7/control/stop_v2a6 --resume /content/r7/runs/v2a6/ckpt_epoch1.pt
 
 
 
 
 
 
117
  ```
118
 
119
+ ### Candidates (epoch 1 of each, the same data and schedule)
120
 
121
+ | Body | Parameters | dev-clean WER after 1 epoch | Train loss (last 100) | Epoch (min) |
122
+ |---|---:|---:|---:|---:|
123
+ | a, 4 layers | 13,268,994 | 6.27 % | 0.322 | 27.5 |
124
+ | a, 6 layers | 19,573,762 | 6.08 % | 0.318 | 29.2 |
125
+
126
+ Both bodies, trained to the end (early stopping on dev-clean, patience 2) and decoded the same way:
127
 
128
+ | Body | Epochs | Best epoch | dev-clean | dev-other | test-clean | test-other | fixtures |
129
+ |---|---:|---:|---:|---:|---:|---:|---:|
130
+ | a, 4 layers | 10 | 8 | 3.88 % | 10.77 % | 4.32 % | 10.88 % | 3.14 % |
131
+ | a, 6 layers (released) | 9 | 7 | 3.75 % | 10.26 % | 4.21 % | 10.42 % | 3.70 % |
132
 
133
+ Chosen: arch a with 6 layers. After one epoch its dev-clean WER was the lower one (6.08 % against 6.27 %), so both runs went on; each stopped early on dev-clean, the 6-layer run at epoch 9 (best epoch 7, 3.75 %) and the 4-layer run at epoch 10 (best epoch 8, 3.88 %). The choice uses dev-clean only. The 6-layer run trained epoch 1 with --epochs 1 and then continued from that checkpoint with --epochs 10 (the command above); the cosine schedule spans 10 epochs in both.
134
 
135
  ## Vocabulary and word table
136
 
137
+ - `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 (as in v1).
138
  - `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).
139
  - 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.
140
 
141
  ## Known weaknesses
142
 
143
+ - By word length: on the 2,518 aligned words of 100 test-clean utterances, the word error rate is 1.8 % for words of 1-2 tokens (<= 80 ms, n 824), 2.0 % for 3-5 tokens (n 700) and 6.1 % for 6+ tokens (n 994).
144
+ - Substitutions on test-clean: 1,739 in 1,420 distinct pairs; most frequent and -> in (27), in -> and (22), a -> the (16), the -> a (11), an -> and (9), this -> the (6), i've -> i (5), man -> men (5). Homophones (same lexicon pronunciation): 3 of the top 20 pairs, 12.9 % of all substitutions; a reader without a language model cannot tell them apart.
145
  - No language model, no punctuation or casing; trained only on read English audiobook speech.
146
+ - Trained on whole LibriSpeech utterances of up to 29.7 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).
147
 
148
  ## Long audio in 30 s windows
149
 
150
+ 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 3.80 % against the book text (9,889 words; the LibriVox intro and outro are in the audio only), next to 3.81 % 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_v2/pipeline_long_fp16_ane_overlap.json` and `exports/pipeline_v2/pipeline_long_torch.json` of the Core AI conversion work (not in this repository).
151
 
152
  ## Reproduce
153
 
154
+ `train/README.md` lists the environment, the data downloads and every command; v2 ran the same scripts on CUDA with the three training splits joined by commas in `--train-split` (the command above). `train/model.py --self-test` checks the CTC objective.
155
 
156
  ## Licenses and credits
157
 
158
+ - 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, train-clean-360 and train-other-500.
159
  - LibriSpeech lexicon: https://www.openslr.org/11, public domain.
160
  - 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).
161
  - `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 CHANGED
@@ -1,9 +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
 
1
+ # EmbeddingGemma-2-Transcribe-Reader, staged 2026-10-15 (reader v2; reader v1 is revision 1af9c5f5). Verify with: shasum -a 256 -c SHA256SUMS
2
  cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 LICENSE
3
+ f353028c569417fff6bcd8c1e2ee8d77efe765c2ad2238ec36ff64be574cda2c NOTICE
4
+ 2224e017715355689bf5e5fcdb39c612d92939063c62d8633501c48613ffa867 README.md
5
+ 9d0ac2a5d246d8b35f6456891e9a2ae2f199ef44a51087d1fa367f4cd1f35994 RELEASE.md
6
+ d605f6fba8687497be6b5fd717ea6c51beaee5d5f69c30a64225da96ebe0d8c2 reader.pt
7
+ 3aede371f7fc1b69bd948a3fce6f861e44eedb237d7b6dce360063ea007a90ed reader_config.json
8
  bb3b3c70379082333e1bbd90d07ca69fe5c0096bd1c3b2b3f83edd65f1062a68 vocab.txt
9
  b2d0b13cc70c492f1444b8a42deab437d25254eac47d752d777d27b65377faa8 word_table.npy
reader.pt CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:67a06a857b9aeb066347f8947e4faeed11d2ec3e89e0c23974be0a2c20243d5b
3
- size 53095605
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d605f6fba8687497be6b5fd717ea6c51beaee5d5f69c30a64225da96ebe0d8c2
3
+ size 78323637
reader_config.json CHANGED
@@ -1,5 +1,5 @@
1
  {
2
- "version": "v1",
3
  "input": {
4
  "shape": "[T, 512]",
5
  "dtype": "float32",
@@ -9,7 +9,7 @@
9
  "architecture": {
10
  "name": "a",
11
  "kind": "transformer encoder from scratch",
12
- "layers": 4,
13
  "d_model": 512,
14
  "heads": 8,
15
  "ffn": 2048,
@@ -18,14 +18,14 @@
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",
@@ -43,34 +43,34 @@
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
  },
 
1
  {
2
+ "version": "v2",
3
  "input": {
4
  "shape": "[T, 512]",
5
  "dtype": "float32",
 
9
  "architecture": {
10
  "name": "a",
11
  "kind": "transformer encoder from scratch",
12
+ "layers": 6,
13
  "d_model": 512,
14
  "heads": 8,
15
  "ffn": 2048,
 
18
  "positions": "rotary (base 10000)",
19
  "input": "LayerNorm -> Linear 512->512",
20
  "output": "LayerNorm -> Linear 512->768",
21
+ "params": 19573762
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": 216.3509979248047,
29
  "vocab": "vocab.txt",
30
  "table": {
31
  "file": "word_table.npy",
 
43
  },
44
  "weights": {
45
  "file": "reader.pt",
46
+ "format": "torch state_dict, float32; training matmuls in TF32 (A100), evaluation in fp32",
47
+ "code": "train/model.py Reader(arch, n_vocab, k, layers)",
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.03754,
54
  "utterances": 2703,
55
  "ref_words": 54402
56
  },
57
  "dev-other": {
58
+ "wer": 0.10263,
59
  "utterances": 2864,
60
  "ref_words": 50948
61
  },
62
  "test-clean": {
63
+ "wer": 0.04207,
64
  "utterances": 2620,
65
  "ref_words": 52576
66
  },
67
  "test-other": {
68
+ "wer": 0.10422,
69
  "utterances": 2939,
70
  "ref_words": 52343
71
  },
72
  "fixtures": {
73
+ "wer": 0.03697,
74
  "utterances": 20,
75
  "ref_words": 541
76
  },