Text Generation
Transformers
Safetensors
GGUF
English
llama
tinybrainbot
small-language-model
from-scratch
gqa
math
arithmetic
conversational
text-generation-inference
Instructions to use nkthebass/tinybrainbot-350mV3-math with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nkthebass/tinybrainbot-350mV3-math with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="nkthebass/tinybrainbot-350mV3-math") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("nkthebass/tinybrainbot-350mV3-math") model = AutoModelForCausalLM.from_pretrained("nkthebass/tinybrainbot-350mV3-math", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use nkthebass/tinybrainbot-350mV3-math with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf nkthebass/tinybrainbot-350mV3-math:F16 # Run inference directly in the terminal: llama cli -hf nkthebass/tinybrainbot-350mV3-math:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf nkthebass/tinybrainbot-350mV3-math:F16 # Run inference directly in the terminal: llama cli -hf nkthebass/tinybrainbot-350mV3-math:F16
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf nkthebass/tinybrainbot-350mV3-math:F16 # Run inference directly in the terminal: ./build/bin/llama cli -hf nkthebass/tinybrainbot-350mV3-math:F16
Use Docker
docker model run hf.co/nkthebass/tinybrainbot-350mV3-math:F16
- Llama new
- LM Studio
- Jan
- vLLM
How to use nkthebass/tinybrainbot-350mV3-math with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nkthebass/tinybrainbot-350mV3-math" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nkthebass/tinybrainbot-350mV3-math", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/nkthebass/tinybrainbot-350mV3-math:F16
- SGLang
How to use nkthebass/tinybrainbot-350mV3-math 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 "nkthebass/tinybrainbot-350mV3-math" \ --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": "nkthebass/tinybrainbot-350mV3-math", "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 "nkthebass/tinybrainbot-350mV3-math" \ --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": "nkthebass/tinybrainbot-350mV3-math", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use nkthebass/tinybrainbot-350mV3-math with Ollama:
ollama run hf.co/nkthebass/tinybrainbot-350mV3-math:F16
- Unsloth Desktop
- Docker Model Runner
How to use nkthebass/tinybrainbot-350mV3-math with Docker Model Runner:
docker model run hf.co/nkthebass/tinybrainbot-350mV3-math:F16
- Lemonade
How to use nkthebass/tinybrainbot-350mV3-math with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull nkthebass/tinybrainbot-350mV3-math:F16
Run and chat with the model
lemonade run user.tinybrainbot-350mV3-math-F16
List all available models
lemonade list
- Atomic Chat
Correct 3x3 mult 58.3->98.0 (n=24 was too small) and negatives 92.7->85.0 (harness never sampled 5-digit)
Browse files
README.md
CHANGED
|
@@ -20,14 +20,14 @@ A **348M-parameter** decoder-only model fine-tuned to do column arithmetic with
|
|
| 20 |
scratchpad. Successor to the **TinyBrainBot 320M V2 Math**.
|
| 21 |
|
| 22 |
**TL;DR:** **99.4% average** across the nine GPT-3 arithmetic sub-tasks, beating the 320M V2
|
| 23 |
-
Math (91.5%). Adds cleanly to **14 digits**,
|
| 24 |
-
|
| 25 |
solver β see the honest limits below.
|
| 26 |
|
| 27 |
> **Updated 2026-09-08.** This revision fixes three defects present in the first release:
|
| 28 |
-
> negative results returned confident wrong positives (2.0% β
|
| 29 |
> dropped a column past 8 digits (widest clean sum 8 β 14), and 3-digit multipliers had
|
| 30 |
-
> **zero** training examples (8.3% β
|
| 31 |
> accuracy and 4 points of one-step word problems; both are itemised below.
|
| 32 |
|
| 33 |
---
|
|
@@ -83,11 +83,19 @@ final number. Identical problems and seed for both models.
|
|
| 83 |
| **Average** | **99.43** | 91.5 |
|
| 84 |
|
| 85 |
The four subtraction cells sit at 98.3β99.3 rather than 100. That is the measured price of
|
| 86 |
-
teaching the routine to produce negative results: the
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
|
| 92 |
β **9/9 sub-tasks improved.**
|
| 93 |
|
|
@@ -100,10 +108,24 @@ published GPT-3 numbers.** The figure above is 99.43% on *non-negative* subtract
|
|
| 100 |
|
| 101 |
Negative results are measured separately, and in this revision they work:
|
| 102 |
|
| 103 |
-
| | first release | **this revision** |
|
| 104 |
|---|:--:|:--:|
|
| 105 |
-
|
|
| 106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
|
| 108 |
```
|
| 109 |
USER: What is 32 minus 83?
|
|
@@ -126,7 +148,7 @@ phrasings are held out of training by construction so they cannot be re-fitting.
|
|
| 126 |
| **Held-out phrasings** (n=60)<br>*"Sum 63 and 29.", "Deduct 18 from 62."* | 80.0% | **81.7%** | Question *parsing* was a bigger bottleneck than arithmetic. An earlier build measured 33.3% here before a phrasing-focused adapter. |
|
| 127 |
| **Widest clean addition** | 8 digits | **14 digits** | See below - the limit was vocabulary, not arithmetic. |
|
| 128 |
| **7-digit addition** | 100% | **100%** | Comfortably inside the new range. |
|
| 129 |
-
| **3Γ3 multiplication** (n=
|
| 130 |
|
| 131 |
### The addition ceiling was a vocabulary problem
|
| 132 |
|
|
@@ -394,8 +416,9 @@ Full write-up: [PROJECT_BRIEF.md in the training repo].
|
|
| 394 |
|
| 395 |
* **Addition degrades past 14 digits** β 65% at 16, 25% at 18. These are arithmetic slips in
|
| 396 |
a long carry chain, no longer the silent skipped-column failure of the first release.
|
| 397 |
-
* **Multiplication is reliable
|
| 398 |
-
* **Negative results
|
|
|
|
| 399 |
The failures are near misses (375 Γ 903 β 339625 vs 338625), so it is running the
|
| 400 |
partial-product routine and losing digits summing it, not failing to attempt. No division.
|
| 401 |
* **Word problems are weak** (GSM8K 4.0%, best word-problem set ASDiv 16.5%). It converts
|
|
|
|
| 20 |
scratchpad. Successor to the **TinyBrainBot 320M V2 Math**.
|
| 21 |
|
| 22 |
**TL;DR:** **99.4% average** across the nine GPT-3 arithmetic sub-tasks, beating the 320M V2
|
| 23 |
+
Math (91.5%). Adds cleanly to **14 digits**, does 3-digit multipliers (**98.0%**), and handles
|
| 24 |
+
**negative results** (85% overall, but only 58% at 5 digits - see below). It is a *calculator with a scratchpad*, not a word-problem
|
| 25 |
solver β see the honest limits below.
|
| 26 |
|
| 27 |
> **Updated 2026-09-08.** This revision fixes three defects present in the first release:
|
| 28 |
+
> negative results returned confident wrong positives (2.0% β 85%), addition silently
|
| 29 |
> dropped a column past 8 digits (widest clean sum 8 β 14), and 3-digit multipliers had
|
| 30 |
+
> **zero** training examples (8.3% β 98.0%). The cost is ~0.5 points of ordered-subtraction
|
| 31 |
> accuracy and 4 points of one-step word problems; both are itemised below.
|
| 32 |
|
| 33 |
---
|
|
|
|
| 83 |
| **Average** | **99.43** | 91.5 |
|
| 84 |
|
| 85 |
The four subtraction cells sit at 98.3β99.3 rather than 100. That is the measured price of
|
| 86 |
+
teaching the routine to produce negative results: the model must now decide which operand is
|
| 87 |
+
larger, and that decision sometimes misfires on *ordered* operands too - producing a negative
|
| 88 |
+
answer to a question whose answer is positive.
|
| 89 |
+
|
| 90 |
+
**The errors are all in the comparison, not the arithmetic.** Independent testing binned
|
| 91 |
+
ordered pairs by how close `b` is to `a` and found the wrong-sign rate rising smoothly as they
|
| 92 |
+
converge (12.5% at `b/a` 0.98β1.00, falling to 0.0% below 0.30), with correct-answer rate
|
| 93 |
+
equal to exactly `100% β wrong-sign` in every bin. Zero arithmetic errors underneath.
|
| 94 |
+
|
| 95 |
+
That points at a single learned magnitude judgement with no digit-scan procedure behind it -
|
| 96 |
+
the same shape of problem the column routine already solved once for addition and subtraction.
|
| 97 |
+
It is a fixable gap, not a floor. Teaching comparison as an explicit left-to-right digit scan,
|
| 98 |
+
with close-operand and 5-digit pairs in the generator, is the obvious next round.
|
| 99 |
|
| 100 |
β **9/9 sub-tasks improved.**
|
| 101 |
|
|
|
|
| 108 |
|
| 109 |
Negative results are measured separately, and in this revision they work:
|
| 110 |
|
| 111 |
+
| Operand width | first release | **this revision** |
|
| 112 |
|---|:--:|:--:|
|
| 113 |
+
| 1-digit | β | **100.0%** |
|
| 114 |
+
| 2-digit | β | **88.3%** |
|
| 115 |
+
| 3-digit | β | **98.3%** |
|
| 116 |
+
| 4-digit | β | **80.0%** |
|
| 117 |
+
| **5-digit** | β | **58.3%** |
|
| 118 |
+
| **mean, widths 1β5 (n=60 each)** | ~2% | **85.0%** |
|
| 119 |
+
|
| 120 |
+
**Accuracy falls off with operand width**, and the failure is the *magnitude comparison*, not
|
| 121 |
+
the column routine - the model decides which operand is larger with what appears to be a
|
| 122 |
+
single learned judgement rather than a digit scan, and that judgement degrades as the numbers
|
| 123 |
+
get longer and closer together. Independent testing found the same shape, with sign-detection
|
| 124 |
+
dropping sharply at 5 digits and errors concentrating where `b/a` approaches 1.
|
| 125 |
+
|
| 126 |
+
An earlier version of this card reported **92.7%** here. That figure came from a harness that
|
| 127 |
+
sampled operand width from `choice([1,2,3,4])` - it never tested 5 digits, which is exactly
|
| 128 |
+
where the weakness lives. The table above samples all five widths.
|
| 129 |
|
| 130 |
```
|
| 131 |
USER: What is 32 minus 83?
|
|
|
|
| 148 |
| **Held-out phrasings** (n=60)<br>*"Sum 63 and 29.", "Deduct 18 from 62."* | 80.0% | **81.7%** | Question *parsing* was a bigger bottleneck than arithmetic. An earlier build measured 33.3% here before a phrasing-focused adapter. |
|
| 149 |
| **Widest clean addition** | 8 digits | **14 digits** | See below - the limit was vocabulary, not arithmetic. |
|
| 150 |
| **7-digit addition** | 100% | **100%** | Comfortably inside the new range. |
|
| 151 |
+
| **3Γ3 multiplication** (n=200) | 8.3% | **98.0%** | The training set contained **zero** examples with a 3-digit multiplier, so the old 8.3% was extrapolation to an unseen width. It now folds partial products pairwise through the column routine instead of asserting the three-way sum. |
|
| 152 |
|
| 153 |
### The addition ceiling was a vocabulary problem
|
| 154 |
|
|
|
|
| 416 |
|
| 417 |
* **Addition degrades past 14 digits** β 65% at 16, 25% at 18. These are arithmetic slips in
|
| 418 |
a long carry chain, no longer the silent skipped-column failure of the first release.
|
| 419 |
+
* **Multiplication is reliable through 3Γ3** (98.0%). 4Γ4 is a hard wall. No division at all.
|
| 420 |
+
* **Negative results degrade with width** β 100% at 1 digit, 58% at 5. The magnitude
|
| 421 |
+
comparison is the weak step, not the arithmetic.
|
| 422 |
The failures are near misses (375 Γ 903 β 339625 vs 338625), so it is running the
|
| 423 |
partial-product routine and losing digits summing it, not failing to attempt. No division.
|
| 424 |
* **Word problems are weak** (GSM8K 4.0%, best word-problem set ASDiv 16.5%). It converts
|