File size: 6,159 Bytes
a0cc376
 
fbf7a3d
 
 
 
 
 
 
 
 
 
 
 
 
a0cc376
fbf7a3d
 
 
258bc92
 
 
fbf7a3d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
---
license: apache-2.0
base_model: Qwen/Qwen2.5-3B-Instruct
language:
  - en
tags:
  - reasoning
  - math
  - chain-of-thought
  - qwen2.5
  - gguf
  - text-generation
  - conversational
pipeline_tag: text-generation
library_name: transformers
---

<div align="center">

![1789911910f175](https://cdn-uploads.huggingface.co/production/uploads/6a5f8c87a38cac087c2c6c05/zZ-C-s-RZWV6sxVhj9RBe.png)

🐍 Boomslang (3B Reasoning & Math Engine)

**A compact, high-efficiency 3-billion-parameter model fine-tuned for deep chain-of-thought mathematical reasoning, logic, and algebra—without sacrificing natural conversational ability.**

[![Hugging Face](https://img.shields.io/badge/%F0%9F%A4%97%20Creator-Monster--Code-blue)](https://huggingface.co/Monster-Code)
[![License](https://img.shields.io/badge/License-Apache_2.0-green.svg)](https://opensource.org/licenses/Apache-2.0)
[![GGUF Available](https://img.shields.io/badge/GGUF-Included-purple.svg)](https://huggingface.co/Monster-Code/Boomslang/blob/main/boomslang-3b-qwen.gguf)

---

### ❤️ If you find Boomslang useful, please hit the **Like** button at the top of this page and [Follow @Monster-Code](https://huggingface.co/Monster-Code) for more open-weights AI releases!

---

</div>

## 💡 What is Boomslang?

Most small models (1B–3B parameters) struggle with two extremes: they are either polite chatbots that completely hallucinate basic arithmetic, or narrow math models that forget how to hold a conversation and start writing unprompted proofs when you simply say "Hi."

**Boomslang** was trained to bridge that gap.

Starting from the strong foundation of **`Qwen/Qwen2.5-3B-Instruct`**, Boomslang was post-trained on an **NVIDIA RTX PRO 6000 Blackwell** across a curated ~17,500-sample reasoning mixture:
1. **DeepSeek-R1 Distilled Proofs (`open-r1/OpenR1-Math-220k`):** Teaches the network an internal self-reflection loop (`<think> ... </think>`) to break down complex algebraic expressions, geometry, and multi-step deduction before committing to an answer.
2. **Step-by-Step Arithmetic Rigor (`openai/gsm8k`):** Calibrates attention heads on strict order-of-operations arithmetic and unambiguous answer derivation.

The result is an edge-friendly 3B model that works through tricky algebra and word puzzles methodically, but still greets you warmly and follows instructions when you just want to talk.

---

## 📦 What's Inside This Repository?

* **Single Standalone `model.safetensors`:** No multi-part file splits. The entire 3-billion parameter model is packed into a single, clean ~6.1 GB file.
* **Pre-Converted GGUF (`boomslang-3b-qwen.gguf`):** Directly ready for **Ollama**, **LM Studio**, and **llama.cpp** on your local machine (MacBook, laptop, or home GPU).
* Full configuration and tokenizer files for immediate `transformers` plug-and-play.

---

## ⚡ Quickstart: Python & Transformers

```python
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, TextStreamer

MODEL_ID = "Monster-Code/Boomslang"

tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
model = AutoModelForCausalLM.from_pretrained(
    MODEL_ID,
    torch_dtype=torch.bfloat16 if torch.cuda.is_available() else torch.float32,
    device_map="auto"
)

# Standard ChatML format
messages = [
    {
        "role": "system",
        "content": "You are Boomslang, a helpful and precise reasoning assistant. Reason step-by-step before providing your final answer."
    },
    {
        "role": "user",
        "content": "A box has 36 chocolates. Tom eats 1/4 of them, and Sarah eats 9. How many chocolates are left in the box?"
    }
]

prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)

with torch.no_grad():
    model.generate(
        **inputs,
        streamer=streamer,
        max_new_tokens=1024,
        temperature=0.6,
        top_p=0.9
    )
```

---

## 💻 Running Locally with Ollama / LM Studio

### 1. Using Ollama:
Create a `Modelfile` in the same directory as the downloaded `.gguf`:
```dockerfile
FROM ./boomslang-3b-qwen.gguf

TEMPLATE """{{ if .System }}<|im_start|>system
{{ .System }}<|im_end|>
{{ end }}{{ if .Prompt }}<|im_start|>user
{{ .Prompt }}<|im_end|>
{{ end }}<|im_start|>assistant
{{ .Response }}<|im_end|>"""

PARAMETER stop "<|im_start|>"
PARAMETER stop "<|im_end|>"
PARAMETER temperature 0.6
```

Build and run:
```bash
ollama create boomslang -f Modelfile
ollama run boomslang
```

### 2. Using LM Studio:
1. Download **`boomslang-3b-qwen.gguf`** from the [Files and versions tab](https://huggingface.co/Monster-Code/Boomslang/tree/main).
2. Drop it into your local LM Studio models folder.
3. Start chatting with GPU offloading enabled!

---

## 🧠 Sample Interaction

**User:**
> *"Solve for x: 5x - 10 = 25. Show your work."*

**Boomslang:**
```text
<think>
The equation is 5x - 10 = 25.
Our goal is to isolate the variable x on one side.

Step 1: Add 10 to both sides to cancel out the -10 constant:
5x - 10 + 10 = 25 + 10
5x = 35

Step 2: Divide both sides by the coefficient 5:
5x / 5 = 35 / 5
x = 7

Verification:
Substitute x = 7 into the original expression:
5(7) - 10 = 35 - 10 = 25.
Both sides match.
</think>

The answer is x = 7.
```

---

## 🛠️ Training Details

* **Base Architecture:** Qwen2.5 3B (Decoder-only Transformer)
* **Hardware:** NVIDIA RTX PRO 6000 Blackwell Server Edition
* **Precision:** BF16 Native Mixed Precision with Fused AdamW
* **Effective Batch Size:** 32 (8 per device × 4 gradient accumulation steps)
* **Learning Rate:** 1.5e-4 with dynamic linear warmup
* **Label Masking:** Dynamic batch padding via `DataCollatorForSeq2Seq` with `-100` masking to guarantee loss is never calculated on padding noise

---

## 🤝 Community & Support

* 👤 **Creator:** [Monster-Code](https://huggingface.co/Monster-Code)
* 💬 Have suggestions, evaluation runs, or dataset ideas? Leave a note in the **Discussions** tab!
* ⭐ **If Boomslang helps your workflow, please consider starring/liking the repository!**