# MPESA SMS LLM Training Pipeline
A comprehensive end-to-end pipeline for processing MPESA SMS transaction data and fine-tuning Large Language Models (LLMs). This project transforms raw SMS messages into structured training datasets and provides complete tools for fine-tuning models to understand and extract transaction information.
## 🎯 Project Overview
This project provides a complete machine learning pipeline for MPESA SMS transaction analysis. From raw SMS data to a trained LLM capable of extracting structured transaction information, this toolkit handles the entire workflow including data preprocessing, anonymization, formatting, and model fine-tuning.
### Key Features
- **Data Collection**: Load SMS messages from XML backups
- **Privacy Protection**: Comprehensive anonymization of personal information
- **Intelligent Parsing**: Extract key transaction fields using regex and NLP techniques
- **Flexible Formatting**: Support for both basic and instruct/chat model training formats
- **Cloud Integration**: Direct upload to Hugging Face Hub for dataset sharing
- **LLM Fine-tuning**: Complete pipeline for training models on MPESA transaction data ✅
- **Model Evaluation**: Tools for assessing model performance on transaction extraction tasks
- **Mac M1 Optimized**: Specialized configuration for Apple Silicon training
## 📊 Extracted Fields
The system extracts the following key information from each SMS:
- `transaction_id` - Unique transaction identifier
- `amount` - Transaction amount in KSH
- `transaction_type` - Type of transaction (sent, received, withdrawn, airtime, etc.)
- `counterparty` - Other party involved in the transaction
- `date_time` - Transaction timestamp
- `balance` - Account balance after transaction
## 🚀 Getting Started
### Prerequisites
- Python 3.8+
- Virtual environment (recommended)
- For training: Mac M1 with 16GB RAM (recommended) or similar hardware
### Installation
1. Clone the repository:
```bash
git clone
github.com …