What a 61M-Parameter CTC Model Can and Cannot Learn
Tokenizers, blanks, and a detachable language head for Egyptian Arabic
Most speech recognition progress today comes from making models bigger. Whisper-large-v3 is 1.5 B parameters. Cohere's Arabic transcription model is 2 B. Meta's OmniASR-LLM is 7 B. All of them need a GPU to be comfortable.
Metro-ASR-Small is 61.6 million parameters and runs on a laptop CPU at roughly 50× faster than real time. It transcribes Egyptian Arabic, English, and the code-switched mixture of the two that Egyptians actually speak.
This article is not a release announcement. It is an attempt to answer a specific question that kept coming up while building it:
When you have a fixed, modest amount of data and a fixed, small parameter budget, where does accuracy actually come from?
The answer turns out to be much less about the acoustic model than you would expect, and much more about two things that cost almost nothing: how you chop text into tokens, and whether you let a cheap n-gram model vote at decode time.
Along the way we will make a prediction from first principles about a training curve, and then check it against the real logs. It matches to within two percentage points. That kind of check is the whole point of this piece — it is easy to tell a story about why a design choice works, and much harder to predict a number in advance and be right.
Everything here is measured. Every table, figure, and transcript in this article was produced by running the released checkpoint on CPU. The scripts are in the repository.
Table of contents
- The model in one page
- Inside the architecture
- How CTC actually works, and the frame budget it imposes
- Experiment 1 — BPE versus characters
- Why a bigger vocabulary is a trade, not an upgrade
- The detachable language head
- Experiment 2 — greedy versus beam search with KenLM
- Worked examples: Arabic, English, code-switching
- What we assumed, and where this could be wrong
- Reproducing all of it
1. The model in one page
Metro-ASR is a non-autoregressive speech recogniser. That phrase does a lot of work, so let us unpack it.
Most modern ASR models (Whisper, Cohere Transcribe, anything with "encoder-decoder" in its description) generate text one token at a time. To produce the tenth word they must first have produced the ninth. That serial loop is what makes them slow, and it is why they want a GPU.
Metro-ASR does something different. It looks at the whole audio clip at once, and for every 40-millisecond slice of audio it independently guesses which text token is being spoken in that slice. One forward pass. No loop. Then a trivial post-processing rule turns that per-slice guess into text.
That is CTC — Connectionist Temporal Classification — and it is the source of both the model's speed and its characteristic weakness. We will return to the weakness.
| Parameters | 61,586,320 |
| Encoder | 12 Metro blocks, d_model 384, 6 attention heads |
| Input | 80-bin log-Mel spectrogram, 16 kHz mono |
| Frame rate | 25 frames/second (40 ms per frame) after 4× convolutional subsampling |
| Output vocabulary | 5,000 SentencePiece BPE tokens + blank, unk, pad |
| Loss | CTC, plus an auxiliary CTC head at layer 6 (weight 0.3) |
| Size on disk | 235 MB (fp32) |
| Language head | KenLM 5-gram, 6.4 GB, entirely optional, swappable at run time |
| Measured RTF | 0.015 – 0.030 on 4 CPU threads (≈ 33–66× real time) |
The important structural point is the split between the two halves:
- The acoustic core learns what Egyptian Arabic sounds like. It takes days on a GPU and is then frozen forever.
- The language head learns what Egyptian Arabic word sequences are plausible. It is a plain n-gram model, trains on text alone in minutes on a CPU, and can be swapped out per domain without touching the acoustic model.
That separation is the core design bet of this project, and Section 7 is essentially a test of whether the bet paid off.
2. Inside the architecture
2.1 From waveform to frames
Audio arrives as a 16 kHz mono waveform. It becomes an 80-bin log-Mel spectrogram with a 10 ms hop, so 100 vectors per second of audio.
Then a convolutional subsampling stage runs two stride-2 2-D convolutions, cutting the sequence length by 4×. We now have 25 frames per second — one frame every 40 ms.
Remember that number. Almost everything interesting in this article follows from it.
Why subsample at all? Two reasons. Self-attention costs grow with the square of sequence length, so a 4× reduction makes attention 16× cheaper. And 10 ms is far finer than any linguistic unit — no phoneme is 10 ms long — so the extra resolution is wasted.
2.2 The Metro block
Each of the 12 encoder blocks is a Conformer-style sandwich: a feed-forward network, then self-attention, then a convolution module, then another feed-forward network.
Four choices inside are worth explaining in plain terms.
RoPE instead of learned position embeddings. The model needs to know where in the utterance each frame sits. Rather than adding a learned "position 47" vector, RoPE rotates the query and key vectors by an angle proportional to position. The consequence is that attention scores end up depending only on the distance between two frames, not their absolute indices. Practically: a 60-second clip still decodes sensibly even if training only ever saw 30-second clips.
RMSNorm, applied before each sub-layer. Standard LayerNorm subtracts the mean and divides by standard deviation. RMSNorm skips the mean subtraction and the bias term — one reduction instead of two. Slightly faster, and empirically no worse. Placing it before each sub-layer (pre-norm) rather than after keeps gradients well-behaved in deep stacks.
SE-gated depthwise convolution. Attention is global — every frame can look at every other frame. But speech has strong local structure too: a consonant is shaped by its neighbours. The depthwise convolution uses a kernel of 31 frames, which at 40 ms per frame covers about 1.24 seconds of local context. The squeeze-and-excitation gate then reweights channels based on a global average — cheap, and it helps.
SwiGLU feed-forward, half-weighted. Instead of one big feed-forward block, there are two, each contributing half its output to the residual (the "macaron" arrangement). Each uses a gated activation: one linear projection decides what information to pass, another decides how much. At equal parameter cost this outperforms a single full-weight feed-forward network.
Stochastic depth ramps linearly across the stack: early blocks are always active, later blocks are randomly skipped during training with probability up to 0.05. This regularises the deep end of the network without harming the feature extractors at the bottom.
2.3 Auxiliary CTC
There is a second CTC head attached to layer 6, halfway up the stack, contributing 0.3 of its loss to the total.
This is a small detail with an outsized effect. In a 12-layer stack trained with a loss applied only at the top, the middle layers learn only through gradients that have travelled a long way. Attaching a real prediction target halfway up forces layers 1–6 to produce something already decodable on their own. It is dropped entirely at inference time, so it costs nothing at run time.
2.4 The blank bias trick
One line in the model definition is worth calling out:
self.ctc_head.bias.data[0] = -3.0
Index 0 is the CTC blank token. This initialises the model biased against emitting blank.
That sounds backwards — as we are about to see, the correct answer is blank most of the time. But at the start of training, a model that immediately learns "always predict blank" has found a strong local minimum that produces empty transcripts and no useful gradient. Starting biased against blank forces the model to attempt real predictions early, and it discovers the correct blank rate on its own within a few thousand steps.
2.5 How it was trained
Training runs in four stages, and only one of them needs a GPU.
Stage 1 — prepare the data. Roughly 130,000 Egyptian Arabic clips are merged from eight public
datasets, plus a code-switching corpus and LibriSpeech train.clean.100 for native English.
Transcripts are normalised, empties dropped, and clips outside 0.5–30 seconds discarded.
The test split is stratified, not random, and this detail matters more than it sounds. The corpus is roughly 8% code-switching. A random 500-sample test split would contain about 40 code-switched clips — not enough to measure the one capability the model exists for. The split instead guarantees 200 code-switching and 300 pure-Arabic samples.
Stage 2 — train the tokenizer. SentencePiece BPE, 5,000 tokens, over a pool that is forced to a
50/50 Arabic–English balance by downsampling the larger side, with all code-switching text added on
top. Settings: character_coverage=0.9995, split_digits=True, and byte_fallback=False — the last
of which reclaims 256 vocabulary slots that would otherwise be spent on byte tokens.
Stage 3 — train the language head. KenLM 5-gram over ASR transcripts, an Egyptian text corpus, and LibriSpeech transcripts. CPU only, minutes, no audio. This stage is independent of stage 4 and can be rerun any time.
Stage 4 — train the acoustic model. The only expensive one.
| Optimiser | AdamW, weight decay 0.01 |
| Learning rate | 1e-3 peak, 10,000-step linear warmup from 2%, cosine decay to 2% |
| Batch | 32 per device × 4 gradient accumulation steps × N devices |
| Precision | bf16 |
| Gradient clipping | 1.0 |
| Loss | CTC + 0.3 × auxiliary CTC at layer 6 |
| Augmentation | SpecAugment (2 frequency masks ≤27 bins, 2 time masks ≤50 frames), speed perturbation ×{0.9, 1.0, 1.1} |
| Schedule | up to 600,000 steps; the runs analysed in this article are 300,000 |
Speed perturbation is doing something specific for a CTC model. Resampling the audio to 0.9× or 1.1× changes the number of frames for the same transcript, which forces the model to learn the token-to-frame mapping at several speaking rates rather than memorising one alignment. For a loss function whose entire job is marginalising over alignments, that is a well-matched augmentation.
3. How CTC actually works, and the frame budget it imposes
This section is the conceptual core. Everything in Sections 4 and 5 is a consequence of it.
3.1 The alignment problem
We have 25 frames per second of audio. We have a target transcript. Nobody has told us which frame corresponds to which character.
If someone says the word "قال" over half a second, that is 12 frames for 3 characters. Which frames are the "ق"? We do not know, and labelling it by hand for every clip is impossible.
CTC's solution: do not require an alignment. Sum over all of them.
The model emits a probability distribution over the vocabulary at every frame, with one extra symbol added — the blank, written ∅. Then define a collapsing rule:
- Merge runs of the same repeated token.
- Delete all blanks.
So for the target قال over 12 frames, all of these are valid:
∅ ∅ ق ق ق ∅ ا ا ل ل ∅ ∅ → قال
ق ∅ ∅ ا ∅ ∅ ∅ ∅ ∅ ل ∅ ∅ → قال
∅ ق ا ا ا ا ا ∅ ∅ ∅ ل ∅ → قال
CTC training computes the total probability of every frame-labelling that collapses to the correct transcript, and maximises it. A dynamic-programming algorithm does this efficiently. The model is never told where the boundaries are; it discovers them.
The blank does double duty. It absorbs silence and frames the model is unsure about, and — critically — it separates genuine repeated letters. Without a blank between them, ل ل in الله would collapse to a single ل.
3.2 The frame budget
Here is the constraint that matters, and it is simply arithmetic.
To emit a transcript of L tokens you need at least L frames — you cannot emit two tokens from one frame. In practice you need more, because repeated tokens must be separated by blanks. So:
T ≥ L, where T is the number of frames and L the number of target tokens.
We have T fixed at 25 frames per second. L depends entirely on your tokenizer. And this is where the tokenizer stops being a preprocessing detail and becomes an architectural decision.
We measured the real numbers on the 11 human-transcribed reference clips that ship with the repository:
| Quantity | Measured |
|---|---|
| Frame rate | 25.0 frames/second |
| Speech rate | 11.3 characters/second |
| BPE compression (5,000 vocab) | 2.54 characters per token |
| BPE token rate | 4.5 tokens/second |
Now the two tokenizers face very different situations:
Character tokenizer: 11.3 tokens/s against 25 frames/s. Roughly 2.2× headroom. Of every 100 frames, about 45 carry a character and 55 carry blank.
BPE tokenizer: 4.5 tokens/s against 25 frames/s. Roughly 5.6× headroom. Of every 100 frames, about 18 carry a token and 82 carry blank.
Which yields a falsifiable prediction:
Expected blank probability: ≈ 0.55 for characters, ≈ 0.82 for BPE.
We had not looked at the blank-probability logs when we computed this. Let us look now.
4. Experiment 1 — BPE versus characters
Two runs. Identical architecture, identical data, identical hyperparameters, identical 300,000 training steps. The only difference is the tokenizer: a 5,000-token SentencePiece BPE vocabulary versus a plain character vocabulary.
4.1 The prediction, checked
The two runs separate into clean, stable bands almost immediately and stay there for 300k steps.
| Predicted from arithmetic | Observed in training | |
|---|---|---|
| Character tokenizer | 0.55 | ≈ 0.53 |
| BPE tokenizer | 0.82 | ≈ 0.83 |
Both within two percentage points, from nothing but speech rate, compression ratio, and frame rate.
This is worth pausing on, because it tells you what the model is really doing. The BPE model spends 83% of its output capacity saying "nothing here". Only about one frame in six carries linguistic content. The model's job is split between deciding when to emit and deciding what to emit, and with BPE the "when" question dominates by volume.
The sharp vertical line at step 0 on the character run is the blank-bias initialisation from Section 2.4 correcting itself — the model starts biased against blank and climbs to its natural rate within the first few hundred steps.
4.2 Training and evaluation loss
The BPE run starts far higher — around 25 on training loss and 5.2 on eval loss, against roughly 6 and 2.5 for characters.
This is not a sign that BPE is harder. It is a direct consequence of vocabulary size. At initialisation the model is uniform over its vocabulary, so per-token loss starts near ln(V): ln(5000) ≈ 8.5 against ln(~100) ≈ 4.6. Combined with CTC's mean reduction dividing by target length — and BPE targets being 2.54× shorter — the gap is exactly what you would expect.
Loss values are not comparable across different vocabularies. They measure different things. Only WER and CER are comparable, which is why they are the metrics that matter below.
4.3 The result that matters
Here is the finding. Watch the two metrics carefully, because they disagree.
| At 300k steps | Character | BPE |
|---|---|---|
| CER | ≈ 0.088 | ≈ 0.088 |
| WER | ≈ 0.210 | ≈ 0.185 |
Character error rate is essentially identical. For most of training the character model is even marginally ahead — unsurprising, since it optimises character prediction directly.
Word error rate is about 12% relatively better for BPE.
So the two models hear equally well. They differ in what they write.
The reason is that a BPE token is a chunk of a real word that appeared in real text. When a BPE model is uncertain, its available guesses are all fragments of things people actually write. A character model, uncertain about one letter in the middle of a word, will happily emit a letter that produces a non-word — and one wrong character destroys the whole word for WER purposes, while barely moving CER.
You can see this exact failure in the real greedy outputs later: الذككرة for الذاكرة, الانفعاعالية for الانفعالية. Those are one or two characters off — trivial for CER, fatal for WER.
Finding 1. At fixed data and fixed parameters, a subword tokenizer does not make the acoustic model hear better. It makes it spell better. CER is unchanged; WER improves ~12% relative. The tokenizer is a lexical prior smuggled into the output layer.
This is also why the released Metro-ASR-Small uses BPE. It is not free — it costs the 5.6× frame headroom and the 83% blank rate — but for a metric anyone actually cares about, it wins.
5. Why a bigger vocabulary is a trade, not an upgrade
If 5,000 BPE tokens beat ~100 characters, why not 32,000?
This is the single most common intuition we want to push back on, because it sounds like a free win — larger vocabulary, shorter sequences, more frame headroom, better compression. Every arrow points the right way.
It is not free, and the cost is not obvious until you count it.
We measured it directly: SentencePiece BPE models were trained at eight vocabulary sizes on 92,000 lines (45 M characters) of real Egyptian text — code-switching transcripts, Egyptian medical dialogue, and Egyptian Arabic Wikipedia — then evaluated on held-out text from the same pool.
| BPE vocab | chars / token | tokens / s | frame headroom | blank rate | seen < 100× | seen < 1000× | CTC head params |
|---|---|---|---|---|---|---|---|
| 256 | 1.76 | 6.42 | 3.9× | 0.743 | 2.3 % | 10.5 % | 0.10 M |
| 512 | 2.24 | 5.05 | 5.0× | 0.798 | 2.0 % | 10.9 % | 0.20 M |
| 1,000 | 2.64 | 4.29 | 5.8× | 0.828 | 3.9 % | 15.8 % | 0.38 M |
| 2,000 | 3.03 | 3.72 | 6.7× | 0.851 | 4.5 % | 44.4 % | 0.77 M |
| 5,000 ← | 3.52 | 3.21 | 7.8× | 0.872 | 8.2 % | 81.9 % | 1.92 M |
| 8,000 | 3.75 | 3.02 | 8.3× | 0.879 | 29.1 % | 90.0 % | 3.07 M |
| 16,000 | 4.05 | 2.79 | 9.0× | 0.888 | 64.5 % | 95.9 % | 6.14 M |
| 32,000 | 4.29 | 2.64 | 9.5× | 0.895 | 84.3 % | 98.3 % | 12.29 M |
Measured on 92,000 lines (45 M characters) of Egyptian text. "Seen < N×" is the share of the vocabulary expected to occur fewer than N times in the audio of a 500-hour training corpus, given the token's frequency in text and the measured speech rate of 11.3 characters/second.
Note the dotted line on the left panel. An Arabic-only 5,000-token model reaches 3.52 characters per token, but the tokenizer Metro-ASR actually ships measures 2.54 on the same transcripts. The difference is that the shipped tokenizer is trained on a deliberate 50/50 Arabic–English split, so roughly half its slots hold English pieces. A 5,000-token bilingual vocabulary behaves like a ~2,500-token vocabulary in each language. That is the price of code-switching support, paid in compression, and it is worth knowing you are paying it.
Three separate costs stack up as the vocabulary grows.
Compression is logarithmic; rarity is not. Going from 5,000 to 32,000 tokens — a 6.4× larger vocabulary — buys 3.52 → 4.29 characters per token, a 22% improvement. The frequent word pieces are already covered by the first few thousand merges; everything after that is long-tail. Meanwhile the share of the vocabulary the model can barely learn goes from 8% to 84%.
Every token needs acoustic examples, and the budget is fixed. This is the real problem, and it is specific to speech.
In a text language model, a rare token still gets gradient from every context it appears in across a huge corpus. In CTC ASR, a token can only be learned from audio where someone actually said it. The audio budget is finite, and token frequencies follow a Zipf distribution, so the tail is brutal: when you enlarge the vocabulary, the tokens you add are by construction the rarest ones.
The right-hand panel above quantifies this. At V = 5,000, about 8% of the vocabulary would be seen fewer than 100 times in 500 hours of speech. At V = 16,000 that is 65%. At V = 32,000, 84% — five sixths of the output units would be effectively untrained.
A CTC model cannot learn a reliable acoustic mapping for a token it has seen thirty times. And an untrained output unit is worse than an absent one: it has a poorly-estimated distribution that can still win an argmax on an unlucky frame, inserting a rare token into an otherwise clean transcript.
The output layer eats the encoder. The CTC projection is d_model × V. At V = 5,000 that is 1.92 M parameters, about 3% of the model. At V = 32,000 it is 12.29 M — 20% of a 61 M-parameter budget spent on a single output layer, taken directly from the encoder that does the actual listening. You pay twice: once in untrainable tokens, once in the capacity you gave up to have them.
Finding 2. Vocabulary size trades sequence compression against per-token example count. With data fixed, past a certain point every additional token is one the model cannot learn, while stealing parameters from the encoder. A larger tokenizer with the same data does not make a better model — it makes a differently-broken one.
The practical rule that follows: scale the vocabulary with the data, not with the ambition. If you scale the corpus 10×, revisit it. If you do not, do not.
There is a good diagnostic for this in the repository's tokenizer script — after training it prints which common English words survive as single tokens. If download, video, and project are each being split into three pieces, the vocabulary is too small or the English share of the tokenizer corpus is too low. That check costs seconds. Discovering the problem after training the acoustic model costs days.
6. The detachable language head
6.1 What CTC cannot do
Return to the weakness we set aside in Section 1.
CTC's speed comes from assuming every frame is independent given the audio. That assumption is what allows one parallel forward pass. It is also factually false about language. In the sequence الذاكر_, the last letter is overwhelmingly likely to be ة. A CTC model, deciding that frame independently, does not know this.
No amount of extra training data fixes it, because it is baked into the loss function. The model is not permitted to condition its answer at frame 40 on its answer at frame 39.
So the fix has to come from outside — after the acoustic model has spoken.
6.2 Shallow fusion
The acoustic model gives us, for each frame, a log-probability for every token. Greedy decoding takes the argmax at each frame and applies the collapsing rule. Fast — about 6 ms per clip — and it throws away everything except the single best guess per frame.
Beam search keeps the best K candidate transcripts alive simultaneously, extending each frame by frame. Because we are now tracking whole sequences, we can score them with a language model. Each candidate is ranked by:
score = log P_acoustic(text | audio) # what the audio says
+ α · log P_LM(text) # what the language model expects
+ β · (number of words) # a bonus per word kept
This is shallow fusion: the two models were trained separately and never see each other; they are only combined at decode time, through two scalars.
α (alpha) — how much the language model's opinion counts. At 0 the LM is ignored. Raise it and the decoder increasingly prefers fluent text over what the audio literally supports.
β (beta) — a bonus for every word retained. This exists to fix a specific bias. A language model assigns a probability to every word, and probabilities are less than 1, so every additional word makes a sequence less probable. Left alone, the LM-guided decoder systematically prefers shorter transcripts and deletes words. β pays the decoder to keep them.
The language model here is a KenLM 5-gram: a count-based model that stores, for every sequence of up to 5 tokens seen in its training text, how often it occurred, with smoothing for unseen sequences. No neural network, no GPU, trains on text alone in minutes.
One detail from the training recipe deserves mention because it is doing real work. Code-switched text is a small fraction of any Arabic corpus. An n-gram model trained on the natural distribution assigns Arabic→English transitions such low probability that it deletes the English words at decode time. The recipe repeats the code-switching text 20× to bring 12 K sentences up to 240 K, comparable with the Arabic side. Without that, the language head actively damages exactly the capability the model exists for.
7. Experiment 2 — greedy versus beam search with KenLM
7.1 Setup
Eleven clips of real Egyptian speech with human reference transcripts, shipped in the repository: seven general conversational clips from YouTube, two technical, two medical. The last four are heavy with Arabic-English code-switching.
Scoring follows standard Arabic ASR practice: lowercase, strip punctuation and diacritics, unify the Alef/Ya/Ta-Marbuta orthographic variants. Those are transcription conventions, not recognition errors, and counting them would penalise every decoder equally but meaninglessly.
7.2 Aggregate results
WER / CER in percent, lower is better. All measured on CPU with the released checkpoint.
| Decoder | All (11) | General (7) | Technical (2) | Medical (2) |
|---|---|---|---|---|
| Greedy | 30.0 / 12.8 | 25.6 / 8.8 | 34.8 / 19.3 | 44.9 / 19.3 |
| Beam 100, α=0.5, β=5.0 | 26.1 / 10.6 | 24.7 / 8.3 | 26.2 / 12.7 | 34.7 / 18.4 |
| Beam 100, α=1.0, β=5.0 | 27.5 / 15.2 | 22.5 / 8.9 | 35.5 / 27.5 | 36.7 / 21.2 |
| Beam 100, α=0.5, β=3.0 | 24.3 / 11.4 | 21.6 / 7.1 | 27.7 / 17.6 | 32.7 / 20.2 |
The headline: 30.0 → 24.3 WER, a 19% relative reduction, from a component that requires no GPU, no audio, and no retraining of the acoustic model.
The benefit is not evenly distributed, and the pattern is informative:
- General speech: −16%. The acoustic model is already reasonably good here.
- Technical: −20%. More rare and borrowed vocabulary.
- Medical: −27%. The most specialised vocabulary, the weakest acoustic baseline, and the largest gain.
The language head helps most exactly where the acoustic model is weakest. It is not a uniform polish; it is a repair mechanism that engages when the audio evidence is ambiguous.
Notice also the α=1.0 row. It has the best general-speech WER of any setting (22.5) but the worst CER of any beam setting (15.2), and it is worse than greedy on technical clips. That is the signature of an over-confident language model: when it is right it fixes whole words at once, and when it is wrong it is wrong by whole words too.
7.3 The α sweep
A clean U-shape, and both ends are instructive.
At α = 0 (38.6 WER) the decoder is worse than greedy. This surprises people. With α = 0 the language model contributes nothing — but β = 3.0 is still paying a bonus for every word retained, with no LM to judge whether those words are plausible. The result is spurious insertions. β without α is actively harmful, which is a good reminder that the two parameters are not independent knobs.
At α = 3.0 (39.2 WER) the language model has effectively taken over. It rewrites what was clearly said into what its training text considers likely. CER doubles, from its minimum of 10.9 (at α = 0.4) to 21.6 — the transcripts are fluent Egyptian Arabic that does not match the audio.
The optimum sits at α ≈ 0.4–0.6, and it is a fairly flat basin. Anything in that range is fine; the cliff is on the high side.
7.4 The β sweep
Also a U-shape, and the two metrics disagree about where the bottom is: WER prefers β = 3.0 (24.3), CER prefers β = 5.0 (10.6).
That is not a contradiction. Higher β keeps more words. Keeping a partially-correct word helps CER — several of its characters are right — while a word that is not exactly right still counts as a full WER error. Which you prefer depends on what you are doing with the output. For human reading, higher β. For keyword matching, lower.
The failure at β = 10 is dramatic (43.7 WER): the decoder is paid so much per word that it pads the transcript with anything it can justify.
7.5 Beam width, and what it costs
| Beam width | WER | CER | Decode time / clip |
|---|---|---|---|
| Greedy | 30.0 | 12.8 | 5.9 ms |
| 1 | 35.5 | 20.1 | 31 ms |
| 5 | 28.2 | 13.9 | 43 ms |
| 10 | 27.6 | 13.5 | 51 ms |
| 25 | 26.5 | 12.5 | 69 ms |
| 50 | 24.7 | 11.5 | 88 ms |
| 100 | 24.3 | 11.4 | 128 ms |
| 200 | 24.3 | 11.4 | 178 ms |
| 400 | 24.1 | 11.1 | 351 ms |
Two things to read here.
Accuracy saturates at about beam 50–100. Going from 100 to 400 costs 2.7× the decoding time for 0.2 WER points. If you are latency-sensitive, beam 50 gives you 90% of the benefit for 69% of the cost.
Beam width 1 is worse than greedy (35.5 vs 30.0), despite sounding like it should be identical. A beam of 1 is not greedy CTC — it is a single-hypothesis LM-guided search, which commits early to LM-preferred prefixes with no ability to recover. Greedy at least uses the pure acoustic argmax.
The speed cost is real and should be stated plainly. Greedy decoding is 6 ms per clip. Beam 100 with a 6.4 GB language model is ~128 ms — more than 20× slower at the decoding stage. In whole-pipeline terms it is milder, because the encoder forward pass (250–350 ms for a 20 s clip) dominates either way: measured end-to-end RTF goes from about 0.015 to about 0.019. Still 50× faster than real time. But the language head is not free, and on very short clips the relative cost is much larger.
For context, here is the whole pipeline's measured CPU latency across clip lengths:
Real-time factor improves with clip length — from 27× on a 1-second clip to a peak around 55× at 10 seconds — because fixed overheads amortise. The dip at the long end is the quadratic cost of full self-attention beginning to show.
Finding 3. A 6.4 GB n-gram model, trained on text alone in minutes on a CPU, buys a 19% relative WER reduction on a 61 M-parameter acoustic model — larger than the gap between the character and BPE tokenizers, and achieved without touching the acoustic weights. Both α and β have sharp optima, and the wrong settings make things worse than greedy.
8. Worked examples
Numbers are summaries. Here is what the two decoders actually produce. Errors are marked against the human reference.
8.1 Egyptian Arabic — where the language head shines
Example A — conversational, informal.
| Greedy | متجمعين عند النبي ولو إن اللي زيكم ما يتجمعوش إلاسيواهنم أنا جاي أقولكم أشوف وشكم بخير قصدي يعني ده اتورين وشوشكوا بعد كده أنا جاي أقولكوا أنا ماشي مش هشتغل معاوا تاني |
| Beam + LM | متجمعين عند النبي ولو إن اللي زيكم ما يتجمعوش إلا في جهنم أنا جاي أقولكم أشوف وشكم بخير قصدي يعني ده اللي تورين وشوشكم بعد كده أنا جاي أقول له أنا ماشي مش هشتغل معاكوا تاني |
| Reference | متجمعين عند النبي ولو إن اللي زيكم ما يتجمعوش إلا في جهنم أنا جاي أقولكم أشوف وشكم بخير قصدي يعني داهية لا توريني وشوشكم بعد كده أنا جاي أقول له أنا ماشي مش هشتغل معاكوا تاني |
WER 27.8 → 8.3. Four greedy errors, three of them fixed outright.
The most striking is إلاسيواهنم → إلا في جهنم. Greedy produced a single meaningless blob of characters. This is the CTC independence assumption in its purest form: each frame independently picked a plausible letter, and nothing enforced that the result be a word. The 5-gram knows the phrase إلا في جهنم, and the beam search — which is tracking whole sequences, not frames — could find it.
Note the honest failure too: داهية لا توريني became ده اللي تورين — fluent, and still wrong. The LM fixed three of the four errors outright and left the fourth wrong in a different way.
Example B — a perfect repair.
| Greedy | ...احنا درسنا في معهد ال الذككرة الانفعاعالية، الذككرة الحسية، ال الذكارة الانفعالية... في المواصلات... |
| Beam + LM | ...احنا درسنا في المعهد الذاكرة الانفعالية، الذاكرة الحسية، الذاكرة الانفعالية... في الموصلات... |
| Reference | ...احنا درسنا في المعهد الذاكرة الانفعالية، الذاكرة الحسية، الذاكرة الانفعالية... في الموصلات... |
WER 25.0 → 0.0. CER 7.6 → 0.0.
Look at the greedy errors: الذككرة for الذاكرة, الانفعاعالية for الانفعالية, الذكارة for الذاكرة. Each is one or two characters wrong — doubled letters, a transposition. This is precisely the failure mode predicted in Section 4.3: the acoustic model heard correctly (CER only 7.6) but could not spell, because nothing in CTC enforces that output be lexically valid.
Note that the term الذاكرة الانفعالية ("emotional memory") appears three times, and greedy spelled it wrong three different ways. Frame-independent decisions produce inconsistent errors. The language head fixed all three identically.
Example C — mostly right already.
| Greedy | ...نتكلم بقى ع البيوت... لحد محتاجه فاضعف الايمان... اساليب التخزين مهمكمده |
| Beam + LM | ...نتكلم بقى على البيوت... لحد محتاجه اضعف الايمان... اساليب التخزين مهم |
| Reference | ...نتكلم بقى على البيوت... لحد محتاجه اضعف الايمان... اساليب التخزين مهمة |
WER 7.5 → 3.8. The trailing مهمكمده — a clear case of the model running out of audio mid-word and emitting noise — becomes مهم, close to the reference مهمة. Both decoders miss the proper noun كومال (transcribing كمال); a name the LM has never seen is not something a language model can help with.
8.2 English — the same mechanism, a different language
The model was trained with LibriSpeech alongside the Egyptian data, so it handles native English too. These are read-speech clips. No official reference transcripts were available for these, so the judgements below are on English lexical validity and context, not on a scored reference.
En_2 (23.3 s) — a single, decisive fix:
from the respect paid her on all sides she seemed like a queen and from the adderation → adoration with which she was treated by two or three she appeared in object of worship...
adderation is not a word. adoration is. One frame's worth of acoustic ambiguity, resolved by a 5-gram.
En_3 (5.6 s) — where α matters:
| Decoder | Output |
|---|---|
| Greedy | the poor little things cried synthia think of them having been turned to the wall all these years |
| Beam, α=1.0 | the poor little things cried cia think of them... |
| Beam, α=0.5 | the poor little things cried cynthia think of them... |
At α = 0.5 the model recovers the name cynthia correctly. At α = 1.0 it deletes most of it, producing cia. This is the deletion bias from Section 6.2 in miniature: the LM finds a rare proper noun improbable and, given too much authority, drops it. A concrete demonstration that α is not "more is better".
En_1 (14.2 s) — where the language head makes things worse:
| Decoder | Output |
|---|---|
| Greedy | the english ved to the french basket of flowers of which they had made a plentle provision to greet the arrival of the young princess... invited the english to a supper |
| Beam, α=1.0 | the english fled to the french baskets of flowers... to get the arrival... invited the english to his supper |
| Beam, α=0.5 | the english fled to the french baskets of flowers... to get the arrival... invited the english to a supper |
Three changes, and they do not all go the same way. basket → baskets is a fix. But greedy's
to greet the arrival — which is correct English and almost certainly what was said — becomes
to get the arrival, which is not. The 5-gram found to get the more probable than to greet the
and overrode a correct acoustic decision.
Note also that α = 1.0 produces to his supper where α = 0.5 keeps the correct to a supper — the
same over-confidence pattern as En_3, in a different sentence.
En_5 (12.6 s) — a hard clip, honestly reported:
| Decoder | Output |
|---|---|
| Greedy | gir turnard away impiently again and sny to his men to follow they all began a trip of the steve track leading towards the holes with the rabbit scuddling away among the firs he had showly their weake coty tails from mo as they darted down into their holes |
| Beam, α=0.5 | girard away impiently again and sunny to his men to follow they all began a trip up the steep track leading towards the holes with the rabbit scudding away among the firs he could show me the wake cot tails from open as they darted down into their holes |
Seven changes. Several are clear wins: steve track → steep track, scuddling → scudding, a trip of → a trip up. Others are the LM confidently producing fluent nonsense from bad acoustics: had showly their weake coty → could show me the wake cot. Neither is right.
This is the honest picture. When the audio is genuinely hard, the language head does not recover the truth — it produces something that reads better while remaining wrong. It is a fluency prior, not a comprehension engine.
En_6 (5.0 s) — the null result, which matters:
and and you have not found out anything came in quick frightened tones
Identical across greedy, α=0.5, and α=1.0. When the acoustic model is confident and its output is already fluent English, the language head correctly leaves it alone. A decoder that changed this would be a decoder you could not trust.
8.3 Code-switching — the actual target
This is what the model exists for.
cs_2 (20.5 s) — Egyptian Arabic with dense English technical vocabulary:
طيب، طب أنت جربت او عملت كده مرة إن إنت كنت في evaluation أو في حاجة بتتكلم عن topic، ال topic ده انت مش فهمه كويس، فإنت اضطريت إن إنت تتكلم english و تقول كلام كبير عشان اللي قدامك يحس إن انت okay انت فاهم، فخلاص okay يالا bye bye bravo عليك، وخلاص، عملت كده؟
Seven English words and phrases embedded in Egyptian Arabic, with correct script for each, and no spurious transliteration in either direction. The greedy and beam outputs differ only in punctuation and one word (فاهمه → فهمه).
This is where the 50/50 Arabic-English tokenizer balance and the 20× code-switching upsampling in the language-model corpus pay off. The tokenizer keeps English words whole rather than shattering them into fragments; the upsampled LM does not penalise the Arabic→English transition into oblivion.
cs_1 (5.3 s) — a shorter case:
| Decoder | Output |
|---|---|
| Greedy | وهي إنها بتطلع layer أو طبقة جديدة لجذع الشجرة من ب كل سنة أو كل موسم |
| Beam + LM | وهي إنها بتطلع layer أو طبقة جديدة لجذع الشجرة من برة كل سنة أو كل موسم |
The English word layer survives both decoders intact. The truncated Arabic ب is completed to برة by the language head.
9. What we assumed, and where this could be wrong
Being explicit about this matters more than the results.
The evaluation set is small — eleven clips. Seven general, two technical, two medical. That is enough to see a 19% relative effect, and nowhere near enough to resolve differences of one or two WER points. Every per-domain number rests on two clips. Treat the direction as solid and the precision as illustrative.
The α/β optima were tuned and evaluated on the same eleven clips. This is the most important caveat in the article. The reported optimum (α=0.5, β=3.0 → 24.3 WER) is therefore optimistic — it has not been validated on held-out data. The shape of the curves (a U with a flat basin around α≈0.5, catastrophe at high α and high β) is a robust and mechanistically explicable finding. The exact minimum is not. The repository's own default of α=0.5, β=5.0 scores 26.1 on this set, and may well generalise better.
The blank-probability prediction used measured aggregates. Speech rate (11.3 chars/s) and compression (2.54) came from the same eleven reference transcripts. They are averages over roughly three minutes of audio. The agreement with training logs to within two points is a genuine check, but a modest one.
The tokenizer-scaling analysis is a text-side measurement, not a set of trained models. Compression and token frequencies are measured on 45 M characters of real Egyptian text, but no acoustic model was trained at each vocabulary size — that would be eight full training runs. The conversion to "acoustic examples per token" assumes a 500-hour corpus and that transcript token statistics resemble general Egyptian text; the corpus here is Wikipedia-heavy, which skews formal. The percentages scale linearly with corpus hours — at 5,000 hours, divide the starvation rates accordingly. The mechanism (Zipf tails outrunning a fixed audio budget) is sound and the ordering is robust; the exact numbers are illustrative of a trend, not thresholds to design against.
Nothing here proves 5,000 is optimal. It shows the trade exists and where its terms turn unfavourable. Establishing the optimum for this data would require training the models, and we did not.
The BPE-versus-character comparison is a single pair of runs. No seed variance. A 12% relative WER gap is large enough that seed noise is unlikely to explain it, especially given the two curves separate consistently from step 50k onward, but it is one comparison, not a distribution.
The English examples have no scored references. They are qualitative demonstrations. adderation → adoration is obviously a fix and greet → get is obviously a regression, but neither is a measurement. The English clips were chosen to illustrate mechanisms, not to benchmark English performance — which this article does not attempt.
One known defect in the current decoding path. pyctcdecode warns at load that unigrams could not be derived from the binary KenLM (they can only be extracted from ARPA format), and states that results "might be a lot worse" without them. Every beam-search number in this article was produced under that condition. Supplying a unigram list would likely improve all of them — meaning the language head's contribution reported here is a lower bound.
10. Reproducing all of it
pip install metro-asr[lm]
from metro_asr import MetroASREngine
engine = MetroASREngine.from_pretrained("mohammedaly22/Metro-ASR-Small", lm_path="auto")
# greedy — ~6 ms decode
print(engine.transcribe("audio.wav").text)
# beam + language head
print(engine.transcribe("audio.wav", beam_search=True,
beam_width=100, lm_alpha=0.5, lm_beta=3.0).text)
To sweep parameters without paying for the encoder each time, split the pipeline:
enc = engine.encode("audio.wav") # acoustic model, once
for a in [0.3, 0.5, 0.7, 1.0]:
r = engine.decode_logits(enc, beam_search=True,
beam_width=100, lm_alpha=a, lm_beta=3.0)
print(a, r.text)
The rest of the family
The architecture is defined once and scaled by width, depth, and vocabulary. Only Small is released as a checkpoint — Medium and Large exist as configurations, and everything in this article refers to Small.
Worth noting in light of Section 5: the larger configurations raise the BPE vocabulary to 8,000 and 16,000 respectively. Given the analysis above, those numbers only make sense alongside a correspondingly larger training corpus. Scaling the vocabulary without scaling the audio would reproduce exactly the failure mode we measured.
| Resource | Link |
|---|---|
| Model | mohammedaly22/Metro-ASR-Small |
| Interactive demo | Metro-ASR Space |
| Code | MohammedAly22/metro-asr |
Summary
Three findings, in order of how much they surprised us.
1. The tokenizer is a lexical prior, not a preprocessing step. BPE and character models achieve identical CER — they hear equally well. BPE wins ~12% relative on WER because its output units are fragments of real words, so its mistakes tend to still be words. We predicted the blank-emission rate of both models from arithmetic alone (0.55 and 0.82) before looking at the logs, and observed 0.53 and 0.83.
2. A bigger vocabulary is a trade, not an upgrade. Going 5,000 → 32,000 tokens buys 22% more compression while taking the share of the vocabulary seen under 100 times from 8% to 84%, and growing the output layer from 3% to 20% of the parameter budget. Scale the vocabulary with the data or not at all.
3. A cheap n-gram beats a bigger encoder, for this budget. A KenLM 5-gram — text-only, minutes on a CPU, swappable per domain — cut WER 19% relative, and 27% on the hardest domain. That is a larger effect than the tokenizer choice, obtained without touching the acoustic model. But α and β have sharp optima, and wrong settings are worse than greedy.
The common thread: for a small model on modest data, the largest available gains were not in the neural network. They were in the two components that cost the least — how text is chopped up, and what gets to vote at decode time. That is a comfortable result if you have a CPU and a constraint, and an uncomfortable one if your instinct is to reach for more parameters.
Metro-ASR is released under the Apache 2.0 licence. Corrections and reproductions welcome.
















