A ML translation from English to Hausa with Transformers
# Hausa-English Neural Machine Translation
A fine-tuned neural machine translation model for translating Hausa to English, optimized for Apple Silicon (M1) hardware. This is my undergraduate research project, and it demonstrates transfer learning applied to low-resource language translation.
## Overview
### Problem Statement
Hausa is spoken by over 70 million people across West Africa, yet automated translation resources remain limited. This project addresses this gap by fine-tuning a pre-trained translation model on a Hausa-English parallel corpus.
### Solution
I fine-tuned the Helsinki-NLP MarianMT model (`opus-mt-ha-en`) on 3,284 cleaned sentence pairs over 10 epochs, completing training in under 2 hours on M1 MacBook Air(8gb RAM, 512gb SSD).
### Key Results
- **62.5% accuracy** on manual evaluation (5/8 test sentences correct)
- **50% perfect translations** (4/8 exact matches)
- **27.9% reduction** in evaluation loss (4.71 → 3.39)
- **1 hour 54 minutes** total training time
- **BLEU score: 11.85** (automated metric - see Results for interpretation)
---
## 🔬 Methodology
### 1. Base Model Selection: MarianMT
**What I chose:** Helsinki-NLP's `opus-mt-ha-en` pre-trained model
**Why this approach:**
- **Transfer Learning:** Model already trained on millions of Hausa-English sentence pairs from OPUS corpus
- **Efficiency:** Fine-tuning takes ~2 hours vs. months for training from scratch
- **Proven Architecture:** MarianMT uses Transformer encoder-decoder, the gold standard for neural machine translation
- **Compact Size:** 300MB model fits on consumer hardware (8GB RAM)
- **Open Source:** Freely available on HuggingFace, reproducible by others
**Alternatives I considered:**
| Alternative | Why I Didn't Use It | Trade-off |
|-------------|---------------------|-----------|
| **mBART-50** | 2.3GB model size, requires 16GB+ RAM | Better quality (+10-15 BLEU) but won't fit on M1 Air |
| **NLLB-200** | 1.1GB+, optimized for 200 languages | More versatile …