# Somali BBC News Summarization (FLAN-T5 + LoRA)
This repository contains a complete end-to-end NLP system for **abstractive summarization of Somali BBC news articles**, developed as a final project for a Natural Language Processing course.
## Project Overview
- **Task:** Abstractive text summarization
- **Language:** Somali (low-resource)
- **Dataset:** XLSum Somali
- **Model:** FLAN-T5-Small
- **Fine-tuning:** Low-Rank Adaptation (LoRA)
- **Optimization:** INT8 Dynamic Quantization (CPU)
- **Evaluation:** ROUGE, BERTScore, latency benchmarking
---
## Repository Structure
├── data/
│ └── raw/ # XLSum Somali JSONL files
├── notebooks/
│ └── main.ipynb # End-to-end experiment notebook
├── src/
│ ├── data/ # Data loading and preprocessing
│ ├── models/ # LoRA and quantization logic
│ ├── training/ # Training pipeline
│ └── demo/ # Gradio demo application
├── results/
│ ├── checkpoints/ # Trained models
│ └── metrics/ # Evaluation results (JSON)
├── reports/
│ └── Technical_Report.docx
├── requirements.txt
└── README.md
---
## Methodology
1. Load and preprocess Somali BBC news articles.
2. Apply instruction-style prompting for summarization.
3. Fine-tune FLAN-T5 using LoRA adapters.
4. Quantize the trained model using INT8 dynamic quantization.
5. Evaluate quality, latency, and memory trade-offs.
6. Demonstrate inference via a Gradio-based UI.
---
## Results Summary
### FP32 (Merged LoRA)
- ROUGE-1: 0.1406
- ROUGE-L: 0.1092
- BERTScore F1: 0.6109
- Latency: 1.83 s/sample
### INT8 Dynamic (CPU)
- ROUGE-1: 0.0349
- ROUGE-L: 0.0284
- BERTScore F1: 0.5730
- Latency: 1.60 s/sample
- Speed-up: ~1.14×
---
## Demo
A Gradio-based UI is included for interactive summarization and comparison between FP32 and INT8 models.
---
## Requirements
- Python 3.10+
- PyTorch
- Hugging Face Transformers
- Datasets
- PEFT
- Evaluate
- Gradio
Install dependencies:
```bash
pip install -r requirements.txt