Instructions to use nkthebass/tinybrainbot-360m-a75m-v6-coder with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nkthebass/tinybrainbot-360m-a75m-v6-coder with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="nkthebass/tinybrainbot-360m-a75m-v6-coder") 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-360m-a75m-v6-coder") model = AutoModelForCausalLM.from_pretrained("nkthebass/tinybrainbot-360m-a75m-v6-coder", 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-360m-a75m-v6-coder 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-360m-a75m-v6-coder:Q4_K_M # Run inference directly in the terminal: llama cli -hf nkthebass/tinybrainbot-360m-a75m-v6-coder:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf nkthebass/tinybrainbot-360m-a75m-v6-coder:Q4_K_M # Run inference directly in the terminal: llama cli -hf nkthebass/tinybrainbot-360m-a75m-v6-coder:Q4_K_M
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-360m-a75m-v6-coder:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf nkthebass/tinybrainbot-360m-a75m-v6-coder:Q4_K_M
Use Docker
docker model run hf.co/nkthebass/tinybrainbot-360m-a75m-v6-coder:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use nkthebass/tinybrainbot-360m-a75m-v6-coder with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nkthebass/tinybrainbot-360m-a75m-v6-coder" # 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-360m-a75m-v6-coder", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/nkthebass/tinybrainbot-360m-a75m-v6-coder:Q4_K_M
- SGLang
How to use nkthebass/tinybrainbot-360m-a75m-v6-coder 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-360m-a75m-v6-coder" \ --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-360m-a75m-v6-coder", "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-360m-a75m-v6-coder" \ --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-360m-a75m-v6-coder", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use nkthebass/tinybrainbot-360m-a75m-v6-coder with Ollama:
ollama run hf.co/nkthebass/tinybrainbot-360m-a75m-v6-coder:Q4_K_M
- Unsloth Desktop
- Docker Model Runner
How to use nkthebass/tinybrainbot-360m-a75m-v6-coder with Docker Model Runner:
docker model run hf.co/nkthebass/tinybrainbot-360m-a75m-v6-coder:Q4_K_M
- Lemonade
How to use nkthebass/tinybrainbot-360m-a75m-v6-coder with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull nkthebass/tinybrainbot-360m-a75m-v6-coder:Q4_K_M
Run and chat with the model
lemonade run user.tinybrainbot-360m-a75m-v6-coder-Q4_K_M
List all available models
lemonade list
- Atomic Chat
TinyBrainBot-360M-A75M-v6-Coder
A small coding assistant on the v6 base. The 360M-A75M mixture-of-experts model (383M parameters, 24 experts per
layer, 4 active, so about 75M parameters work per token) with a code stage added: a 1.26B-token code anneal on half of
its experts, then a code instruction tune. It keeps Python indentation, reads up to 4,096 tokens, and can write a short
plan before the code when you ask it to. It loads as a standard MixtralForCausalLM.
You: Write a Python function that checks if a string is a palindrome.
TinyBrainBot:
Here is the code to solve this problem:
def is_palindrome(s):
return s == s[::-1]
Be clear about what it is. It is strongest on short Python functions. Other languages come out looking right and are often wrong, and our own Python-only model scores higher on the Python benchmarks below. This model's additions are the wider language exposure, the longer context and the optional thinking.
Code benchmarks
Every model went through the same harness: the task goes in the chat template, the answer's code block is run against the official tests, greedy decoding, pass@1, HumanEval (164 tasks) and MBPP sanitized test (257 tasks).
| Model | Params | HumanEval | MBPP |
|---|---|---|---|
| TinyBrainBot-360M-A75M-v6-Coder (this), direct | 383M (75M active) | 12.8 | 24.9 |
| TinyBrainBot-360M-A75M-v6-Coder (this), think mode | 383M (75M active) | 12.8 | 17.9 |
| TinyBrainBot-360M-A75M-v5.1-Python | 383M (75M active) | 14.6 | 32.7 |
| SmolLM2-360M-Instruct | 362M | 16.5 | 33.5 |
| SmolLM2-135M-Instruct | 135M | 7.9 | 10.9 |
| Qwen2.5-Coder-0.5B-Instruct | 494M | 52.4 | 46.3 |
Qwen2.5-Coder-0.5B is a larger code-specialised model trained on trillions of tokens; it is a reference point, not a peer.
| General benchmarks (0-shot, full set) | acc_norm | (raw acc) |
|---|---|---|
| HellaSwag | 41.08 | 34.85 |
| ARC-Easy | 60.02 | 63.13 |
| ARC-Challenge | 35.49 | 32.94 |
| PIQA | 68.61 | 68.01 |
| ArithMark-3 | 52.80 | 52.80 |
| Open SLM Leaderboard Intelligence Index | 30.98 | 28.48 |
Unedited answers, including the wrong ones, are in code_samples.md and
think_samples.md.
Think mode
Add the system prompt Think step by step before answering. and the model writes a short numbered plan inside
<think> ... </think> before the code. Without that system prompt it answers directly.
<think>
To implement the function `fib_to_num`, we need to understand what the Fibonacci sequence is and how to compute it. The Fibonacci sequence is a series of numbers where each number is the sum of the two preceding ones, usually starting with 0 and 1. The sequence goes: 0, 1, 1, 2, 3, 5, 8, 13, ...
The steps to implement this function are as follows:
1. **Understand the Input**: The input is an integer `n` which represents the position in the Fibonacci sequence.
2. **Initialization**: Start with the first two numbers (0 and 1).
3. **Iteration**: Use a loop to generate the next numbers in the sequence.
4. **Accumulation**: Add the current two numbers together and store the result in a variable.
5. **Return the Result**: Return the accumulated value as the n-th Fibonacci number.
By following these steps, we can ensure that the function correctly computes the n-th Fibonacci number.
</think>
```python
def fib_to_num(n):
if n <= 0:
return 0
elif n == 1:
return 1
else:
prev, curr = 0, 1
for _ in range(2, n + 1):
prev, curr = curr, prev + curr
return curr
```
Thinking does not make it more accurate: think mode scores 12.8 on HumanEval (direct: 12.8) and 17.9 on MBPP (direct: 24.9). It is there because the plan can be useful to read, not because it helps the score. In the benchmark run every one of the 421 tasks produced a think block, and 3 of them did not finish it within 3,000 tokens.
Quick start
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "nkthebass/tinybrainbot-360m-a75m-v6-coder"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo)
msgs = [
# {"role": "system", "content": "Think step by step before answering."}, # uncomment for think mode
{"role": "user", "content": "Write a function is_prime(n) that returns True if n is prime."},
]
ids = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt")
out = model.generate(ids, max_new_tokens=600) # defaults from generation_config.json
text = tok.decode(out[0], skip_special_tokens=False) # decode WITH the prompt, then cut it off (see below)
print(text[len(tok.decode(ids[0], skip_special_tokens=False)):].split("<|end|>")[0].strip())
Decode the answer together with the prompt and cut the prompt off, as above. The tokenizer's decoder drops one leading space from whatever it decodes, so decoding only the new tokens can turn a first 4-space indent into 3.
GGUF (llama.cpp, LM Studio, Jan, Ollama): Q8_0 (409 MB), Q4_K_M (239 MB) or F16 (768 MB). The chat template is embedded and the context is 4,096 tokens. Checked against transformers: prompts with indented code and with the think system prompt tokenize identically (4 of 4 prompts), and greedy F16 output was identical on 3 of 4 prompts; on the fourth, a think-mode answer, the two diverged after 12 tokens.
llama-cli -m tinybrainbot-360m-a75m-v6-coder-Q8_0.gguf -cnv -c 4096 --temp 0.4 --top-p 0.9 --repeat-penalty 1.15 --logit-bias 241-inf --logit-bias 255-inf
Recommended sampling: temperature 0.4, top-p 0.9, repetition penalty 1.15 (the generation_config.json defaults).
Without a repetition penalty it can get stuck repeating a line, especially outside Python.
How it was made
| Stage | Tokens | What |
|---|---|---|
| 1. v6 base | see its card | general pretraining, 2,048 context |
| 2. Instruct tune | 393M | every weight, the v6 instruct mix (chat, instructions, math) |
| 3. Expert code anneal | 1.26B | 12 of the 24 experts per layer, context raised to 4,096 |
| 4. Code tune | 328M | every weight, code instructions with short reasoning traces |
Stage 3, code on half the experts. The 12 experts per layer that code text already used most were trained at the full learning rate, attention, norms and routers at a tenth of it, and the other 12 experts were frozen (checked bit-for-bit at every checkpoint). That kept the general scores almost flat while the model learned code: the Index went from 32.62 to 32.38 over this stage. Data: 37% GitHub code (22 languages, about a fifth of it Python), 20% codeparrot-clean Python, 24% OpenCoder annealing corpus, 19% replay of the earlier stages. The longer context needs no new weights (positions are rotary), but the model had to see long inputs to use them.
Stage 4, code instructions. Shares of the training tokens:
| Share | Data |
|---|---|
| 28% | Python, direct answers: OpenCoder SFT stage 2, self-oss-instruct-sc2, Tested-143k-Python-Alpaca, Magicoder OSS-Instruct, and the v5.1 Python model's test-passing answers on KodCode problems |
| 27% | Many languages, direct answers: CodeFeedback, Code-Feedback multi-turn, Glaive code assistant v3, Magicoder Evol-Instruct and OSS-Instruct, OpenCoder, CodeAlpaca |
| 20% | Short reasoning traces, at most 700 tokens of reasoning: Python function plans (notbadai), short DeepSeek-R1 traces on easy function tasks (allenai rlvr), debugging steps (CodeDebug-Instruct) |
| 25% | Replay of the instruct mix |
| Step | HumanEval | MBPP |
|---|---|---|
| After stage 2 (instruct) | 0.0 | 1.2 |
| After stage 3 (code anneal) | 3.7 | 15.6 |
| After stage 4 (this model) | 12.8 | 24.9 |
Long traces hurt, short ones don't. A first version of stage 4 used long DeepSeek-R1 traces (a median of about 1,500 tokens of reasoning, 30% of the mix). Its think mode scored 9.2 on HumanEval and 13.2 on MBPP against 12.8 and 24.5 direct, and a fifth of its answers never finished thinking. The model copied the look of the reasoning, including "tests" that checked nothing. With the short traces used here, think mode is level with direct on HumanEval and the gap on MBPP is smaller.
Indentation. Each run of 4 spaces is one token (" ", id 24) and tabs become 4 spaces, so Python indentation
survives training and generation. Two or more spaces inside a line (not at the start) still collapse into one.
Contamination. Every instruction example that shares a 13-word sequence with HumanEval (prompts, solutions, tests) or any MBPP split was dropped. No benchmark data was trained on.
Licences. The model is released under Apache-2.0. KodCode-V1 is CC BY-NC 4.0, the allenai rlvr trace set states no licence on its card, and the code corpora carry their own source licences. Check those terms before any commercial use.
Limitations
- Short Python functions are its range. String and list processing, simple loops and recursion usually work. Multi-step tasks often come out wrong.
- Other languages are unreliable. In the samples, the C++ factorial is right and the SQL query works (it returns customer ids, not names), the JavaScript duplicate filter has its condition inverted, the Go "reverse" does not reverse, the batch file came out as Python, and the Rust and PowerShell answers repeat one line until they run out of tokens.
- It explains code badly. Asked what a two-line function does, it described something else. Asked to fix a small bug, its rewrite happened to remove the bug, but the explanation blamed something unrelated.
- Follow-ups lose the thread. "Now make it ignore spaces" dropped the reversal it had just written.
- Thinking is not checking. The plan reads well and the code can still be wrong.
- English only. It makes things up like any model this size. Run the code before you trust it.
- Downloads last month
- -
Model tree for nkthebass/tinybrainbot-360m-a75m-v6-coder
Base model
nkthebass/tinybrainbot-360m-a75m-v6-baseDatasets used to train nkthebass/tinybrainbot-360m-a75m-v6-coder
codeparrot/github-code-clean
bigcode/self-oss-instruct-sc2-exec-filter-50k
Collection including nkthebass/tinybrainbot-360m-a75m-v6-coder
Evaluation results
- pass@1 (greedy, chat) on HumanEvaltest set self-reported12.800
- pass@1 (greedy, chat) on MBPP (sanitized)test set self-reported24.900
- acc_norm (0-shot) on ARC-Easytest set self-reported60.020
- acc_norm (0-shot) on ARC-Challengetest set self-reported35.490
- acc_norm (0-shot) on HellaSwagvalidation set self-reported41.080
- acc_norm (0-shot) on PIQAvalidation set self-reported68.610