amharic-asr-benchmark / docs /FAILURES.md
Chapimenge's picture
Language model and beam search results, plus two more failure log entries
73a37ef verified
|
Raw
History Blame Contribute Delete
12.5 kB

What went wrong

Benchmarks are published as though they fell out of the sky. This one took four days, and most of that was spent being wrong in ways worth writing down. Every failure below is one we actually hit, in the order we hit it, with what it cost and what fixed it.

The reason to publish this is not confession. It is that three of these bugs produced results that looked correct, and the only thing that caught them was a diagnostic we nearly did not run.


1. The experiment that passed and was worthless

Before benchmarking anything we ran a calibration experiment: do two ASR models agreeing tell you the transcript is right? It reported GO. It was invalid, and for three separate reasons at once.

The decode limit truncated one model. Whisper was generated with max_new_tokens=200. On long clips it simply stopped mid-sentence. 139 of 500 clips were affected and the model was charged for words it was never allowed to emit.

A language tag was scored as text. One model does joint recognition and language identification, so it prefixes [AMH]. That tag was compared against the reference as though it were speech. 290 of 500 outputs carried one. The model was penalised for doing the second job it was designed to do.

The disagreement metric was asymmetric. Character error rate divides by the reference length, and we passed one model's output as the reference. Twenty clips scored above 1.0, which is impossible for a symmetric disagreement.

How we caught it. Not from the headline number, which looked fine. From a diagnostic printed beside it: rank correlation between agreement and each model's true error. It came out 0.935 against one model and 0.087 against the other. If agreement were measuring mutual corroboration those would be similar. They were not, so agreement was tracking one model's failures.

A single summary number cannot tell you it is wrong. Print the diagnostic that would look different if your assumption failed, and print it every run.


2. The same truncation bug, reintroduced two days later

We fixed the 200-token limit in the calibration script. Then we wrote a new benchmark script, and typed max_new_tokens=200 into it.

It gave shook-medium-amharic-2k a CER of 0.3107. The true figure is 0.1147. We nearly published a number that made a good model look broken.

How we caught it. Output length against reference length, bucketed:

reference length Whisper output / reference CTC output / reference
0-60 chars 0.96x 1.08x
60-90 0.95x 1.03x
90-120 0.80x 1.01x
120-160 0.63x 1.00x
160+ 0.46x 0.96x

A model that is merely wrong is wrong at all lengths. A model that is truncated degrades as length grows. The CTC column is the control that makes it unambiguous.

Fixing a bug in one file does not fix it in your head. The check that catches a class of bug belongs in the pipeline, not in your memory.


3. A working system reported as broken

Our health check for the language model toolchain was:

lmplz --help > /dev/null 2>&1 && echo "ok" || echo "MISSING"

lmplz --help exits with status 1. Many C++ tools print usage to stderr and return non-zero. The binary was installed and working; we reported it missing and skipped a phase.

This is the mirror image of the bugs above: there, a broken thing looked fine; here, a working thing looked broken. Both come from testing a proxy instead of the thing itself. The fix was to check that lmplz actually builds a model from three lines of input.


4. Every result silently failed to save

Results were pushed to a private repository with HfApi() and no explicit token. The library picked up an ambient HF_TOKEN from the environment, a read token for a different account, and every upload returned Repository Not Found.

Five models had been scored. The machine terminated itself on schedule and would have taken all of it. We pulled the files off over SSH minutes before it went.

The same ambient-credential precedence bug had already cost us a day earlier in the project, in a completely different service. Knowing about a class of bug is not the same as being immune to it.

An ambient credential is not a default, it is a trap. Pass the token you mean.


5. The deadman switch we triggered by trying to disable it

Rented machines had a shutdown timer:

( sleep 32400; kill_self ) &

To keep a machine alive for debugging, we killed the sleep. The subshell proceeded immediately to the next command, which was kill_self. Killing the timer fires the timer.

We destroyed a healthy machine and the evidence on it. The fix is a loop that checks a flag file, so interrupting one iteration costs a minute rather than executing the payload:

( for i in $(seq 1 540); do sleep 60; [ -f NODEADMAN ] && exit 0; done
  kill_self ) &

6. Four dependency collisions, each invisible to the previous fix

The GPU image ships deep learning frameworks but not data tooling, and every pip install that pulled a newer version collided with something preinstalled.

Symptom Actual cause
numpy._DTypeMeta object is not subscriptable soundfile 0.13+ uses numpy 2 generics; the image has numpy 1.x
libcudart.so.13: cannot open shared object file installing a VAD package pulled a CUDA 13 torchaudio onto a CUDA 12.8 torch
cannot import name 'AutoProcessor' from 'transformers' Pillow 9.0.1. PIL.Image.Resampling arrived in 9.1, and without it every transformers processor class fails to import
Special word <unk> is not allowed in the corpus the text corpus contains literal <unk> tokens; the LM trainer aborts rather than ignoring them

The third one deserves attention. The error names transformers and AutoProcessor. The cause is an image library four versions behind. Nothing in the message points anywhere near it, and it cost two machine launches.

What finally worked was not fixing them individually but adding a preflight that runs on the machine, before any real work, and imports the exact symbols the pipeline uses, not the packages but the symbols. A stub-based local check cannot catch these by construction, because it replaces the very libraries that collide.

Two durable fixes came out of it: pin torchaudio to torch's own version and CUDA tag read at runtime rather than hard-coded, and move to a newer OS image so the whole class of stale-system-package problems disappears instead of being patched one at a time.


7. Losing 374 recordings to a silent failure

In the collection stage, a download worker had a circuit breaker: ten consecutive failures and stop. But the branch where the download succeeds and the audio conversion produces nothing incremented the failure counter and then continued without checking it.

One machine hit that branch on every single item. All three of its shards ran to completion reporting 0 uploaded, 123 failed, wrote a "finished" marker, and the supervisor saw nothing wrong. 374 recordings, silently.

Two fixes: every failure path must reach the circuit breaker, and a shard that fails more than a tenth of its work does not get to call itself finished.


8. A metric that argued against the right decision

We built a tool where people correct machine-written transcripts, and it reported an effort ratio of 17.5x, seventeen seconds of human time per second of audio. At that rate the approach is not worth pursuing.

The timer measured wall-clock from assignment to submission. One clip logged 4,590 seconds: someone opened it and went to lunch.

statistic effort
p25 1.1x realtime
median 2.0x realtime
p75 5.1x
p95 79.2x
mean 12.1x

The median is the real number and it is six times better than the mean. A badly specified metric nearly killed a good idea.

When a distribution has walk-aways in it, the mean is not a summary, it is an artefact. Report the median and the tail separately.


9. Choosing the wrong model to build on

Our pipeline used a 1-billion-parameter model as one of its two transcribers, because it was the largest in the family and we assumed size ordered quality.

Measured on this benchmark:

model parameters CER
Ethio-ASR-multilingual-600M 600M 0.0991
Ethio-ASR-multilingual-1B 1B 0.1308

The smaller model is 24% better. It is also the one the community actually downloads, by a factor of 500. The information was public the whole time; we never checked.


10. Things that were simply true, and surprising

A published threshold does not transfer across domains. A filter calibrated on read prompts, where two models disagreed by 0.10 on average, was applied to spontaneous podcast speech where they disagree by 0.32. It retained 8% of the data. Nothing was broken. The number was measured somewhere else.

Both transcribers collapse on long segments, in opposite ways. Above roughly ten seconds of spontaneous speech, the CTC model silently drops content, its output falling to 0.74x the length of the other model's, while the sequence model falls into repetition loops, one 29.7-second segment repeating the same clause nine times. Retention above ten seconds was zero.

Overlapping confidence intervals do not mean a tie. Our top two models have intervals of [0.0896, 0.0999] and [0.0939, 0.1042], which overlap. But they are scored on the same clips, so the correct test is paired, and the difference is real at p = 0.001. Reading marginal intervals would have given the wrong answer.


What we would tell someone starting this

  1. Print the diagnostic that would look different if you were wrong, next to every headline number. Correlations, output-length ratios, retention by bucket. Three invalid results here were caught by exactly one such number.
  2. Test the thing, not a proxy for it. --help exiting zero is not proof a tool works.
  3. Never let ambient credentials be your default.
  4. Write the decision rule before the run, and do not move it afterwards. Ours said stop below 10% retention. We hit 8%. Saying so is the whole point.
  5. Check the leaderboard before picking the biggest model.
  6. Medians, when your data has humans in it.

None of this made the benchmark better. It made it true, which took longer.


11. The same bug, in two files, in one night

pyctcdecode requires every label in the alphabet to be unique. Our vocabulary mapping sent four special tokens (<pad>, <s>, </s>, <unk>) to the empty string, because the CTC blank is conventionally empty and the rest looked like they should be too.

ValueError: Alphabet contains duplicate entries, this is not allowed.

It killed the language model phase. We fixed it, redeployed, and the phase ran.

Then the beam search phase failed with the identical error, because it had its own copy of the same vocabulary code and only one copy had been fixed.

This is the second time in this project that fixing a bug in one file left the same bug live in another. The first was a decode limit that truncated a model, fixed in one script and retyped into the next two days later.

A bug fixed in one place is not fixed. Either the code is shared, or the check that catches it runs over everything.

12. A broken baseline hiding inside a working result

The language model phase reported its own greedy baseline alongside the language model result, so the improvement could be read off directly. Those greedy numbers came out around 3.5 CER, which is impossible.

The cause was the fix above. De-duplicating the alphabet appends a suffix to repeated labels, and the phase's hand-rolled greedy decoder emitted those suffixes as literal text. The language model path was unaffected because pyctcdecode handles the alphabet properly.

So the headline number was correct and the comparison beside it was nonsense. Anyone reading "3.55 improves to 0.10" would have concluded the language model delivers a 97% improvement. The real figure, measured against the verified benchmark run, is 13 to 19% on word error rate.

Never compute a baseline twice. Compare against the number you already measured and trust, not against a fresh reimplementation of it.