--- title: TinyLlama Math Fine-tuning Demo emoji: 🧮 colorFrom: blue colorTo: purple sdk: gradio app_file: app.py pinned: false --- # TinyLlama Math Fine-tuning Demo Compare **base TinyLlama** vs **fine-tuned TinyLlama** on math word problems from GSM8K. ## Models - **Base Model**: [TinyLlama-1.1B-Chat-v1.0](https://huggingface.co/TinyLlama/TinyLlama-1.1B-Chat-v1.0) - **Fine-tuned Adapter**: [tinyllama-lora-math-adapter-v3](https://huggingface.co/sumedh/tinyllama-lora-math-adapter-v3) ## Training Details - **Dataset**: GSM8K (7,473 training examples) - **Method**: LoRA (r=8, alpha=16) - **Epochs**: 5 - **Quantization**: 4-bit (NF4) ## Usage 1. Load an example using the slider, or enter your own math question 2. Click "Compare Models" to see responses from both models 3. Compare with the reference answer ## Observations The fine-tuned model learns: - Step-by-step reasoning format - Mathematical notation (using `<>` markers) - Structured problem-solving approach However, as a 1.1B parameter model, complex multi-step calculations may still contain errors. ## Code This repository includes the full training and evaluation code: - **[Fine-Tuning_TinyLlama_Math.ipynb](Fine-Tuning_TinyLlama_Math.ipynb)** - Training notebook (run on Google Colab with GPU) - **[Evaluation_TinyLlama_Math.ipynb](Evaluation_TinyLlama_Math.ipynb)** - Evaluation notebook comparing base vs fine-tuned model