Chapimenge commited on
Commit
73a37ef
·
verified ·
1 Parent(s): 06b424c

Language model and beam search results, plus two more failure log entries

Browse files
Files changed (3) hide show
  1. README.md +57 -0
  2. docs/FAILURES.md +44 -0
  3. results/language_model.json +64 -0
README.md CHANGED
@@ -71,6 +71,63 @@ agglutinative language, but if you are comparing against word-rate figures
71
  published elsewhere, that is the number. No open model we tested is close to the
72
  15% WER that would make Amharic recognition feel solved.
73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  ## Speed
75
 
76
  Measured on the same run, one A100, batch size 16. This is throughput for bulk
 
71
  published elsewhere, that is the number. No open model we tested is close to the
72
  15% WER that would make Amharic recognition feel solved.
73
 
74
+ ## Does an Amharic language model help?
75
+
76
+ A CTC model decides each audio frame independently and has no idea what an
77
+ Amharic word is, so when the audio is ambiguous it emits letters that spell
78
+ nothing. An n-gram language model rescores candidates during beam search and
79
+ pulls the output toward real words.
80
+
81
+ We trained a 5-gram on **12,868,562 lines** of open Amharic text,
82
+ with every test and validation sentence removed. Alpha and beta were tuned on
83
+ the **validation** split and applied unchanged to test.
84
+
85
+ | model | WER greedy | WER + LM | change | CER greedy | CER + LM | change |
86
+ |---|---|---|---|---|---|---|
87
+ | `Ethio-ASR-amharic` | 0.2845 | **0.2483** | **-12.7%** | 0.0946 | 0.0965 | +2.0% |
88
+ | `Ethio-ASR-multilingual-600M` | 0.2984 | **0.2566** | **-14.0%** | 0.0991 | 0.1034 | +4.3% |
89
+ | `Ethio-ASR-multilingual-1B` | 0.3894 | **0.3154** | **-19.0%** | 0.1308 | 0.1370 | +4.8% |
90
+
91
+ **Word error rate improves 13 to 19% relative. Character error rate gets
92
+ slightly worse.** That is not a contradiction, it is the language model working
93
+ as designed. It pulls output toward real words, so whole words match far more
94
+ often. When it settles on the wrong real word it changes several characters at
95
+ once, so character error ticks up slightly. For anything a person reads, the
96
+ word rate is what matters.
97
+
98
+ **The best result on this benchmark is now 24.83% WER**, from
99
+ `Ethio-ASR-amharic` with the language model, against 28.45% without it.
100
+
101
+ Two caveats. The best alpha and beta both landed on the **edge of the search
102
+ grid**, so a wider search would probably find a better setting. And the trained
103
+ model is 17 GB unpruned, which is impractical to distribute; a pruned version
104
+ is the obvious next step.
105
+
106
+ ### Decontamination
107
+
108
+ Removing test sentences from 12.8 million lines of text is where a language
109
+ model quietly cheats. Exact whole-line matching found **zero** contaminating
110
+ lines. Substring matching over all 2,990 held-out sentences found **four**,
111
+ buried inside longer paragraphs. Small, but they were there, and nothing would
112
+ have reported an error if we had missed them.
113
+
114
+ ## Does beam search change the ranking?
115
+
116
+ Greedy decoding is not neutral between model families, so this checks whether it
117
+ disadvantaged the sequence-to-sequence models.
118
+
119
+ | model | beam width 5 |
120
+ |---|---|
121
+ | `Ethio-ASR-amharic` | not yet rerun, see FAILURES |
122
+ | `Ethio-ASR-multilingual-600M` | not yet rerun, see FAILURES |
123
+ | `Ethio-ASR-multilingual-1B` | not yet rerun, see FAILURES |
124
+ | `shook-medium-amharic-2k` | 0.1147 to 0.1127 CER, 0.2943 to 0.2894 WER |
125
+ | `shook-tiny-amharic-stage2-polish` | 0.2735 to 0.2453 CER, 0.6200 to 0.5812 WER |
126
+
127
+ It does not change the ranking. Whisper gains a little and pays heavily in
128
+ speed, from 714 seconds to 4,151 for the medium model. The CTC runs hit a bug
129
+ and have not been rerun.
130
+
131
  ## Speed
132
 
133
  Measured on the same run, one A100, batch size 16. This is throughput for bulk
docs/FAILURES.md CHANGED
@@ -251,3 +251,47 @@ real at p = 0.001. Reading marginal intervals would have given the wrong answer.
251
  6. **Medians, when your data has humans in it.**
252
 
253
  None of this made the benchmark better. It made it *true*, which took longer.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
251
  6. **Medians, when your data has humans in it.**
252
 
253
  None of this made the benchmark better. It made it *true*, which took longer.
254
+
255
+ ---
256
+
257
+ ## 11. The same bug, in two files, in one night
258
+
259
+ `pyctcdecode` requires every label in the alphabet to be unique. Our vocabulary
260
+ mapping sent four special tokens (`<pad>`, `<s>`, `</s>`, `<unk>`) to the empty
261
+ string, because the CTC blank is conventionally empty and the rest looked like
262
+ they should be too.
263
+
264
+ ```
265
+ ValueError: Alphabet contains duplicate entries, this is not allowed.
266
+ ```
267
+
268
+ It killed the language model phase. We fixed it, redeployed, and the phase ran.
269
+
270
+ Then the beam search phase failed with the identical error, because it had its
271
+ own copy of the same vocabulary code and only one copy had been fixed.
272
+
273
+ This is the second time in this project that fixing a bug in one file left the
274
+ same bug live in another. The first was a decode limit that truncated a model,
275
+ fixed in one script and retyped into the next two days later.
276
+
277
+ > A bug fixed in one place is not fixed. Either the code is shared, or the check
278
+ > that catches it runs over everything.
279
+
280
+ ## 12. A broken baseline hiding inside a working result
281
+
282
+ The language model phase reported its own greedy baseline alongside the language
283
+ model result, so the improvement could be read off directly. Those greedy numbers
284
+ came out around **3.5 CER**, which is impossible.
285
+
286
+ The cause was the fix above. De-duplicating the alphabet appends a suffix to
287
+ repeated labels, and the phase's hand-rolled greedy decoder emitted those
288
+ suffixes as literal text. The language model path was unaffected because
289
+ `pyctcdecode` handles the alphabet properly.
290
+
291
+ So the headline number was correct and the comparison beside it was nonsense.
292
+ Anyone reading "3.55 improves to 0.10" would have concluded the language model
293
+ delivers a 97% improvement. The real figure, measured against the verified
294
+ benchmark run, is 13 to 19% on word error rate.
295
+
296
+ > Never compute a baseline twice. Compare against the number you already
297
+ > measured and trust, not against a fresh reimplementation of it.
results/language_model.json ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "language_model": {
3
+ "corpus_lines": 12868562,
4
+ "held_out_lines_dropped": 4,
5
+ "order": 5,
6
+ "alpha": 0.3,
7
+ "beta": 1.5,
8
+ "note": "alpha and beta tuned on the validation split, applied unchanged to test",
9
+ "models": {
10
+ "badrex/Ethio-ASR-multilingual-600M": {
11
+ "cer_greedy": 0.0990624900009599,
12
+ "cer_lm": 0.10336927654945126,
13
+ "wer_greedy": 0.2983765690376569,
14
+ "wer_lm": 0.25660251046025107,
15
+ "cer_rel_change": 0.04347545219638255,
16
+ "wer_rel_change": -0.1400044873233116
17
+ },
18
+ "badrex/Ethio-ASR-multilingual-1B": {
19
+ "cer_greedy": 0.1307842447125076,
20
+ "cer_lm": 0.1370236457300099,
21
+ "wer_greedy": 0.3893891213389121,
22
+ "wer_lm": 0.3153807531380753,
23
+ "cer_rel_change": 0.047707589176493544,
24
+ "wer_rel_change": -0.19006275251439875
25
+ },
26
+ "badrex/Ethio-ASR-amharic": {
27
+ "cer_greedy": 0.0946085175823121,
28
+ "cer_lm": 0.09648993696605127,
29
+ "wer_greedy": 0.28451882845188287,
30
+ "wer_lm": 0.2483347280334728,
31
+ "cer_rel_change": 0.019886363636363633,
32
+ "wer_rel_change": -0.12717647058823534
33
+ }
34
+ }
35
+ },
36
+ "beam_search": {
37
+ "beams": 5,
38
+ "models": {
39
+ "badrex/Ethio-ASR-amharic": {
40
+ "error": "alphabet de-duplication bug, not yet rerun"
41
+ },
42
+ "badrex/Ethio-ASR-multilingual-600M": {
43
+ "error": "alphabet de-duplication bug, not yet rerun"
44
+ },
45
+ "badrex/Ethio-ASR-multilingual-1B": {
46
+ "error": "alphabet de-duplication bug, not yet rerun"
47
+ },
48
+ "b1n1yam/shook-medium-amharic-2k": {
49
+ "cer_greedy": 0.11470898793715803,
50
+ "cer_beam": 0.11266118452628547,
51
+ "wer_greedy": 0.29425941422594143,
52
+ "wer_beam": 0.28940585774058575,
53
+ "seconds": 4151.0
54
+ },
55
+ "b1n1yam/shook-tiny-amharic-stage2-polish": {
56
+ "cer_greedy": 0.2735097430646658,
57
+ "cer_beam": 0.24526925415160145,
58
+ "wer_greedy": 0.6200167364016737,
59
+ "wer_beam": 0.5811882845188284,
60
+ "seconds": 614.9
61
+ }
62
+ }
63
+ }
64
+ }