CTC, attention encoder-decoder and hybrid CTC/attention for Icelandic, trained from scratch (Samrómur 21.05, 15 h)
Author: Muhammet Çelik (implemented, trained and evaluated these models as part of the team project).
Course project models (İstinye University, NLP course, Project 3: ASR) for the baseline families "CTC encoder" and "attention-based encoder-decoder, including hybrid CTC/attention". All three are trained from random initialization, with no pretrained weights and no language model, and share one encoder design with the project's RNN-T (GokseninMuhammet/rnnt-icelandic-samromur-scratch), so the four neural families are directly comparable.
Code, data and the full benchmark: https://github.com/RanimAlyaseen/icelandic-asr-project3
(training/train_ctc_attention.py, notebooks/ctc_attention_training.ipynb, tests/test_ctc_attention.py).
These checkpoints were produced by code commit 4912e53b396d82f17d9f71243d57a28fec353014.
Files
| File | Model | Selected epoch | Parameters |
|---|---|---|---|
ctc_scratch.pt | CTC encoder | 54 / 60 | 8.17 M |
attention_scratch.pt | attention encoder-decoder (stopped by plateau guard at epoch 16) | 16 | 12.39 M |
hybrid_ctc_attention.pt | hybrid CTC/attention | 60 / 60 | 12.40 M |
vocab.json | 38-symbol train-only character vocabulary ([PAD] is the CTC blank) |
Results
Frozen v1 splits of Samrómur 21.05, speaker-disjoint. No language model. Text normalisation: lowercase, Unicode NFC,
punctuation and symbols removed (prepare.normalize_text in the repository). Test was decoded once per model.
| Model | Final decoding | Dev WER | Dev CER | Test WER | Test CER |
|---|---|---|---|---|---|
| CTC encoder | greedy CTC | 70.81 % | 21.26 % | 74.50 % | 22.88 % |
| Attention encoder-decoder | beam 5, length-normalised | 173.36 %* | n/a | 153.82 % | 92.79 % |
| Hybrid CTC/attention | beam 5, n-best rescored with 0.3 × CTC + 0.7 × attention | 52.51 % | 16.37 % | 55.57 % | 17.77 % |
* greedy dev WER at the selected epoch; the plateau guard stopped training before a final dev decoding.
The attention-only model never learned a stable alignment in 16 epochs (it repeats and inserts words, so WER exceeds 100 %). Adding the CTC branch (hybrid) fixed that and gave the best model, as in Watanabe et al., Hybrid CTC/Attention Architecture for End-to-End Speech Recognition, IEEE JSTSP 2017.
Model
- 80-dim log-mel features (25 ms / 10 ms), per-utterance normalisation, SpecAugment in training.
- Encoder: two stride-2 convolutions (4× subsampling) and an 8-layer pre-norm Transformer (d=256, 4 heads, FFN 1024).
- CTC head: linear layer over the 38 characters. Attention decoder: 4-layer pre-norm Transformer decoder with cross-attention over the characters plus sos/eos, label smoothing 0.1.
- Training loss: CTC (ctc), cross-entropy (attention), 0.3 × CTC + 0.7 × cross-entropy (hybrid).
- 10,486 train utterances (14.99 h; 2 clips over 16 s left out). AdamW, peak LR 1e-3, 2,000 warmup steps, cosine decay, fp16, seed 2105, up to 60 epochs; dev WER (greedy) every 2 epochs selects the checkpoint.
- One Tesla T4 on Google Colab: CTC 54 min, attention 23 min (stopped), hybrid 79 min of training.
Usage
import torch
from training.train_ctc_attention import EncDec, Config # from the GitHub repository
from training.train_rnnt import CharVocab, LogMel
ckpt = torch.load("hybrid_ctc_attention.pt", map_location="cpu", weights_only=True)
vocab = CharVocab("vocab.json")
model = EncDec(vocab, Config(**ckpt["config"]))
model.load_state_dict(ckpt["state_dict"])
model.eval()
feats = LogMel()(audio_16khz_float32) # (frames, 80)
hyp = model.decode(feats[None], torch.tensor([len(feats)]))[0] # beam search (+ CTC rescoring for hybrid)
print(vocab.decode(hyp))
Limitations
- Trained from scratch on 15 h of read speech only; expect much higher error on spontaneous or noisy speech.
- No language model; WER is much higher than CER because of merged or split words and spelling mistakes.
- The attention-only model is included for completeness; it is not usable for transcription.
License
CC BY 4.0, following the Samrómur 21.05 training data (Mollberg et al., LREC 2020). The project's own code is under its own (MIT) license.