Overview
A comprehensive LoRA (Low-Rank Adaptation) fine-tuning system built on Unsloth for sentiment-analysis tasks. It covers the full lifecycle — training, evaluation, and interactive testing — and adapts automatically to different base models (Llama-2 / Llama-3).
Implementation
- Efficient training: Unsloth optimization for ~2x faster training, with 4-bit quantization so large models fit on a single consumer GPU (~7GB VRAM)
- LoRA config: rank-32 adapters on attention layers, cosine LR scheduling, ~100MB adapter output
- Early stopping: custom callback with patience/threshold to prevent overfitting and cut training time
- Modular architecture: clean separation across
config/data_processor/model_manager/training_pipeline/evaluator/model_saver, orchestrated by a singlelora_systemcontroller - Dataset: IMDb movie reviews (25k samples, 80/20 split), extensible to other Hugging Face datasets
- Tooling: interactive & automated training launchers, model version management, and a free-form text tester returning predictions with confidence scores
- Result: ~85–90% accuracy on the IMDb test set, ~15–30 min training on an RTX 4090
