Text Generation
Transformers
GGUF
English
llama
text-generation-inference
unsloth
math
fine-tuning
llama-3
conversational
Instructions to use nivektk/BullSolve with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nivektk/BullSolve with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="nivektk/BullSolve") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("nivektk/BullSolve", dtype="auto") - llama-cpp-python
How to use nivektk/BullSolve with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="nivektk/BullSolve", filename="unsloth.Q4_K_M.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use nivektk/BullSolve with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf nivektk/BullSolve:Q4_K_M # Run inference directly in the terminal: llama-cli -hf nivektk/BullSolve:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf nivektk/BullSolve:Q4_K_M # Run inference directly in the terminal: llama-cli -hf nivektk/BullSolve:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf nivektk/BullSolve:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf nivektk/BullSolve:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf nivektk/BullSolve:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf nivektk/BullSolve:Q4_K_M
Use Docker
docker model run hf.co/nivektk/BullSolve:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use nivektk/BullSolve with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nivektk/BullSolve" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nivektk/BullSolve", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/nivektk/BullSolve:Q4_K_M
- SGLang
How to use nivektk/BullSolve with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "nivektk/BullSolve" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nivektk/BullSolve", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "nivektk/BullSolve" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nivektk/BullSolve", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use nivektk/BullSolve with Ollama:
ollama run hf.co/nivektk/BullSolve:Q4_K_M
- Unsloth Studio
How to use nivektk/BullSolve with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for nivektk/BullSolve to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for nivektk/BullSolve to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for nivektk/BullSolve to start chatting
- Docker Model Runner
How to use nivektk/BullSolve with Docker Model Runner:
docker model run hf.co/nivektk/BullSolve:Q4_K_M
- Lemonade
How to use nivektk/BullSolve with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull nivektk/BullSolve:Q4_K_M
Run and chat with the model
lemonade run user.BullSolve-Q4_K_M
List all available models
lemonade list
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
|