Update README.md
Browse files
README.md
CHANGED
|
@@ -6,11 +6,110 @@ tags:
|
|
| 6 |
- unsloth
|
| 7 |
- llama
|
| 8 |
- gguf
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
license: apache-2.0
|
| 10 |
language:
|
| 11 |
- en
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
---
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
# Uploaded model
|
| 15 |
|
| 16 |
- **Developed by:** nivektk
|
|
|
|
| 6 |
- unsloth
|
| 7 |
- llama
|
| 8 |
- gguf
|
| 9 |
+
- text-generation
|
| 10 |
+
- math
|
| 11 |
+
- fine-tuning
|
| 12 |
+
- llama-3
|
| 13 |
license: apache-2.0
|
| 14 |
language:
|
| 15 |
- en
|
| 16 |
+
dataset:
|
| 17 |
+
- nivektk/math-augmented-dataset
|
| 18 |
+
task_categories:
|
| 19 |
+
- text-generation
|
| 20 |
+
- question-answering
|
| 21 |
+
size_categories:
|
| 22 |
+
- 1K<n<10K
|
| 23 |
+
model_name: BullSolve
|
| 24 |
---
|
| 25 |
|
| 26 |
+
|
| 27 |
+
# BullSolve: Fine-Tuned LLaMA 3 Model for Math Problem Solving
|
| 28 |
+
|
| 29 |
+
## Model Description
|
| 30 |
+
BullSolve is a fine-tuned version of `unsloth/llama-3.1-8B-Instruct-unsloth-bnb-4bit`, optimized for solving advanced math problems. The model was trained using LoRA adapters with the `nivektk/math-augmented-dataset`, which contains algebra problems and their solutions.
|
| 31 |
+
|
| 32 |
+
This model is optimized for low VRAM usage and efficient inference while maintaining high accuracy in mathematical problem-solving tasks.
|
| 33 |
+
|
| 34 |
+
# Training Data
|
| 35 |
+
|
| 36 |
+
The model was fine-tuned using a subset of the [MATH Dataset](https://arxiv.org/abs/2103.03874), specifically the **Algebra** category, containing **1,006 validated examples**. This dataset, originally developed by Dan Hendrycks et al., consists of mathematical problems structured in JSON format, with attributes:
|
| 37 |
+
|
| 38 |
+
- `problem`: Problem statement in text with LaTeX expressions.
|
| 39 |
+
- `level`: Difficulty level (1 to 5).
|
| 40 |
+
- `type`: Mathematical domain (e.g., Algebra, Geometry).
|
| 41 |
+
- `solution`: Step-by-step solution in English.
|
| 42 |
+
|
| 43 |
+
For fine-tuning, the dataset was preprocessed into ShareGPT format with the structure:
|
| 44 |
+
|
| 45 |
+
```
|
| 46 |
+
{question}[[
|
| 47 |
+
Solution:
|
| 48 |
+
{solution}
|
| 49 |
+
]]
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
Additionally, a chat template was applied for better inference compatibility.
|
| 53 |
+
|
| 54 |
+
## Training Configuration
|
| 55 |
+
The model was trained using **Unsloth** with LoRA, optimizing memory efficiency and inference speed. Key parameters:
|
| 56 |
+
- **Model**: `unsloth/llama-3.1-8B-Instruct-unsloth-bnb-4bit`
|
| 57 |
+
- **Max Sequence Length**: 2048 tokens
|
| 58 |
+
- **LoRA Config**:
|
| 59 |
+
- Rank (`r`): 16
|
| 60 |
+
- Alpha: 16
|
| 61 |
+
- Dropout: 0
|
| 62 |
+
- Target Modules: `q_proj`, `k_proj`, `v_proj`, `o_proj`, `gate_proj`, `up_proj`, `down_proj`
|
| 63 |
+
- **Training Arguments**:
|
| 64 |
+
- Batch Size: 1
|
| 65 |
+
- Gradient Accumulation: 4
|
| 66 |
+
- Max Steps: 25
|
| 67 |
+
- Learning Rate: 1e-4
|
| 68 |
+
- Optimizer: AdamW (8-bit)
|
| 69 |
+
- Weight Decay: 0.01
|
| 70 |
+
- LR Scheduler: Linear
|
| 71 |
+
|
| 72 |
+
## Inference
|
| 73 |
+
BullSolve is optimized for fast inference and mathematical problem-solving. Example usage:
|
| 74 |
+
```python
|
| 75 |
+
from transformers import TextStreamer
|
| 76 |
+
from unsloth import FastLanguageModel
|
| 77 |
+
import torch
|
| 78 |
+
|
| 79 |
+
model, tokenizer = FastLanguageModel.from_pretrained("nivektk/BullSolve")
|
| 80 |
+
FastLanguageModel.for_inference(model)
|
| 81 |
+
|
| 82 |
+
messages = [{"role": "user", "content": "Evaluate $\\log_{5^2}5^4$."}]
|
| 83 |
+
input_ids = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to("cuda")
|
| 84 |
+
|
| 85 |
+
text_streamer = TextStreamer(tokenizer, skip_prompt=True)
|
| 86 |
+
_ = model.generate(input_ids, streamer=text_streamer, max_new_tokens=2000, pad_token_id=tokenizer.eos_token_id)
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
## Model Usage
|
| 90 |
+
This model is suitable for:
|
| 91 |
+
- Math tutoring and automated problem-solving
|
| 92 |
+
- AI-assisted mathematical reasoning
|
| 93 |
+
- Education-based chatbot assistants
|
| 94 |
+
|
| 95 |
+
## Limitations
|
| 96 |
+
- The model is trained only on algebra problems and may not generalize well to other areas of mathematics.
|
| 97 |
+
- It is optimized for inference efficiency rather than large-scale fine-tuning.
|
| 98 |
+
|
| 99 |
+
## Acknowledgments
|
| 100 |
+
- **Unsloth** for efficient LoRA fine-tuning
|
| 101 |
+
- **MATH Dataset** by Dan Hendrycks for problem-solving benchmarks
|
| 102 |
+
|
| 103 |
+
## Citation
|
| 104 |
+
If you use this model, please cite:
|
| 105 |
+
```bibtex
|
| 106 |
+
@article{BullSolve2025,
|
| 107 |
+
title={BullSolve: Fine-Tuned LLaMA 3 for Math Problems},
|
| 108 |
+
author={Kevin Fabio Ramos López},
|
| 109 |
+
year={2025},
|
| 110 |
+
journal={Hugging Face Models}
|
| 111 |
+
}
|
| 112 |
+
```
|
| 113 |
# Uploaded model
|
| 114 |
|
| 115 |
- **Developed by:** nivektk
|