Instructions to use nkthebass/tinybrainbot-320mV2-instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nkthebass/tinybrainbot-320mV2-instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="nkthebass/tinybrainbot-320mV2-instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("nkthebass/tinybrainbot-320mV2-instruct") model = AutoModelForCausalLM.from_pretrained("nkthebass/tinybrainbot-320mV2-instruct", 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use nkthebass/tinybrainbot-320mV2-instruct 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-320mV2-instruct:F16 # Run inference directly in the terminal: llama cli -hf nkthebass/tinybrainbot-320mV2-instruct:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf nkthebass/tinybrainbot-320mV2-instruct:F16 # Run inference directly in the terminal: llama cli -hf nkthebass/tinybrainbot-320mV2-instruct:F16
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 nkthebass/tinybrainbot-320mV2-instruct:F16 # Run inference directly in the terminal: ./llama-cli -hf nkthebass/tinybrainbot-320mV2-instruct:F16
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 nkthebass/tinybrainbot-320mV2-instruct:F16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf nkthebass/tinybrainbot-320mV2-instruct:F16
Use Docker
docker model run hf.co/nkthebass/tinybrainbot-320mV2-instruct:F16
- LM Studio
- Jan
- vLLM
How to use nkthebass/tinybrainbot-320mV2-instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nkthebass/tinybrainbot-320mV2-instruct" # 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-320mV2-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/nkthebass/tinybrainbot-320mV2-instruct:F16
- SGLang
How to use nkthebass/tinybrainbot-320mV2-instruct 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-320mV2-instruct" \ --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-320mV2-instruct", "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-320mV2-instruct" \ --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-320mV2-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use nkthebass/tinybrainbot-320mV2-instruct with Ollama:
ollama run hf.co/nkthebass/tinybrainbot-320mV2-instruct:F16
- Unsloth Studio
How to use nkthebass/tinybrainbot-320mV2-instruct 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 nkthebass/tinybrainbot-320mV2-instruct 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 nkthebass/tinybrainbot-320mV2-instruct to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for nkthebass/tinybrainbot-320mV2-instruct to start chatting
- Docker Model Runner
How to use nkthebass/tinybrainbot-320mV2-instruct with Docker Model Runner:
docker model run hf.co/nkthebass/tinybrainbot-320mV2-instruct:F16
- Lemonade
How to use nkthebass/tinybrainbot-320mV2-instruct with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull nkthebass/tinybrainbot-320mV2-instruct:F16
Run and chat with the model
lemonade run user.tinybrainbot-320mV2-instruct-F16
List all available models
lemonade list
- Atomic Chat
TinyBrainBot 320M V2 β Instruct
A ~326M-parameter decoder-only language model, trained from scratch on ~10B tokens and then supervised-fine-tuned for chat / instruction following. This is the instruct model.
- Base model:
tinybrainbot-320mV2-base(full pretraining details there). - Successor to the 303M V2 instruct.
TL;DR: A compact general-purpose assistant trained from scratch on ~10B tokens, with an added conversational + in-context-recall fine-tune (robust multi-turn chat, diverse instruction phrasings, remembers facts stated earlier in the conversation). It matches/beats Pythia-410M on general benchmarks (on far fewer training tokens) and sweeps GPT-2-124M, follows instructions, and has 2β3-digit arithmetic far stronger than its GSM8K reasoning score would suggest (94β99% on 2β3-digit addition) β though it hits a clear length-generalization wall beyond 3 digits. It is not math-specialized.
Model details
| Parameters | 325,899,264 (~326M) |
| Architecture | Decoder-only transformer, pre-norm, RMSNorm, SwiGLU MLP, RoPE |
| Hidden size | 1024 |
| Layers | 26 |
| Attention heads | 16 (query) / 4 KV heads (grouped-query attention) |
| FFN size | 2816 |
| Context length | 1024 |
| Vocabulary | 32,000 |
| Tokenizer | tbb-32k-v2 β 32k BPE (67% English / 20% code / 13% math), with reserved <think>/</think> special tokens |
| Precision | trained in fp16 with an fp32 master copy (autocast) |
Usage
Prompt with the chat format:
<|user|>
{user message}
<|end|>
<|assistant|>
{assistant reply}
<|end|>
Example (greedy):
<|user|>
What is the capital of France?
<|end|>
<|assistant|>
Paris.
<|end|>
The model gives concise direct answers and shows worked steps for arithmetic.
Conversational + recall update
This release adds a conversational + in-context-recall fine-tuning pass on top of the base instruct SFT. It:
- answers open-ended imperatives robustly β
list all the planets in the solar systemβ Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, and Neptune.; - handles multi-turn chat and in-context recall (state a fact early, ask about it later);
- stays consistent across the F16 GGUF (LM Studio / Ollama / llama.cpp) and the fp16
transformersweights.
(An earlier build gave terse/empty answers to some imperative phrasings through the GGUF export. That was a real tokenization mismatch in the export β not a capacity limit. This release fixes it two ways: the conversational pass makes the model robust to it, and the F16 GGUF now sets tokenizer.ggml.add_space_prefix=false + ships a leading-space chat template so llama.cpp tokenizes the chat format token-for-token identically to the native tokenizer, per llama.cpp #23840.)
Training procedure
Pretraining (blue, ~10B tokens) β instruct SFT (orange, from step 51k) β conversational + recall SFT (green, steps 52kβ55k, final loss ~0.5).
Pretraining (base)
Pretrained from scratch on 10.03B tokens (51,000 steps, WSD schedule, peak LR 6e-4, two-phase broad β quality-anneal, final loss 1.436) across 2Γ Tesla V100-PCIE-16GB with PyTorch DDP (gloo), fp16 autocast + fused AdamW. Full pretraining details and the 13-source data mix are documented on the base model card.
Supervised fine-tuning (this model)
| Hyperparameter | Value |
|---|---|
| Steps | ~1,433 (resumed from base @ 51,000) |
| Tokens | ~94M |
| LR | 1.5e-5, constant |
| Warmup | 100 steps |
| Global batch | 4 micro Γ 8 grad-accum Γ 2 GPUs Γ 1024 seq |
| Loss masking | assistant-only |
| Best checkpoint | step 52,000 (selected on eval, not last) |
SFT data mix (sampling weights; sum = 9.5; math β 15.8% of the mixture):
| Source | Weight |
|---|---|
| longdef-sft (~16k long / multi-step answers) | 2.0 |
| smoltalk | 2.0 |
| math-v2 (~70k verified worked examples) | 1.5 |
| qa-distill | 1.0 |
| lamini-instructions | 1.0 |
| soda-dialogues | 1.0 |
| greetings | 0.5 |
| reasoning-distill | 0.5 |
math-v2 is ~70k programmatically-generated, tolerance-verified arithmetic worked examples (multiplication / division / decimals, with the final answer checked). It appears in both pretraining and SFT β see the note below.
On where the arithmetic comes from: the base and instruct models score almost identically on the GPT-3 Arithmetic suite (aggregate 31.4% vs 31.2%). That base/instruct parity suggests most arithmetic computation was acquired during pretraining, while SFT mainly shaped instruction-following and response format (the one sub-task where SFT clearly helps is composite / order-of-operations, 7.0% vs 3.7%). Pretraining also delivered far more math tokens in absolute terms β on the order of ~215M vs ~15M β despite SFT's higher math proportion.
Conversational + recall fine-tuning (final stage β this release)
A further SFT pass continued from the instruct checkpoint (step 52,000 β 55,000) to make the model a robust multi-turn conversationalist, teach in-context recall, and fix brittle behavior on open-ended instruction phrasings.
| Hyperparameter | Value |
|---|---|
| Steps | 3,000 (resumed from instruct @ 52,000) |
| LR | 1.5e-5, constant (WSD, decay-fraction 0) |
| Global batch | 2 micro Γ 16 grad-accum Γ 2 GPUs Γ 1024 seq |
| Loss masking | assistant-only |
| Final loss | ~0.5 |
Data mix (sampling weights):
| Source | Weight |
|---|---|
| convo-recall (6k multi-turn in-context-recall dialogues) | 2.5 |
| convo-core (4k instruction-phrasing + small-talk) | 2.5 |
| smoltalk | 1.5 |
| math-v3 | 0.75 |
| longdef-sft | 0.75 |
| greetings | 0.5 |
| qa-distill | 0.5 |
convo-recall and convo-core are programmatically generated: convo-recall teaches in-context memory (the user states facts early β name / city / pet / counts β then asks about them later), and convo-core covers diverse instruction verbs ("list all / name / give me / what are the β¦") over closed sets with correct complete answers, plus natural small-talk. Alongside the conversational gains, this pass makes the model robust to the SPM normalization that the GGUF/HF exports drop β so it now behaves consistently in llama.cpp / LM Studio / Ollama and in transformers, instead of degrading on some phrasings through the export.
Evaluation
Measured on our own log-likelihood MC harness (lm-eval style, fixed seed). Headline metric = acc_norm for HellaSwag/ARC/OpenBookQA, acc for WinoGrande/MMLU. Reference values are published lm-eval approximations β treat gaps under ~Β±2 points as ties.
vs the previous 303M instruct (full test sets)
| Benchmark | n | 320M V2 instruct | 303M instruct |
|---|---|---|---|
| HellaSwag | 10042 | 34.5 | 30.7 |
| ARC-Easy (acc_norm) | 2376 | 49.3 | 47.6 |
| ARC-Easy (raw acc) | 2376 | 57.0 | 51.0 |
| ARC-Challenge | 1172 | 27.6 | 27.6 |
| OpenBookQA | 500 | 31.8 | 29.0 |
| WinoGrande | 1267 | 53.3 | 52.2 |
| MMLU | 14042 | 28.0 | 27.1 |
β 5 wins, 1 tie, 0 losses over the previous generation.
vs reference models (headline metric)
| Benchmark | 320M V2 instruct | GPT-2-124M | Pythia-410M | SmolLM-360M |
|---|---|---|---|---|
| HellaSwag | 34.5 | 31 | 34 | 54 |
| ARC-Easy | 49.3 (57 raw) | 44 | 52 | 70 |
| ARC-Challenge | 27.6 | 22 | 24 | 37 |
| OpenBookQA | 31.8 | 29 | 30 | 42 |
| WinoGrande | 53.3 | 52 | 53 | 57 |
| MMLU | 28.0 | 26 | 25 | 34 |
β Sweeps GPT-2-124M; ~5 wins + 1 draw vs Pythia-410M. SmolLM-360M (trained on ~600B aggressively-filtered tokens) remains the frontier for this size.
Training efficiency. These results come from ~10B pretraining tokens β roughly an order of magnitude fewer than the Pythia suite's ~300B. The Pythia-410M parity is therefore best read as a token-efficiency result (curated data + quality anneal) rather than a scale win.
Math β computation vs reasoning
The model was trained on arithmetic computation, not word-problem reasoning β the two benchmarks below show that split clearly.
GSM8K (grade-school word problems, full 1319-problem test, zero-shot chain-of-thought):
| Model | GSM8K |
|---|---|
| GPT-2-124M | ~0% |
| 320M V2 instruct | 0.53% |
| Pythia-410M | ~1β2% |
| SmolLM2-360M-Instruct | ~3β5% |
β At the floor for a general-purpose model of this size and training mix; stronger sub-1B math-specialized models can score substantially higher. GSM8K rewards multi-step semantic reasoning, which this recipe did not target.
GPT-3 Arithmetic (Brown et al. 2020 protocol, exact-match, n=300/sub-task):
| Sub-task | Accuracy |
|---|---|
| 2-digit addition | 99.0% |
| 3-digit addition | 94.0% |
| 2-digit subtraction | 49.3% |
| 3-digit subtraction | 42.7% |
| 4-digit addition / subtraction | 0.3% / 0.3% |
| 5-digit addition / subtraction | 0.0% / 0.0% |
| 2-digit multiplication | 21.7% |
| single-digit composite (order of ops) | 7.0% |
| Aggregate (all 10 sub-tasks) | 31.4% |
β Strong through 3 digits, then a hard wall. 2β3-digit addition is near-solved (94β99%, with correct carrying), but 4+-digit accuracy collapses to 0%: the model executes a fixed **3-column** addition routine and silently drops the higher place values β a length-generalization limit tied to the training distribution (math-v2 operands are β€3 digits), not truncation (generations complete normally and end with a stated answer). Subtraction sits ~42β50% β it handles aβb when a>b but drops the sign on negative results. 2-digit multiplication ~22%; single-digit composite (order of operations) ~7%.
How to read this: the GPT-3 Arithmetic suite mainly probes exact symbolic computation and short-range algorithmic generalization; it should not be interpreted as evidence of strong mathematical reasoning (see GSM8K above). The two results together are the point: strong at computing, weak at reasoning.
Intended use & limitations
Intended use: a capable general chat assistant at ~326M scale, on-device / low-resource deployment, research on small-model SFT, and arithmetic computation.
Limitations:
- Math reasoning (word problems, GSM8K/MATH) is at the floor β the model computes but does not reason through multi-step problems.
- Negative-result subtraction is unreliable (drops the sign).
- WinoGrande and MMLU sit near the random floor β consistent with the capacity and data limits of a ~326M model under this training recipe.
- Trained predominantly on English; 1024-token context; no RLHF/safety tuning β outputs may be incorrect or inappropriate and should not be relied upon unchecked.
Hardware & framework
2Γ NVIDIA Tesla V100-PCIE-16GB Β· Windows Β· PyTorch DDP (gloo) Β· fp16 autocast (fp32 master) Β· fused AdamW Β· custom TinyBrainBot trainer.
- Downloads last month
- 760
Model tree for nkthebass/tinybrainbot-320mV2-instruct
Base model
nkthebass/tinybrainbot-320mV2-base