English→Tamil translation model built using an Unsloth-optimized transformer with LoRA and 4-bit quantization. Developed as part of our Text Analytics semester project, including our own implementation work, experiments, and model evaluations.
1
stars
26
commits
Python
primary language
Aug 5, 2026
updated
A Production-Grade, Bidirectional Neural Machine Translation (NMT) Pipeline
This repository contains the source code, training methodology, and evaluation framework for a highly optimized Bidirectional English ↔ Tamil Neural Machine Translation (NMT) system. By leveraging Llama 3.1 8B combined with Unsloth 4-bit QLoRA optimization, this project demonstrates how large language models can be efficiently fine-tuned on resource-constrained hardware (single 16GB GPU) to achieve state-of-the-art translation capabilities.
In standardized benchmarking (FLORES-200), our fine-tuned Llama 3.1 model successfully outperformed Meta's NLLB-200-distilled-600M and AI4Bharat's IndicTrans2 in the English-to-Tamil direction, proving the viability of LLMs for complex, agglutinative Dravidian languages.
Our training pipeline is designed with strict adherence to modern NLP research standards, ensuring zero data leakage and high reproducibility.
To train a robust bidirectional model, we curated a massive corpus of 100,000 real parallel sentence pairs:
Quality Assurance Pipeline:
Fine-tuning an 8-Billion parameter model conventionally requires massive compute clusters. We utilized Unsloth to fundamentally rewrite the backpropagation kernels, enabling:
r=64, alpha=32) strictly to the attention and MLP layers (q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj).unsloth/Meta-Llama-3.1-8B-bnb-4bitAdamW (8-bit) with a linear learning rate scheduler (lr = 2e-5) and 300 warmup steps.We evaluated the model using the strict FLORES-200 devtest benchmark. To ensure a multi-dimensional understanding of the model's quality, we computed four distinct metrics:
| Model | Direction | BLEU | chrF++ | COMET | SBERT |
|---|---|---|---|---|---|
| Our Model (Llama 3.1 LoRA) | ta2en | 17.42 | 44.02 | 0.835 | 0.8124 |
| Our Model (Llama 3.1 LoRA) | en2ta | 11.73 | 22.68 | 0.676 | 0.8230 |
| NLLB-200-distilled (Meta) | ta2en | 41.68 | 55.84 | 0.856 | 0.8636 |
| NLLB-200-distilled (Meta) | en2ta | 7.17 | 46.98 | 0.867 | 0.9269 |
| IndicTrans2 (AI4Bharat) | ta2en | 8.22 | 8.99 | 0.345 | -0.0179 |
| IndicTrans2 (AI4Bharat) | en2ta | 0.00 | 0.66 | 0.248 | 0.0840 |
Analytical Insights: Our fine-tuned LLM vastly outperformed IndicTrans2 in both directions. Crucially, in the English-to-Tamil direction, our model significantly outperformed Meta's NLLB-200 (11.73 BLEU vs 7.17 BLEU), establishing that generalized LLMs (like Llama 3) when properly fine-tuned with LoRA, possess superior generative capabilities for low-resource translation tasks compared to traditional encoder-decoder architectures.
📂 Efficient-English-Tamil-Translation/
├── 📂 src/
│ ├── config.py # Global Hyperparameters & Run settings
│ ├── data_loader.py # OPUS-100 & Samanantar fetching algorithms
│ ├── model.py # Unsloth Instantiation & LoRA mapping
│ ├── train.py # Supervised Fine-Tuning (SFT) Loop & Safe-Save
│ ├── inference.py # Translation parsing & Token generation
│ ├── evaluate.py # Metric calculation (BLEU, COMET, chrF++)
│ ├── benchmark.py # FLORES-200 dataset integration
│ └── baselines.py # NLLB & IndicTrans2 automated loaders
├── run_pipeline.py # The Master Orchestration Script (E2E)
├── zip_for_kaggle.py # Deployment / Packaging utility
└── requirements.txt # Explicit pip dependencies
git clone https://github.com/your-repo/Efficient-English-Tamil-Translation.git
cd Efficient-English-Tamil-Translation
pip install -r requirements.txt
To execute the entire end-to-end pipeline (Data Download → Unsloth Training → FLORES Benchmarking → Result Compilation):
python run_pipeline.py
from src import FastConfig, load_model, TamilTranslator
# Initialize pipeline
config = FastConfig()
model, tokenizer = load_model(config)
translator = TamilTranslator(model, tokenizer)
# Bidirectional Auto-Detection
english_output = translator.translate("நான் பள்ளிக்கு செல்கிறேன்")
print(f"Translation: {english_output}")
tamil_output = translator.translate("The weather is beautiful today.")
print(f"Translation: {tamil_output}")
We are actively expanding this architecture. Upcoming features include:
8-bit .gguf formats to allow 100% offline, GPU-free translation on mobile phones and laptops via llama.cpp.Developed as part of the Text Analytics coursework at Amrita Vishwa Vidyapeetham.
17 commits
9 commits
Python
100.0%
English→Tamil translation model built using an Unsloth-optimized transformer with LoRA and 4-bit quantization. Developed as part of our Text Analytics semester project, including our own implementation work, experiments, and model evaluations.
1
stars
26
commits
Python
primary language
Aug 5, 2026
updated
A Production-Grade, Bidirectional Neural Machine Translation (NMT) Pipeline
This repository contains the source code, training methodology, and evaluation framework for a highly optimized Bidirectional English ↔ Tamil Neural Machine Translation (NMT) system. By leveraging Llama 3.1 8B combined with Unsloth 4-bit QLoRA optimization, this project demonstrates how large language models can be efficiently fine-tuned on resource-constrained hardware (single 16GB GPU) to achieve state-of-the-art translation capabilities.
In standardized benchmarking (FLORES-200), our fine-tuned Llama 3.1 model successfully outperformed Meta's NLLB-200-distilled-600M and AI4Bharat's IndicTrans2 in the English-to-Tamil direction, proving the viability of LLMs for complex, agglutinative Dravidian languages.
Our training pipeline is designed with strict adherence to modern NLP research standards, ensuring zero data leakage and high reproducibility.
To train a robust bidirectional model, we curated a massive corpus of 100,000 real parallel sentence pairs:
Quality Assurance Pipeline:
Fine-tuning an 8-Billion parameter model conventionally requires massive compute clusters. We utilized Unsloth to fundamentally rewrite the backpropagation kernels, enabling:
r=64, alpha=32) strictly to the attention and MLP layers (q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj).unsloth/Meta-Llama-3.1-8B-bnb-4bitAdamW (8-bit) with a linear learning rate scheduler (lr = 2e-5) and 300 warmup steps.We evaluated the model using the strict FLORES-200 devtest benchmark. To ensure a multi-dimensional understanding of the model's quality, we computed four distinct metrics:
| Model | Direction | BLEU | chrF++ | COMET | SBERT |
|---|---|---|---|---|---|
| Our Model (Llama 3.1 LoRA) | ta2en | 17.42 | 44.02 | 0.835 | 0.8124 |
| Our Model (Llama 3.1 LoRA) | en2ta | 11.73 | 22.68 | 0.676 | 0.8230 |
| NLLB-200-distilled (Meta) | ta2en | 41.68 | 55.84 | 0.856 | 0.8636 |
| NLLB-200-distilled (Meta) | en2ta | 7.17 | 46.98 | 0.867 | 0.9269 |
| IndicTrans2 (AI4Bharat) | ta2en | 8.22 | 8.99 | 0.345 | -0.0179 |
| IndicTrans2 (AI4Bharat) | en2ta | 0.00 | 0.66 | 0.248 | 0.0840 |
Analytical Insights: Our fine-tuned LLM vastly outperformed IndicTrans2 in both directions. Crucially, in the English-to-Tamil direction, our model significantly outperformed Meta's NLLB-200 (11.73 BLEU vs 7.17 BLEU), establishing that generalized LLMs (like Llama 3) when properly fine-tuned with LoRA, possess superior generative capabilities for low-resource translation tasks compared to traditional encoder-decoder architectures.
📂 Efficient-English-Tamil-Translation/
├── 📂 src/
│ ├── config.py # Global Hyperparameters & Run settings
│ ├── data_loader.py # OPUS-100 & Samanantar fetching algorithms
│ ├── model.py # Unsloth Instantiation & LoRA mapping
│ ├── train.py # Supervised Fine-Tuning (SFT) Loop & Safe-Save
│ ├── inference.py # Translation parsing & Token generation
│ ├── evaluate.py # Metric calculation (BLEU, COMET, chrF++)
│ ├── benchmark.py # FLORES-200 dataset integration
│ └── baselines.py # NLLB & IndicTrans2 automated loaders
├── run_pipeline.py # The Master Orchestration Script (E2E)
├── zip_for_kaggle.py # Deployment / Packaging utility
└── requirements.txt # Explicit pip dependencies
git clone https://github.com/your-repo/Efficient-English-Tamil-Translation.git
cd Efficient-English-Tamil-Translation
pip install -r requirements.txt
To execute the entire end-to-end pipeline (Data Download → Unsloth Training → FLORES Benchmarking → Result Compilation):
python run_pipeline.py
from src import FastConfig, load_model, TamilTranslator
# Initialize pipeline
config = FastConfig()
model, tokenizer = load_model(config)
translator = TamilTranslator(model, tokenizer)
# Bidirectional Auto-Detection
english_output = translator.translate("நான் பள்ளிக்கு செல்கிறேன்")
print(f"Translation: {english_output}")
tamil_output = translator.translate("The weather is beautiful today.")
print(f"Translation: {tamil_output}")
We are actively expanding this architecture. Upcoming features include:
8-bit .gguf formats to allow 100% offline, GPU-free translation on mobile phones and laptops via llama.cpp.Developed as part of the Text Analytics coursework at Amrita Vishwa Vidyapeetham.
17 commits
9 commits
Python
100.0%