Hossam Notebook

Training an Egyptian speech-to-text model

STATS
MODEL
nvidia/nemotron-3.5-asr-streaming-0.6b (compared with Whisper large-v3-turbo and Qwen3-ASR-0.6B)
DATA
about 95 hours (70 h of Egyptian, MGB-3 and FLEURS, plus 4.9 h of code-switching repeated 3 times and 10 h of English)
TRAINING TIME
More than 55 hours (over two days) of training across 15 runs
RESULT
Egyptian clips WER 55.1 to 32.1, code-switching 54.1 to 22.0 with 84% of English words in Latin, English kept (LibriSpeech 3.4 to 4.0)
HARDWARE
Ryzen 5 9500F, RTX 5060 Ti 16 GB, 32 GB DDR5 RAM

I wanted to learn NVIDIA NeMo by doing something real with it: take a streaming speech model that already knows Arabic, fine-tune it on Egyptian dialect, and measure honestly whether it got better. It grew into a three-week project: eleven training runs on NeMo's model, two other models (Whisper and Qwen) scored on the same tests, and a final model that handles Egyptian speech, Egyptian mixed with English, and plain English.

The short version:

  • My first full run cut the error rate on its own data from 55% to 37%. On the test set I actually cared about, it got ten points worse.
  • On a 16 GB card the limit is not the batch size. It is the length of a single clip.
  • Four hours of the right kind of audio did more than 58 hours of the wrong kind.
  • One run silently trained without two of its three datasets, and finished with no warning.
  • My best Egyptian model had forgotten English almost completely, and none of my scores could show it.
  • About fifteen hours of English and real code-switching brought English back, at a small cost to Egyptian.

I worked with Claude Code as a pair programmer the whole way. Some of the wrong guesses below were mine and some were its. I have left them in, because the corrections are where I learned the most.

The setup

The model. nvidia/nemotron-3.5-asr-streaming-0.6b: 638 million parameters, a 24-layer cache-aware FastConformer encoder and an RNNT decoder. It supports Arabic out of the box, so I did not need a new tokenizer.

The hardware. A new mid-range build: Ryzen 5 9500F, one RTX 5060 Ti with 16 GB and 32 GB of DDR5 RAM, running Windows. NeMo does not run on native Windows, so everything trains inside WSL2.

The training data. arabic-egy-cleaned: about 58 hours of Egyptian speech in short clips, 0.5 to 10 seconds with a median of 2.4 seconds. About 85% of it is male speakers and 91% comes from one source.

The test sets.

  • MGB-3: about 8 hours of Egyptian broadcast speech in 30-second clips. This is the real target, and it is a different kind of audio from the training data.
  • FLEURS ar_eg: formal Arabic read aloud by Egyptians. It is not dialect, so I used it to check how much formal Arabic the model forgets.

The rules, fixed before any training. One text normalizer for references and outputs (no diacritics, no punctuation, unified letter forms). Test sets frozen. Success means MGB-3 at or below 34.9% WER, a 15% relative improvement, with FLEURS at or below 13.0%.

One caveat: neither dataset states a clear licence, so this is a learning project.

The untouched model scores 41.07 on MGB-3 and 11.31 on FLEURS. On the first clip it was already writing standard spellings for dialect words: كثير where the speaker says كتير.

Getting to the first training step

Most of my first seven attempts failed before training really started:

  • The fine-tuning script passes only part of the config to the model, so one value had to be set by hand.
  • The RNNT loss needs Numba's CUDA support, which was missing. Inference had worked fine, which hid the problem.
  • The newest numba-cuda calls a function that NumPy 2.5 removed. Pinning NumPy fixed it.
  • Then the GPU ran out of memory on the first batch, twice, with the batch setting from NVIDIA's own notebook.

None of this is interesting on its own. I mention it because it took most of a day.

On 16 GB, the limit is one clip

I kept shrinking the batch and kept running out of memory. So I stopped guessing and measured.

Just holding the model for training costs 9.55 GB: weights, gradients and the optimizer's state. That leaves about 4 GB for the batch itself. And the transducer loss needs memory proportional to audio frames × text tokens × 13,088 output classes. Two clips of 8 to 10 seconds fill the card by themselves.

So no batch-size setting helps. The only thing that fits is short clips. I dropped everything over 6 seconds, which was only 0.62% of the data, and trained.

The run that looked like a success

The first full run improved WER on the training data's own validation split from 55.29 to 36.61. If that had been my only number, I would have written a happy post.

On the real tests:

MGB-3 FLEURS
Untouched model 41.07 11.31
After fine-tuning 51.00 14.89

Both got worse, and MGB-3 got much worse.

Reading the errors before trying again

The two failures turned out to have different causes.

MGB-3 was a length problem. I split each 30-second clip into five equal parts and counted the words the model dropped in each part:

Part of the clip 1st 2nd 3rd 4th 5th
Untouched model 9.2% 7.3% 7.3% 8.2% 12.0%
After fine-tuning 12.5% 20.0% 23.0% 35.2% 52.6%

The fine-tuned model fades as the clip goes on. In 413 clips it simply stops writing before the audio ends; the untouched model does that in 14. Training on clips of 6 seconds or less had taught a long-audio model to stop early.

FLEURS was forgetting. Formal words were now misspelled by sound, and the errors were spread evenly along the clip. That is a different problem with a different fix.

I would not have found either from the WER number alone.

Longer clips, then frozen layers

If short clips cause the problem, train on longer ones. I did not have longer ones, so I made them by gluing unrelated clips together.

Gluing to 11 seconds, the longest that fits with the whole model training, removed about half of the damage. That confirmed the cause and showed that 11 seconds is not enough.

To fit longer clips I had to free memory, and freezing layers does that. With 18 of the 24 encoder layers frozen, a 20-second clip fits.

Run MGB-3 FLEURS Own validation
Untouched model 41.07 11.31 55.29
Clips up to 6 s 51.00 14.89 36.61
Glued to 11 s 44.49 14.11 35.37
18 layers frozen, glued to 20 s 40.51 12.70 43.07
Same, learning rate doubled 41.91 14.80 42.03

The frozen run was the first that did not lose. The early stops were gone and FLEURS was back under its bar. But MGB-3 was only half a point better than the model I started with, which is close to noise, and nowhere near 34.9.

Doubling the learning rate was supposed to squeeze out a bit more. It made both tests worse again. Frozen layers do not protect a model by themselves; how hard you push the trainable part matters too.

Across all these runs one pattern held: the better the model fit the training data, the worse it did on both tests. This dataset transfers very little to broadcast speech.

Four hours of the right audio

So I put real MGB-3 audio into training. I set aside 13 whole programmes as a test set, so nothing leaks between training and test, and cut the rest into pieces that fit in memory. Only 3.66 hours survived the cutting.

On the held-out programmes, WER went from 42.45 to 37.03, a 12.8% relative improvement and the first clear gain of the project. Under four hours of in-domain audio did what four runs on 58 hours of out-of-domain audio could not.

Part of that gain is memorising. On the MGB-3 clips that were in training, WER fell from 40.5 to 31.9; on the programmes it never heard, from 42.5 to 37.0. Most of the gain carries over to new programmes, but not all of it.

MGB-3's own transcripts are not complete either: ... marks speech nobody wrote down in 476 of the 837 training clips, and in one clip a whole spoken sentence is missing.

Starting again with one test set

At this point I had models that were better on two test sets and worse on a third, and no single answer to "which model is better". So I rebuilt everything as one combined dataset with its own train, validation and test splits, each mixing all three sources, and reported the score per source.

Then I tried the obvious experiment: train on 20 hours, 50 hours and 70 hours to see whether more data helps.

Trained on Egyptian clips MGB-3 FLEURS
Nothing (untouched) 55.08 42.45 11.31
20 h 36.15 41.50 11.95
50 h 36.34 41.54 11.97
70 h 35.19 48.22 14.27

Twenty more hours of the same mix made MGB-3 seven points worse. That made no sense, so before explaining it I checked what the model had actually been fed.

The training file listed the Egyptian clips first and the MGB-3 and FLEURS clips at the very end. I was using shortened epochs, and the loader started again from the top of the file each time. In the 70-hour run it never got deep enough to reach the end. That run did not see a single MGB-3 or FLEURS clip. It finished without any warning.

So the table is not a valid test of "does more data help". By accident it shows something else: the 50 h and 70 h runs differ mainly in whether a few hours of MGB-3 and FLEURS were in training. With them, MGB-3 is 41.5. Without them, 48.2.

The data has its own errors

Every run stalled at about 36% on the Egyptian clips, whether it saw 20 hours or 50. My first guess was dialect spelling variants. Measured, that explained 0.06 points.

What the text actually shows:

  • The reference transcripts have misplaced spaces about three times as often as the model's output.
  • The clip ends do not match the text. The last word is wrong in 41% of clips, against 31% for words in the middle.
  • The same words fail everywhere: 77% of the words the fine-tuned model gets wrong, the untouched model gets wrong too.

The same faults are in the training text, so more hours of this dataset teach the same noise.

One long run

A friend pointed out a flaw in the data-size experiment: with a fixed 7,000 updates, more data means each clip is seen less often, and the loss was still falling.

So I fixed the loader (shuffled file, whole passes over the data), made the training text use the same spelling rules as the scorer, and ran once for 21,000 updates, saving a model on the way.

The fix caused its own problem first: two out-of-memory stops. My first explanation, a few heavy clips, was wrong. Replaying the loader showed that without length buckets a short clip and a long clip sometimes land in the same batch, and padding the short one to the long one's length doubles the loss memory. One clip per batch fixed it. After that: fourteen hours, no crash.

Updates Egyptian clips MGB-3 FLEURS
0 (untouched) 55.08 42.45 11.31
7,000 34.87 41.39 11.87
14,000 32.60 40.62 12.16
21,000 31.53 39.33 12.30

Seven thousand updates had been too few. More training keeps helping the dialect data and slowly costs formal Arabic.

A small NeMo detail I learned the hard way: the final .nemo file holds the last update, not the best one, unless you set save_best_model=true.

A different learning-rate schedule

The same friend suggested one more change: keep the data and the 21,000 updates, and swap NeMo's default Noam schedule for cosine annealing (warmup 500, peak 1.3e-4, falling to 1e-6). Both start near the same peak, but Noam drops much faster, so cosine trains at a higher rate for most of the run.

This run did not go smoothly. It crashed three times with a CUDA driver error, each time a few batches after the first validation of a new epoch; the GPU log showed validation memory not being freed. Each time I resumed from the checkpoint saved at that validation. Then the power went out, one minute after a checkpoint. I tested that file (archive check, load, no broken weights) before trusting it. After the reboot the run finished. I still do not know what caused the crashes.

Updates Egyptian clips MGB-3 FLEURS
7,000 35.45 43.61 13.86
14,000 31.40 40.42 13.06
21,000 30.42 39.05 12.36
Noam run at 21,000 31.53 39.33 12.30

At the end, about a point better on Egyptian clips and the same on the other two. The interesting part is the path. At 7,000 updates, with the rate still high, the cosine model was worse than the Noam run on all three and had lost 2.5 points of formal Arabic. As the rate came down, all of it came back. A high learning rate did not destroy the old knowledge; it needed time at a low rate to settle.

Did it forget English?

Before trying other models, I wanted to check two things my tests could not show. My normalizer drops Latin letters on both sides, so every score so far was blind to English.

  • English: LibriSpeech test-clean and test-other.
  • Code-switching: ArzEn, recorded interviews where people mix English into Egyptian naturally: بحس ان الحاجة اللي كنت عاملاها plan وبي depend عليها.

The code-switching dataset had a surprise. Besides ArzEn, it has a second part made of YouTube clips from the same channel as my main training data. Text matching flagged 265 suspicious clips, so I compared the actual waveforms of 25 matched pairs: 22 of them correlated at 0.94 to 1.00, where random pairs give about 0.05. My model had already trained on part of this "test" audio. I dropped that part and tested on 1,000 ArzEn clips.

The results:

  • English is gone. LibriSpeech WER went from 3.44 to 93.20 on test-clean and from 7.65 to 97.30 on test-other. "Congratulations were poured in upon the princess" came out as كتير بور ان دري ج.
  • Arabic in mixed speech improved. On the Arabic words, WER fell from 54.1 to 46.8, on speech it never heard.
  • But English words never come out in Latin any more. 0% of them, against 14% for the untouched model. It writes them in Arabic letters instead: okay as اوكي 102 times, hobbies as والهوبيز, MET as ام اي تي.

Why: not a single training clip was English. The main dataset has no Latin letters at all. Worse, on the audio it shares with the code-switching set, it deletes the English words: آخد Sponsorship من became آخد من. My main training set had partly taught the model to skip spoken English.

A model can improve on everything you measure and still lose something you did not measure. Both checks are now part of every evaluation.

Two other models, untouched

Next I scored two other models, untouched, on exactly the same tests: Whisper large-v3-turbo (809M parameters) and Qwen3-ASR-0.6B (actually about 0.9B, Apache-2.0). Both read the whole clip at once instead of streaming, so they start with an advantage.

Model Egyptian clips MGB-3 FLEURS LibriSpeech clean / other English words in Latin
NeMo, untouched 55.08 42.45 11.31 3.44 / 7.65 14%
Whisper, untouched 59.72 45.12 9.72 2.64 / 4.87 25%
Qwen, untouched 63.82 56.48 18.01 2.27 / 4.70 38%
My NeMo (cosine run) 30.42 39.05 12.36 93.20 / 97.30 0%

Whisper loops. In 47 of the 10,361 Egyptian test clips it repeats the same few words until it hits its length limit; in one clip it writes لا 400 times for a nine-word sentence. Those 47 clips add 6,289 extra words. Without them, Whisper's Egyptian WER is 51.5, about level with untouched NeMo. The reason: Whisper picks each word by looking at the words it already wrote, so once it has written نحن نحن, another نحن looks like the most likely next word, and it never escapes. NeMo's transducer moves forward through the audio as it writes, so it cannot get stuck that way. The usual fixes are at decoding time: a repetition limit, or decoding the clip again with a little randomness when the output looks like a loop.

Whisper also has a trap with code-switching: tell it the language is English and it translates the Arabic instead of transcribing it.

Qwen barely loops, only 3 clips. Many of its errors are formal spellings of Egyptian words: كده as كذا, اكتر as اكثر, دايما as دائما. Whisper does the same, even more formally: مش as ليس, عشان as لكي. That is mostly spelling convention, which fine-tuning should fix quickly, so the raw gap probably overstates how far behind Qwen really is.

Qwen has its own quirk. With automatic language detection it writes the language name as the first words of its output and never changes its mind. Clips that open with an English okay sometimes get labelled Malay, and then the Arabic comes out as Malay in Latin letters: ماشي as masih. 130 of 1,000 clips got a non-Arabic label, though in total that cost only 0.7 points.

No model was good at everything. Untouched, NeMo was best on Egyptian speech, Whisper on formal Arabic, and Qwen on English and on keeping English words in Latin. And always look at the worst clips before comparing two models: 47 clips decided Whisper's headline number.

One model for all three

That set the new goal: a fine-tuned model has to be good at Egyptian speech, at code-switching with English written in Latin, and at plain English. NeMo goes first; Whisper and Qwen will get the same data later.

Splitting the code-switching data honestly. ArzEn has 38 recordings, each with one interviewee and the same two interviewers, and my random 1,000-clip test touched all 38. Training on the rest would leak voices and conversations into the test. So I held out 10 whole recordings. The new test is the old test clips from those recordings: 305 clips, 217 of them from interviewees whose voices are never heard in training. Because it is a subset of the old test, every model I had already run could be rescored from its saved outputs, and the held-out numbers stayed within 1 to 3 points of the full test.

The memory limit again. Only clips of 11 seconds or less fit the full model, and ArzEn has no word timings to cut longer ones cleanly. That left 4.87 hours of the 8.2 in the training recordings.

The mix. The same 70 hours as the cosine run, plus ArzEn repeated three times (14.6 h), plus 10 hours of LibriSpeech English. Same settings as the cosine run, so only the data changes.

One prompt. NeMo trains each clip with either its own language prompt or auto, at random, half the time each. Its config recommends auto for code-switching, so ArzEn always trains under auto. The aim is one model you run with auto on any audio, without knowing the language in advance.

Bars set before the run: Egyptian WER around 30; on the interviewee clips, Arabic WER below 50 with at least 30% of English words right in Latin; LibriSpeech near the untouched model.

The run took 21,000 updates and 13.5 hours in one go, with no crash this time. All scores with the auto prompt, code-switching on the never-heard interviewees:

Model Code-switching, Arabic WER English words in Latin LibriSpeech clean / other Egyptian clips
NeMo, untouched 54.13 20% 3.44 / 7.65 55.08
Qwen, untouched 60.78 41% 2.27 / 4.70 63.82
My NeMo (cosine run) 50.14 0% 93.20 / 97.30 30.42
My NeMo (new mix) 21.95 84% 3.99 / 9.48 32.12

Numbers that good made me suspicious, so I checked before believing them. None of the held-out sentences appears in the training text. The English gain covers 456 different words and stays at 85% even without the ten most common, so it is not just okay and yes. mathematical equations بنقعد نحلها now comes out exactly, where earlier models wrote the English in Arabic letters or dropped it.

auto gives the same scores as the Arabic prompt on Arabic and as the English prompt on English, so one setting works for everything.

The cost is 1.7 points on Egyptian clips (32.1 against 30.4), just above the bar I set, probably because the Egyptian dataset is now 68% of the training data instead of 90%. MGB-3 and FLEURS did not change.

One honest limit: the code-switching gain is mostly within the ArzEn style, interviews with ArzEn's own transcription conventions. On the 64 broadcast clips in MGB-3 that contain English words, English in Latin rose only from 2% to 10%.

The lesson I like most from the whole project: forgetting English was not something the model did. It was something the data did. Ten hours of English and five hours of real code-switching were enough to keep one and teach the other.

This final model is on Hugging Face as Egyptian-NeMo-STT.

And for the record: the best broadcast score is still the frozen run with real MGB-3 audio, at 37.0. No run reached the 34.9 I set at the start.

What I would tell myself three weeks ago

  1. Fix the test sets and the pass mark before training. Without them, the first run would have looked like a win.
  2. Read the errors before choosing the next run. The table of dropped words by position is what separated a length problem from a data problem.
  3. Check what the loader really feeds the model. Replaying the sampler takes a minute. Not doing it cost me a whole series of runs.
  4. A little of the right data beats a lot of the wrong data. That held for broadcast speech, and again for English.
  5. Test what you did not train for. My best Egyptian model had lost English, and no score up to then could show it.
  6. Split by recording, not by clip. A random sample of clips leaks voices and conversations into the test.
  7. Look at the worst clips before comparing models. A few looping clips can decide a headline number.
  8. Measure instead of guessing. Where the memory went, why a score was stuck, what a setting did: several confident first answers were wrong.
  9. System RAM can kill a run too. Two runs died while writing a checkpoint. WSL takes only half of the machine's memory by default, and one small config file fixed it.

What held me back

This was a budget setup, and it showed:

  • Internet. Limited internet in Egypt made it impractical to download more datasets.
  • GPU. A 16 GB card decides how long a clip can be and how much of the model can train, as you saw above.
  • Storage. I do not have the disk space for much more data yet. The build is new, and another SSD is on the list.

What is next

  • Fine-tune Whisper and Qwen on the same mix, and compare all three fine-tuned models on the same tests.
  • For Whisper, fix the looping at decoding time before comparing.
  • Get code-switching beyond the interview style of ArzEn, so it works on broadcast speech too.