A hybrid English–Swahili translation system that combines Meta's NLLB-200 model with semantic memory retrieval and human feedback to improve translation consistency over time
# 🌍 Adaptive Swahili Translation using NLLB and Semantic Memory
## Overview
This project explores a hybrid approach to English–Swahili machine translation by combining a pretrained neural machine translation model with a persistent semantic memory system.
Instead of relying solely on a pretrained model, the system stores corrected translations, retrieves semantically similar sentences using multilingual sentence embeddings, and continuously improves translation consistency through human feedback.
The project demonstrates how large language models can be combined with retrieval techniques to create an adaptive translation workflow.
---
## Features
* English to Swahili translation using **Meta's NLLB-200 Distilled 600M** model
* Persistent translation memory stored in JSON format
* Semantic similarity search using Sentence Transformers
* Automatic retrieval of previously corrected translations
* Embedding caching for faster semantic lookup
* Human-in-the-loop correction system
* BLEU score evaluation for comparing translation quality
---
## System Workflow
1. Receive an English sentence.
2. Check for an exact match in the translation memory.
3. If no exact match exists, search for semantically similar sentences using multilingual embeddings.
4. If no suitable match is found, generate a translation using the NLLB model.
5. Allow the user to accept or correct the translation.
6. Save the corrected translation and rebuild the semantic embedding database.
---
## Technologies Used
* Python
* Hugging Face Transformers
* Meta NLLB-200 Distilled 600M
* Sentence Transformers
* PyTorch
* TensorFlow
* SacreBLEU
* NumPy
---
## Project Structure
```text
project/
│
├── translation_model/
├── corrections.json
├── embeddings.pt
├── evaluation/
├── notebook.ipynb
├── requirements.txt
└── README.md
```
---
## Evaluation
The project includes an evaluation pipeline using **SacreBLEU** to compare:
* Baseline NLLB translations
* Hybrid translations using semantic memory …