Text Generation
Transformers
Safetensors
English
lfm2_moe
wiuai
from-scratch
small-language-model
mixture-of-experts
Mixture of Experts
hybrid-architecture
short-convolution
attention
sparse-computation
coding
code-generation
instruction-following
tool-calling
reasoning
conversational
chat
Instructions to use WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m") 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("WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m") model = AutoModelForCausalLM.from_pretrained("WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m", 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
- vLLM
How to use WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m
- SGLang
How to use WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m 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 "WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m" \ --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": "WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m", "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 "WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m" \ --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": "WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m with Docker Model Runner:
docker model run hf.co/WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m
Upload 8 files
Browse files- README.md +206 -3
- chat_template.jinja +132 -0
- config.json +44 -0
- generation_config.json +9 -0
- model.safetensors +3 -0
- sample_chats.md +113 -0
- tokenizer.json +0 -0
- tokenizer_config.json +270 -0
README.md
CHANGED
|
@@ -1,3 +1,206 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
library_name: transformers
|
| 6 |
+
pipeline_tag: text-generation
|
| 7 |
+
tags:
|
| 8 |
+
- WIUAI.Flash.MoE.Coder.instruct.53m
|
| 9 |
+
- small-language-model
|
| 10 |
+
- from-scratch
|
| 11 |
+
- mixture-of-experts
|
| 12 |
+
- moe
|
| 13 |
+
- lfm2_moe
|
| 14 |
+
- hybrid
|
| 15 |
+
- tool-calling
|
| 16 |
+
- reasoning
|
| 17 |
+
- conversational
|
| 18 |
+
- gguf
|
| 19 |
+
datasets:
|
| 20 |
+
- HuggingFaceFW/fineweb-edu
|
| 21 |
+
- mlfoundations/dclm-baseline-1.0
|
| 22 |
+
- wikimedia/wikipedia
|
| 23 |
+
- HuggingFaceTB/cosmopedia
|
| 24 |
+
- HuggingFaceTB/smollm-corpus
|
| 25 |
+
- HuggingFaceTB/finemath
|
| 26 |
+
- OctoThinker/MegaMath-Web-Pro-Max
|
| 27 |
+
- HuggingFaceFW/finepdfs-edu
|
| 28 |
+
- bigcode/the-stack-smol
|
| 29 |
+
- manu/project_gutenberg
|
| 30 |
+
- lucadiliello/bookcorpusopen
|
| 31 |
+
- roneneldan/TinyStories
|
| 32 |
+
- ArrowLabs/DCLM-Ultra-1.1
|
| 33 |
+
- AxiomicLabs/FactBase-DCLM
|
| 34 |
+
- sentence-transformers/gooaq
|
| 35 |
+
- sentence-transformers/eli5
|
| 36 |
+
- HuggingFaceFW/finephrase
|
| 37 |
+
- microsoft/orca-math-word-problems-200k
|
| 38 |
+
- HuggingFaceTB/smol-smoltalk
|
| 39 |
+
- HuggingFaceTB/smoltalk
|
| 40 |
+
- allenai/tulu-3-sft-personas-instruction-following
|
| 41 |
+
- allenai/WildChat-4.8M
|
| 42 |
+
- teknium/OpenHermes-2.5
|
| 43 |
+
- NousResearch/hermes-function-calling-v1
|
| 44 |
+
model-index:
|
| 45 |
+
- name: WIUAI.Flash.MoE.Coder.instruct.53m
|
| 46 |
+
results:
|
| 47 |
+
- task:
|
| 48 |
+
type: text-generation
|
| 49 |
+
dataset:
|
| 50 |
+
type: allenai/ai2_arc
|
| 51 |
+
name: ARC-Easy
|
| 52 |
+
config: ARC-Easy
|
| 53 |
+
split: test
|
| 54 |
+
metrics:
|
| 55 |
+
- type: acc_norm
|
| 56 |
+
value: 49.71
|
| 57 |
+
name: acc_norm (0-shot)
|
| 58 |
+
- task:
|
| 59 |
+
type: text-generation
|
| 60 |
+
dataset:
|
| 61 |
+
type: allenai/ai2_arc
|
| 62 |
+
name: ARC-Challenge
|
| 63 |
+
config: ARC-Challenge
|
| 64 |
+
split: test
|
| 65 |
+
metrics:
|
| 66 |
+
- type: acc_norm
|
| 67 |
+
value: 30.29
|
| 68 |
+
name: acc_norm (0-shot)
|
| 69 |
+
- task:
|
| 70 |
+
type: text-generation
|
| 71 |
+
dataset:
|
| 72 |
+
type: Rowan/hellaswag
|
| 73 |
+
name: HellaSwag
|
| 74 |
+
split: validation
|
| 75 |
+
metrics:
|
| 76 |
+
- type: acc_norm
|
| 77 |
+
value: 30.10
|
| 78 |
+
name: acc_norm (0-shot)
|
| 79 |
+
- task:
|
| 80 |
+
type: text-generation
|
| 81 |
+
dataset:
|
| 82 |
+
type: ybisk/piqa
|
| 83 |
+
name: PIQA
|
| 84 |
+
split: validation
|
| 85 |
+
metrics:
|
| 86 |
+
- type: acc_norm
|
| 87 |
+
value: 64.04
|
| 88 |
+
name: acc_norm (0-shot)
|
| 89 |
+
- task:
|
| 90 |
+
type: text-generation
|
| 91 |
+
dataset:
|
| 92 |
+
type: allenai/openbookqa
|
| 93 |
+
name: OpenBookQA
|
| 94 |
+
config: main
|
| 95 |
+
split: test
|
| 96 |
+
metrics:
|
| 97 |
+
- type: acc_norm
|
| 98 |
+
value: 32.40
|
| 99 |
+
name: acc_norm (0-shot)
|
| 100 |
+
- task:
|
| 101 |
+
type: text-generation
|
| 102 |
+
dataset:
|
| 103 |
+
type: allenai/sciq
|
| 104 |
+
name: SciQ
|
| 105 |
+
split: test
|
| 106 |
+
metrics:
|
| 107 |
+
- type: acc_norm
|
| 108 |
+
value: 63.90
|
| 109 |
+
name: acc_norm (0-shot)
|
| 110 |
+
- task:
|
| 111 |
+
type: text-generation
|
| 112 |
+
dataset:
|
| 113 |
+
type: allenai/winogrande
|
| 114 |
+
name: WinoGrande
|
| 115 |
+
config: winogrande_xl
|
| 116 |
+
split: validation
|
| 117 |
+
metrics:
|
| 118 |
+
- type: acc
|
| 119 |
+
value: 49.41
|
| 120 |
+
name: acc (0-shot)
|
| 121 |
+
- task:
|
| 122 |
+
type: text-generation
|
| 123 |
+
dataset:
|
| 124 |
+
type: google/boolq
|
| 125 |
+
name: BoolQ
|
| 126 |
+
split: validation
|
| 127 |
+
metrics:
|
| 128 |
+
- type: acc
|
| 129 |
+
value: 58.72
|
| 130 |
+
name: acc (0-shot)
|
| 131 |
+
- task:
|
| 132 |
+
type: text-generation
|
| 133 |
+
dataset:
|
| 134 |
+
type: EleutherAI/lambada_openai
|
| 135 |
+
name: LAMBADA (OpenAI)
|
| 136 |
+
split: test
|
| 137 |
+
metrics:
|
| 138 |
+
- type: acc
|
| 139 |
+
value: 22.88
|
| 140 |
+
name: acc (0-shot)
|
| 141 |
+
- task:
|
| 142 |
+
type: text-generation
|
| 143 |
+
dataset:
|
| 144 |
+
type: cais/mmlu
|
| 145 |
+
name: MMLU
|
| 146 |
+
config: all
|
| 147 |
+
split: test
|
| 148 |
+
metrics:
|
| 149 |
+
- type: acc
|
| 150 |
+
value: 24.82
|
| 151 |
+
name: acc (0-shot)
|
| 152 |
+
- task:
|
| 153 |
+
type: text-generation
|
| 154 |
+
dataset:
|
| 155 |
+
type: tau/commonsense_qa
|
| 156 |
+
name: CommonsenseQA
|
| 157 |
+
split: validation
|
| 158 |
+
metrics:
|
| 159 |
+
- type: acc
|
| 160 |
+
value: 21.70
|
| 161 |
+
name: acc (0-shot)
|
| 162 |
+
- task:
|
| 163 |
+
type: text-generation
|
| 164 |
+
dataset:
|
| 165 |
+
type: allenai/social_i_qa
|
| 166 |
+
name: Social IQa
|
| 167 |
+
split: validation
|
| 168 |
+
metrics:
|
| 169 |
+
- type: acc
|
| 170 |
+
value: 37.67
|
| 171 |
+
name: acc (0-shot)
|
| 172 |
+
---
|
| 173 |
+
|
| 174 |
+
# WIUAI.Flash.MoE.Coder.instruct.53m
|
| 175 |
+
|
| 176 |
+
A tiny chat model with **thinking and tool calling**, trained from scratch. It's the first TinyBrainBot on a new
|
| 177 |
+
**hybrid architecture**: gated short-convolution blocks plus a few attention blocks, with a mixture of experts. 53.4M
|
| 178 |
+
parameters in total, **9.3M active per token**. The layout matches LiquidAI's LFM2-MoE, so it runs **natively** in
|
| 179 |
+
llama.cpp, LM Studio and Ollama, and in transformers >= 5 as `Lfm2MoeForCausalLM`: no custom code.
|
| 180 |
+
|
| 181 |
+
It's the small-scale test of the recipe and architecture planned for a larger WIUAI.Flash.MoE.Coder.instruct.53m. Expect a tiny model:
|
| 182 |
+
fluent and quick, often right on simple facts, unreliable on arithmetic and multi-step instructions.
|
| 183 |
+
|
| 184 |
+
| Benchmark (0-shot, full test sets) | **This model** | Base before fine-tuning | Change |
|
| 185 |
+
|---|--:|--:|--:|
|
| 186 |
+
| ARC-Easy (acc_norm) | 49.71 | 49.66 | +0.04 |
|
| 187 |
+
| *(raw acc)* | *55.47* | *55.81* | |
|
| 188 |
+
| ARC-Challenge (acc_norm) | 30.29 | 29.44 | +0.85 |
|
| 189 |
+
| *(raw acc)* | *26.96* | *26.71* | |
|
| 190 |
+
| HellaSwag (acc_norm) | 30.10 | 30.13 | -0.03 |
|
| 191 |
+
| *(raw acc)* | *28.18* | *28.23* | |
|
| 192 |
+
| PIQA (acc_norm) | 64.04 | 63.22 | +0.82 |
|
| 193 |
+
| *(raw acc)* | *63.66* | *63.76* | |
|
| 194 |
+
| OpenBookQA (acc_norm) | 32.40 | 32.80 | -0.40 |
|
| 195 |
+
| *(raw acc)* | *20.60* | *21.20* | |
|
| 196 |
+
| SciQ (acc_norm) | 63.90 | 63.70 | +0.20 |
|
| 197 |
+
| *(raw acc)* | *72.90* | *72.90* | |
|
| 198 |
+
| WinoGrande (acc) | 49.41 | 49.33 | +0.08 |
|
| 199 |
+
| BoolQ (acc) | 58.72 | 58.26 | +0.46 |
|
| 200 |
+
| LAMBADA (OpenAI) (acc) | 22.88 | 21.00 | +1.88 |
|
| 201 |
+
| MMLU (acc) | 24.82 | 23.42 | +1.40 |
|
| 202 |
+
| CommonsenseQA (acc) | 21.70 | 20.15 | +1.56 |
|
| 203 |
+
| Social IQa (acc) | 37.67 | 38.08 | -0.41 |
|
| 204 |
+
| ArithMark-3 (acc_norm) | 43.90 | 52.90 | -9.00 |
|
| 205 |
+
| *held-out arithmetic (our probe: skills ArithMark-3 doesn't test)* | *40.94* | *40.80* | *+0.14* |
|
| 206 |
+
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{#- TinyBrainBot hybrid chat template (2026-11): Qwen3.8 structure (ChatML, XML tool calls, <tool_response>, hybrid <think>)
|
| 2 |
+
plus reasoning_effort. enable_thinking=false -> empty think block; enable_thinking=true -> opens <think>; unset -> the
|
| 3 |
+
model decides. reasoning_effort (low | medium | high) is stated in the system turn; "none" = no thinking. -#}
|
| 4 |
+
{%- macro render_content(content) %}
|
| 5 |
+
{%- if content is string %}
|
| 6 |
+
{{- content }}
|
| 7 |
+
{%- elif content is iterable and content is not mapping %}
|
| 8 |
+
{%- for item in content %}
|
| 9 |
+
{%- if 'text' in item %}
|
| 10 |
+
{{- item.text }}
|
| 11 |
+
{%- endif %}
|
| 12 |
+
{%- endfor %}
|
| 13 |
+
{%- elif content is none or content is undefined %}
|
| 14 |
+
{{- '' }}
|
| 15 |
+
{%- endif %}
|
| 16 |
+
{%- endmacro %}
|
| 17 |
+
{%- if not messages %}
|
| 18 |
+
{{- raise_exception('No messages provided.') }}
|
| 19 |
+
{%- endif %}
|
| 20 |
+
{%- set effort = reasoning_effort if reasoning_effort is defined and reasoning_effort in ['none', 'low', 'medium', 'high'] else none %}
|
| 21 |
+
{%- set effort_line = ('Reasoning effort: ' ~ effort) if effort and effort != 'none' else '' %}
|
| 22 |
+
{%- set sys_content = render_content(messages[0].content)|trim if messages[0].role == 'system' else '' %}
|
| 23 |
+
{%- if tools and tools is iterable and tools is not mapping %}
|
| 24 |
+
{{- '<|im_start|>system\n' }}
|
| 25 |
+
{{- "# Tools\n\nYou have access to the following functions:\n\n<tools>" }}
|
| 26 |
+
{%- for tool in tools %}
|
| 27 |
+
{{- "\n" }}
|
| 28 |
+
{{- tool | tojson }}
|
| 29 |
+
{%- endfor %}
|
| 30 |
+
{{- "\n</tools>" }}
|
| 31 |
+
{{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>\nvalue_1\n</parameter>\n<parameter=example_parameter_2>\nThis is the value for the second parameter\nthat can span\nmultiple lines\n</parameter>\n</function>\n</tool_call>\n\n<IMPORTANT>\nReminder:\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\n- Required parameters MUST be specified\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\n</IMPORTANT>' }}
|
| 32 |
+
{%- if sys_content %}
|
| 33 |
+
{{- '\n\n' + sys_content }}
|
| 34 |
+
{%- endif %}
|
| 35 |
+
{%- if effort_line %}
|
| 36 |
+
{{- '\n\n' + effort_line }}
|
| 37 |
+
{%- endif %}
|
| 38 |
+
{{- '<|im_end|>\n' }}
|
| 39 |
+
{%- elif sys_content or effort_line %}
|
| 40 |
+
{{- '<|im_start|>system\n' + sys_content }}
|
| 41 |
+
{%- if effort_line %}
|
| 42 |
+
{{- ('\n\n' if sys_content else '') + effort_line }}
|
| 43 |
+
{%- endif %}
|
| 44 |
+
{{- '<|im_end|>\n' }}
|
| 45 |
+
{%- endif %}
|
| 46 |
+
{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
|
| 47 |
+
{%- for message in messages[::-1] %}
|
| 48 |
+
{%- set index = (messages|length - 1) - loop.index0 %}
|
| 49 |
+
{%- if ns.multi_step_tool and message.role == "user" %}
|
| 50 |
+
{%- set content = render_content(message.content)|trim %}
|
| 51 |
+
{%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}
|
| 52 |
+
{%- set ns.multi_step_tool = false %}
|
| 53 |
+
{%- set ns.last_query_index = index %}
|
| 54 |
+
{%- endif %}
|
| 55 |
+
{%- endif %}
|
| 56 |
+
{%- endfor %}
|
| 57 |
+
{%- for message in messages %}
|
| 58 |
+
{%- set content = render_content(message.content)|trim %}
|
| 59 |
+
{%- if message.role == "system" %}
|
| 60 |
+
{%- if not loop.first %}
|
| 61 |
+
{{- raise_exception('System message must be at the beginning.') }}
|
| 62 |
+
{%- endif %}
|
| 63 |
+
{%- elif message.role == "user" %}
|
| 64 |
+
{{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
|
| 65 |
+
{%- elif message.role == "assistant" %}
|
| 66 |
+
{%- set reasoning_content = '' %}
|
| 67 |
+
{%- if message.reasoning_content is string %}
|
| 68 |
+
{%- set reasoning_content = message.reasoning_content %}
|
| 69 |
+
{%- else %}
|
| 70 |
+
{%- if '</think>' in content %}
|
| 71 |
+
{%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
|
| 72 |
+
{%- set content = content.split('</think>')[-1].lstrip('\n') %}
|
| 73 |
+
{%- endif %}
|
| 74 |
+
{%- endif %}
|
| 75 |
+
{%- set reasoning_content = reasoning_content|trim %}
|
| 76 |
+
{%- if loop.index0 > ns.last_query_index %}
|
| 77 |
+
{{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content + '\n</think>\n\n' + content }}
|
| 78 |
+
{%- else %}
|
| 79 |
+
{{- '<|im_start|>' + message.role + '\n' + content }}
|
| 80 |
+
{%- endif %}
|
| 81 |
+
{%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}
|
| 82 |
+
{%- for tool_call in message.tool_calls %}
|
| 83 |
+
{%- if tool_call.function is defined %}
|
| 84 |
+
{%- set tool_call = tool_call.function %}
|
| 85 |
+
{%- endif %}
|
| 86 |
+
{%- if loop.first %}
|
| 87 |
+
{%- if content|trim %}
|
| 88 |
+
{{- '\n\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
|
| 89 |
+
{%- else %}
|
| 90 |
+
{{- '<tool_call>\n<function=' + tool_call.name + '>\n' }}
|
| 91 |
+
{%- endif %}
|
| 92 |
+
{%- else %}
|
| 93 |
+
{{- '\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
|
| 94 |
+
{%- endif %}
|
| 95 |
+
{%- if tool_call.arguments is defined %}
|
| 96 |
+
{%- for args_name, args_value in tool_call.arguments|items %}
|
| 97 |
+
{{- '<parameter=' + args_name + '>\n' }}
|
| 98 |
+
{%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}
|
| 99 |
+
{{- args_value }}
|
| 100 |
+
{{- '\n</parameter>\n' }}
|
| 101 |
+
{%- endfor %}
|
| 102 |
+
{%- endif %}
|
| 103 |
+
{{- '</function>\n</tool_call>' }}
|
| 104 |
+
{%- endfor %}
|
| 105 |
+
{%- endif %}
|
| 106 |
+
{{- '<|im_end|>\n' }}
|
| 107 |
+
{%- elif message.role == "tool" %}
|
| 108 |
+
{%- if loop.previtem and loop.previtem.role != "tool" %}
|
| 109 |
+
{{- '<|im_start|>user' }}
|
| 110 |
+
{%- endif %}
|
| 111 |
+
{{- '\n<tool_response>\n' }}
|
| 112 |
+
{{- content }}
|
| 113 |
+
{{- '\n</tool_response>' }}
|
| 114 |
+
{%- if not loop.last and loop.nextitem.role != "tool" %}
|
| 115 |
+
{{- '<|im_end|>\n' }}
|
| 116 |
+
{%- elif loop.last %}
|
| 117 |
+
{{- '<|im_end|>\n' }}
|
| 118 |
+
{%- endif %}
|
| 119 |
+
{%- else %}
|
| 120 |
+
{{- raise_exception('Unexpected message role.') }}
|
| 121 |
+
{%- endif %}
|
| 122 |
+
{%- endfor %}
|
| 123 |
+
{%- if add_generation_prompt %}
|
| 124 |
+
{{- '<|im_start|>assistant\n' }}
|
| 125 |
+
{#- 2026-11-09: thinking is OFF by default (Qwen3.8-style). Turn it on with enable_thinking=true or reasoning_effort
|
| 126 |
+
low/medium/high. "Model decides" (no think block forced) made the 53M think on every prompt and skip tools. #}
|
| 127 |
+
{%- if (enable_thinking is defined and enable_thinking is true) or (effort and effort != 'none') %}
|
| 128 |
+
{{- '<think>\n' }}
|
| 129 |
+
{%- else %}
|
| 130 |
+
{{- '<think>\n\n</think>\n\n' }}
|
| 131 |
+
{%- endif %}
|
| 132 |
+
{%- endif %}
|
config.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Lfm2MoeForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"model_type": "lfm2_moe",
|
| 6 |
+
"vocab_size": 49152,
|
| 7 |
+
"hidden_size": 320,
|
| 8 |
+
"num_hidden_layers": 12,
|
| 9 |
+
"layer_types": [
|
| 10 |
+
"conv",
|
| 11 |
+
"conv",
|
| 12 |
+
"full_attention",
|
| 13 |
+
"conv",
|
| 14 |
+
"conv",
|
| 15 |
+
"full_attention",
|
| 16 |
+
"conv",
|
| 17 |
+
"conv",
|
| 18 |
+
"full_attention",
|
| 19 |
+
"conv",
|
| 20 |
+
"conv",
|
| 21 |
+
"full_attention"
|
| 22 |
+
],
|
| 23 |
+
"num_attention_heads": 5,
|
| 24 |
+
"num_key_value_heads": 1,
|
| 25 |
+
"conv_L_cache": 7,
|
| 26 |
+
"conv_bias": false,
|
| 27 |
+
"num_dense_layers": 1,
|
| 28 |
+
"intermediate_size": 896,
|
| 29 |
+
"moe_intermediate_size": 96,
|
| 30 |
+
"num_experts": 32,
|
| 31 |
+
"num_experts_per_tok": 4,
|
| 32 |
+
"norm_topk_prob": true,
|
| 33 |
+
"routed_scaling_factor": 1.0,
|
| 34 |
+
"use_expert_bias": true,
|
| 35 |
+
"norm_eps": 1e-05,
|
| 36 |
+
"rope_theta": 1000000.0,
|
| 37 |
+
"max_position_embeddings": 2048,
|
| 38 |
+
"tie_word_embeddings": true,
|
| 39 |
+
"torch_dtype": "float32",
|
| 40 |
+
"use_cache": true,
|
| 41 |
+
"bos_token_id": null,
|
| 42 |
+
"eos_token_id": 2,
|
| 43 |
+
"pad_token_id": 0
|
| 44 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"eos_token_id": [2, 0],
|
| 3 |
+
"pad_token_id": 0,
|
| 4 |
+
"do_sample": true,
|
| 5 |
+
"temperature": 0.4,
|
| 6 |
+
"top_p": 0.9,
|
| 7 |
+
"repetition_penalty": 1.1,
|
| 8 |
+
"max_new_tokens": 512
|
| 9 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:40e2f9973a7484439efa4ce03f9e9a8442f6ddc4e7fd2dacfbf52a1b503d28a1
|
| 3 |
+
size 213851384
|
sample_chats.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Sample conversations
|
| 2 |
+
|
| 3 |
+
Unedited. llama.cpp (`llama-server --jinja`) on the F16 GGUF, temperature 0.4, top-p 0.9, repetition penalty 1.1, one fixed seed per conversation. Thinking off for chat, knowledge, writing and tools; on for the math (the recommended use). Thinking appears as `reasoning_content` (llama.cpp splits it out of the reply); tool calls are parsed by llama.cpp into `tool_calls`, and a canned tool result is sent back.
|
| 4 |
+
|
| 5 |
+
## Casual chat
|
| 6 |
+
|
| 7 |
+
**User:** hey! how's it going?
|
| 8 |
+
|
| 9 |
+
**TinyBrainBot:** I'm doing well, thanks for asking. How about you?
|
| 10 |
+
|
| 11 |
+
## Casual chat
|
| 12 |
+
|
| 13 |
+
**User:** i just got a new puppy, any tips for the first week?
|
| 14 |
+
|
| 15 |
+
**TinyBrainBot:** Start with a gentle chew and a gentle lick. Do some quick dog training to boost your endurance.
|
| 16 |
+
|
| 17 |
+
## Knowledge
|
| 18 |
+
|
| 19 |
+
**User:** Why is the sky blue?
|
| 20 |
+
|
| 21 |
+
**TinyBrainBot:** The sky is blue because sunlight scatters in Earth's atmosphere, and blue light is scattered away.
|
| 22 |
+
|
| 23 |
+
## Knowledge
|
| 24 |
+
|
| 25 |
+
**User:** What is photosynthesis? Keep it short.
|
| 26 |
+
|
| 27 |
+
**TinyBrainBot:** Photosynthesis is the process by which plants use sunlight, water, and carbon dioxide to make their own food. It happens in the leaves of green plants, where they absorb light and turn it into sugar.
|
| 28 |
+
|
| 29 |
+
## Explain
|
| 30 |
+
|
| 31 |
+
**User:** Explain what a volcano is to a 10 year old.
|
| 32 |
+
|
| 33 |
+
**TinyBrainBot:** A volcano is a massive, cone-shaped mountain that forms from the gradual cooling of magma beneath Earth's surface. It is formed when the weight of all the rock above melts and then the melted rock rises through cracks to form a volcano. The name comes from the Latin word for "tall" or "sweet."
|
| 34 |
+
|
| 35 |
+
## Writing
|
| 36 |
+
|
| 37 |
+
**User:** Write a two-sentence story about a robot who learns to paint.
|
| 38 |
+
|
| 39 |
+
**TinyBrainBot:** In the bustling city of Boulder, Colorado, a little boy named Max was playing in his favorite park when he noticed something unusual - a shiny, colorful piece of paper with a tiny ink leaf on it! He wanted to know what it meant.
|
| 40 |
+
|
| 41 |
+
Max asked his friend, Mr. Johnson, who knew a lot about science. "Mr. Johnson," he said excitedly, "this paper is indeed a stamp! It's like a giant treasure chest filled with unique letters and symbols."
|
| 42 |
+
|
| 43 |
+
Max nodded eagerly, curious as to what he might learn. He turned to his friend and asked, "But how does it work?" Mr. Johnson smiled and explained, "It's a paper that has been stamped into something called a "print." It looks like this is a stamp, but it's actually made of tiny ink particles."
|
| 44 |
+
|
| 45 |
+
Max was amazed by the idea. He wanted to know more about it, so he decided to ask his neighbor, Mr. Johnson, who knew a lot about science.
|
| 46 |
+
|
| 47 |
+
Mr. Johnson said, "That's right! You see, when you press your finger into paper, it creates a tiny ink particle. That's what we call a stamp."
|
| 48 |
+
|
| 49 |
+
Max then wondered aloud, "But why does the ink stick to the paper?" Mr. Johnson replied, "Well, sometimes things don't always go as planned or do. Sometimes, they might even get stuck somewhere."
|
| 50 |
+
|
| 51 |
+
Max nodded eagerly, realizing that learning never stops. He learned that sometimes things don't always turn
|
| 52 |
+
|
| 53 |
+
## Thinking on
|
| 54 |
+
|
| 55 |
+
**User:** A shop sells pens for $2 each. How much do 6 pens cost?
|
| 56 |
+
|
| 57 |
+
*thinking:* "each is priced at" means multiplication. So multiply 6 * 2. Multiplying. Break 2 into digits. 6 x 2 = 12. So the answer is 12.
|
| 58 |
+
|
| 59 |
+
**TinyBrainBot:** The answer is $12.
|
| 60 |
+
|
| 61 |
+
## Reasoning effort: low
|
| 62 |
+
|
| 63 |
+
**User:** What is 12 + 9?
|
| 64 |
+
|
| 65 |
+
*thinking:* The expression 12 + 9 is incorrect because it represents the same number as 6, so we can rewrite it as 12 plus 9. We can rewrite 12 as 13 and 9 as 14.
|
| 66 |
+
|
| 67 |
+
**TinyBrainBot:** Adding 13 and 9 gives 22 as the simplified result.
|
| 68 |
+
|
| 69 |
+
## Thinking on
|
| 70 |
+
|
| 71 |
+
**User:** If I have 4 boxes with 3 books each, how many books do I have?
|
| 72 |
+
|
| 73 |
+
*thinking:* "each is" means multiplication. So multiply 4 * 3. Multiplying. Break 3 into digits. 4 x 3 = 12. So the answer is 12.
|
| 74 |
+
|
| 75 |
+
**TinyBrainBot:** The answer is 12.
|
| 76 |
+
|
| 77 |
+
## Tool: web search (with result)
|
| 78 |
+
|
| 79 |
+
**User:** What's the weather in Boise right now?
|
| 80 |
+
|
| 81 |
+
**Tool call:** `web_search({"query":"Boise"})`
|
| 82 |
+
|
| 83 |
+
*tool result:* `{"results": [{"title": "Boise, ID weather", "snippet": "Today: 48F, light rain, wind NW 9 mph. Tonight: 36F."}]}`
|
| 84 |
+
|
| 85 |
+
**TinyBrainBot:** The weather in Boise is extremely humid. It's very rainy and wind NW 9 mph.
|
| 86 |
+
|
| 87 |
+
## Tool: read a file (with result)
|
| 88 |
+
|
| 89 |
+
**User:** Can you read list.txt and tell me what's on it?
|
| 90 |
+
|
| 91 |
+
**Tool call:** `web_search({"query":"text"})`; `read_file({"path":"{\"title\": \"The Best Book Ever\", \"name\": \"Johnny\""})`
|
| 92 |
+
|
| 93 |
+
*tool result:* `{"results": [{"title": "Boise, ID weather", "snippet": "Today: 48F, light rain, wind NW 9 mph. Tonight: 36F."}]}`
|
| 94 |
+
|
| 95 |
+
*tool result:* `Shopping list: | - eggs | - milk | - bread | - apples`
|
| 96 |
+
|
| 97 |
+
**TinyBrainBot:** The list of the top results in the list is "Boise, ID weather", "Snippet: Today: 48F, light rain, wind NW 9 mph".
|
| 98 |
+
|
| 99 |
+
## Tools available, not needed
|
| 100 |
+
|
| 101 |
+
**User:** thanks, you've been helpful!
|
| 102 |
+
|
| 103 |
+
**TinyBrainBot:** You're welcome! If you have any other questions or need further assistance, feel free to ask.
|
| 104 |
+
|
| 105 |
+
## Multi-turn
|
| 106 |
+
|
| 107 |
+
**User:** My name is Sam.
|
| 108 |
+
|
| 109 |
+
**TinyBrainBot:** You told me the name is Sam.
|
| 110 |
+
|
| 111 |
+
**User:** What's my name?
|
| 112 |
+
|
| 113 |
+
**TinyBrainBot:** Your name is Sam.
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"tokenizer_class": "PreTrainedTokenizerFast",
|
| 3 |
+
"model_max_length": 16384,
|
| 4 |
+
"bos_token": null,
|
| 5 |
+
"eos_token": "<|im_end|>",
|
| 6 |
+
"pad_token": "<|endoftext|>",
|
| 7 |
+
"unk_token": null,
|
| 8 |
+
"add_bos_token": false,
|
| 9 |
+
"add_eos_token": false,
|
| 10 |
+
"clean_up_tokenization_spaces": false,
|
| 11 |
+
"added_tokens_decoder": {
|
| 12 |
+
"0": {
|
| 13 |
+
"content": "<|endoftext|>",
|
| 14 |
+
"lstrip": false,
|
| 15 |
+
"rstrip": false,
|
| 16 |
+
"normalized": false,
|
| 17 |
+
"single_word": false,
|
| 18 |
+
"special": true
|
| 19 |
+
},
|
| 20 |
+
"1": {
|
| 21 |
+
"content": "<|im_start|>",
|
| 22 |
+
"lstrip": false,
|
| 23 |
+
"rstrip": false,
|
| 24 |
+
"normalized": false,
|
| 25 |
+
"single_word": false,
|
| 26 |
+
"special": true
|
| 27 |
+
},
|
| 28 |
+
"2": {
|
| 29 |
+
"content": "<|im_end|>",
|
| 30 |
+
"lstrip": false,
|
| 31 |
+
"rstrip": false,
|
| 32 |
+
"normalized": false,
|
| 33 |
+
"single_word": false,
|
| 34 |
+
"special": true
|
| 35 |
+
},
|
| 36 |
+
"3": {
|
| 37 |
+
"content": "<think>",
|
| 38 |
+
"lstrip": false,
|
| 39 |
+
"rstrip": false,
|
| 40 |
+
"normalized": false,
|
| 41 |
+
"single_word": false,
|
| 42 |
+
"special": false
|
| 43 |
+
},
|
| 44 |
+
"4": {
|
| 45 |
+
"content": "</think>",
|
| 46 |
+
"lstrip": false,
|
| 47 |
+
"rstrip": false,
|
| 48 |
+
"normalized": false,
|
| 49 |
+
"single_word": false,
|
| 50 |
+
"special": false
|
| 51 |
+
},
|
| 52 |
+
"5": {
|
| 53 |
+
"content": "<tool_call>",
|
| 54 |
+
"lstrip": false,
|
| 55 |
+
"rstrip": false,
|
| 56 |
+
"normalized": false,
|
| 57 |
+
"single_word": false,
|
| 58 |
+
"special": false
|
| 59 |
+
},
|
| 60 |
+
"6": {
|
| 61 |
+
"content": "</tool_call>",
|
| 62 |
+
"lstrip": false,
|
| 63 |
+
"rstrip": false,
|
| 64 |
+
"normalized": false,
|
| 65 |
+
"single_word": false,
|
| 66 |
+
"special": false
|
| 67 |
+
},
|
| 68 |
+
"7": {
|
| 69 |
+
"content": "<tool_response>",
|
| 70 |
+
"lstrip": false,
|
| 71 |
+
"rstrip": false,
|
| 72 |
+
"normalized": false,
|
| 73 |
+
"single_word": false,
|
| 74 |
+
"special": false
|
| 75 |
+
},
|
| 76 |
+
"8": {
|
| 77 |
+
"content": "</tool_response>",
|
| 78 |
+
"lstrip": false,
|
| 79 |
+
"rstrip": false,
|
| 80 |
+
"normalized": false,
|
| 81 |
+
"single_word": false,
|
| 82 |
+
"special": false
|
| 83 |
+
},
|
| 84 |
+
"9": {
|
| 85 |
+
"content": "<|fim_prefix|>",
|
| 86 |
+
"lstrip": false,
|
| 87 |
+
"rstrip": false,
|
| 88 |
+
"normalized": false,
|
| 89 |
+
"single_word": false,
|
| 90 |
+
"special": true
|
| 91 |
+
},
|
| 92 |
+
"10": {
|
| 93 |
+
"content": "<|fim_middle|>",
|
| 94 |
+
"lstrip": false,
|
| 95 |
+
"rstrip": false,
|
| 96 |
+
"normalized": false,
|
| 97 |
+
"single_word": false,
|
| 98 |
+
"special": true
|
| 99 |
+
},
|
| 100 |
+
"11": {
|
| 101 |
+
"content": "<|fim_suffix|>",
|
| 102 |
+
"lstrip": false,
|
| 103 |
+
"rstrip": false,
|
| 104 |
+
"normalized": false,
|
| 105 |
+
"single_word": false,
|
| 106 |
+
"special": true
|
| 107 |
+
},
|
| 108 |
+
"12": {
|
| 109 |
+
"content": "<|file_sep|>",
|
| 110 |
+
"lstrip": false,
|
| 111 |
+
"rstrip": false,
|
| 112 |
+
"normalized": false,
|
| 113 |
+
"single_word": false,
|
| 114 |
+
"special": true
|
| 115 |
+
},
|
| 116 |
+
"13": {
|
| 117 |
+
"content": "<|repo_name|>",
|
| 118 |
+
"lstrip": false,
|
| 119 |
+
"rstrip": false,
|
| 120 |
+
"normalized": false,
|
| 121 |
+
"single_word": false,
|
| 122 |
+
"special": true
|
| 123 |
+
},
|
| 124 |
+
"14": {
|
| 125 |
+
"content": "<|reserved_0|>",
|
| 126 |
+
"lstrip": false,
|
| 127 |
+
"rstrip": false,
|
| 128 |
+
"normalized": false,
|
| 129 |
+
"single_word": false,
|
| 130 |
+
"special": true
|
| 131 |
+
},
|
| 132 |
+
"15": {
|
| 133 |
+
"content": "<|reserved_1|>",
|
| 134 |
+
"lstrip": false,
|
| 135 |
+
"rstrip": false,
|
| 136 |
+
"normalized": false,
|
| 137 |
+
"single_word": false,
|
| 138 |
+
"special": true
|
| 139 |
+
},
|
| 140 |
+
"16": {
|
| 141 |
+
"content": "<|reserved_2|>",
|
| 142 |
+
"lstrip": false,
|
| 143 |
+
"rstrip": false,
|
| 144 |
+
"normalized": false,
|
| 145 |
+
"single_word": false,
|
| 146 |
+
"special": true
|
| 147 |
+
},
|
| 148 |
+
"17": {
|
| 149 |
+
"content": "<|reserved_3|>",
|
| 150 |
+
"lstrip": false,
|
| 151 |
+
"rstrip": false,
|
| 152 |
+
"normalized": false,
|
| 153 |
+
"single_word": false,
|
| 154 |
+
"special": true
|
| 155 |
+
},
|
| 156 |
+
"18": {
|
| 157 |
+
"content": "<|reserved_4|>",
|
| 158 |
+
"lstrip": false,
|
| 159 |
+
"rstrip": false,
|
| 160 |
+
"normalized": false,
|
| 161 |
+
"single_word": false,
|
| 162 |
+
"special": true
|
| 163 |
+
},
|
| 164 |
+
"19": {
|
| 165 |
+
"content": "<|reserved_5|>",
|
| 166 |
+
"lstrip": false,
|
| 167 |
+
"rstrip": false,
|
| 168 |
+
"normalized": false,
|
| 169 |
+
"single_word": false,
|
| 170 |
+
"special": true
|
| 171 |
+
},
|
| 172 |
+
"20": {
|
| 173 |
+
"content": "<|reserved_6|>",
|
| 174 |
+
"lstrip": false,
|
| 175 |
+
"rstrip": false,
|
| 176 |
+
"normalized": false,
|
| 177 |
+
"single_word": false,
|
| 178 |
+
"special": true
|
| 179 |
+
},
|
| 180 |
+
"21": {
|
| 181 |
+
"content": "<|reserved_7|>",
|
| 182 |
+
"lstrip": false,
|
| 183 |
+
"rstrip": false,
|
| 184 |
+
"normalized": false,
|
| 185 |
+
"single_word": false,
|
| 186 |
+
"special": true
|
| 187 |
+
},
|
| 188 |
+
"22": {
|
| 189 |
+
"content": "<|reserved_8|>",
|
| 190 |
+
"lstrip": false,
|
| 191 |
+
"rstrip": false,
|
| 192 |
+
"normalized": false,
|
| 193 |
+
"single_word": false,
|
| 194 |
+
"special": true
|
| 195 |
+
},
|
| 196 |
+
"23": {
|
| 197 |
+
"content": "<|reserved_9|>",
|
| 198 |
+
"lstrip": false,
|
| 199 |
+
"rstrip": false,
|
| 200 |
+
"normalized": false,
|
| 201 |
+
"single_word": false,
|
| 202 |
+
"special": true
|
| 203 |
+
},
|
| 204 |
+
"24": {
|
| 205 |
+
"content": "<|reserved_10|>",
|
| 206 |
+
"lstrip": false,
|
| 207 |
+
"rstrip": false,
|
| 208 |
+
"normalized": false,
|
| 209 |
+
"single_word": false,
|
| 210 |
+
"special": true
|
| 211 |
+
},
|
| 212 |
+
"25": {
|
| 213 |
+
"content": "<|reserved_11|>",
|
| 214 |
+
"lstrip": false,
|
| 215 |
+
"rstrip": false,
|
| 216 |
+
"normalized": false,
|
| 217 |
+
"single_word": false,
|
| 218 |
+
"special": true
|
| 219 |
+
},
|
| 220 |
+
"26": {
|
| 221 |
+
"content": "<|reserved_12|>",
|
| 222 |
+
"lstrip": false,
|
| 223 |
+
"rstrip": false,
|
| 224 |
+
"normalized": false,
|
| 225 |
+
"single_word": false,
|
| 226 |
+
"special": true
|
| 227 |
+
},
|
| 228 |
+
"27": {
|
| 229 |
+
"content": "<|reserved_13|>",
|
| 230 |
+
"lstrip": false,
|
| 231 |
+
"rstrip": false,
|
| 232 |
+
"normalized": false,
|
| 233 |
+
"single_word": false,
|
| 234 |
+
"special": true
|
| 235 |
+
},
|
| 236 |
+
"28": {
|
| 237 |
+
"content": "<|reserved_14|>",
|
| 238 |
+
"lstrip": false,
|
| 239 |
+
"rstrip": false,
|
| 240 |
+
"normalized": false,
|
| 241 |
+
"single_word": false,
|
| 242 |
+
"special": true
|
| 243 |
+
},
|
| 244 |
+
"29": {
|
| 245 |
+
"content": "<|reserved_15|>",
|
| 246 |
+
"lstrip": false,
|
| 247 |
+
"rstrip": false,
|
| 248 |
+
"normalized": false,
|
| 249 |
+
"single_word": false,
|
| 250 |
+
"special": true
|
| 251 |
+
},
|
| 252 |
+
"30": {
|
| 253 |
+
"content": "<|reserved_16|>",
|
| 254 |
+
"lstrip": false,
|
| 255 |
+
"rstrip": false,
|
| 256 |
+
"normalized": false,
|
| 257 |
+
"single_word": false,
|
| 258 |
+
"special": true
|
| 259 |
+
},
|
| 260 |
+
"31": {
|
| 261 |
+
"content": "<|reserved_17|>",
|
| 262 |
+
"lstrip": false,
|
| 263 |
+
"rstrip": false,
|
| 264 |
+
"normalized": false,
|
| 265 |
+
"single_word": false,
|
| 266 |
+
"special": true
|
| 267 |
+
}
|
| 268 |
+
},
|
| 269 |
+
"chat_template": "{#- TinyBrainBot hybrid chat template (2026-11): Qwen3.8 structure (ChatML, XML tool calls, <tool_response>, hybrid <think>)\n plus reasoning_effort. enable_thinking=false -> empty think block; enable_thinking=true -> opens <think>; unset -> the\n model decides. reasoning_effort (low | medium | high) is stated in the system turn; \"none\" = no thinking. -#}\n{%- macro render_content(content) %}\n {%- if content is string %}\n {{- content }}\n {%- elif content is iterable and content is not mapping %}\n {%- for item in content %}\n {%- if 'text' in item %}\n {{- item.text }}\n {%- endif %}\n {%- endfor %}\n {%- elif content is none or content is undefined %}\n {{- '' }}\n {%- endif %}\n{%- endmacro %}\n{%- if not messages %}\n {{- raise_exception('No messages provided.') }}\n{%- endif %}\n{%- set effort = reasoning_effort if reasoning_effort is defined and reasoning_effort in ['none', 'low', 'medium', 'high'] else none %}\n{%- set effort_line = ('Reasoning effort: ' ~ effort) if effort and effort != 'none' else '' %}\n{%- set sys_content = render_content(messages[0].content)|trim if messages[0].role == 'system' else '' %}\n{%- if tools and tools is iterable and tools is not mapping %}\n {{- '<|im_start|>system\\n' }}\n {{- \"# Tools\\n\\nYou have access to the following functions:\\n\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\" }}\n {{- '\\n\\nIf you choose to call a function ONLY reply in the following format with NO suffix:\\n\\n<tool_call>\\n<function=example_function_name>\\n<parameter=example_parameter_1>\\nvalue_1\\n</parameter>\\n<parameter=example_parameter_2>\\nThis is the value for the second parameter\\nthat can span\\nmultiple lines\\n</parameter>\\n</function>\\n</tool_call>\\n\\n<IMPORTANT>\\nReminder:\\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\\n- Required parameters MUST be specified\\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\\n</IMPORTANT>' }}\n {%- if sys_content %}\n {{- '\\n\\n' + sys_content }}\n {%- endif %}\n {%- if effort_line %}\n {{- '\\n\\n' + effort_line }}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n{%- elif sys_content or effort_line %}\n {{- '<|im_start|>system\\n' + sys_content }}\n {%- if effort_line %}\n {{- ('\\n\\n' if sys_content else '') + effort_line }}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n{%- endif %}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}\n{%- for message in messages[::-1] %}\n {%- set index = (messages|length - 1) - loop.index0 %}\n {%- if ns.multi_step_tool and message.role == \"user\" %}\n {%- set content = render_content(message.content)|trim %}\n {%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}\n {%- set ns.multi_step_tool = false %}\n {%- set ns.last_query_index = index %}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- for message in messages %}\n {%- set content = render_content(message.content)|trim %}\n {%- if message.role == \"system\" %}\n {%- if not loop.first %}\n {{- raise_exception('System message must be at the beginning.') }}\n {%- endif %}\n {%- elif message.role == \"user\" %}\n {{- '<|im_start|>' + message.role + '\\n' + content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {%- set reasoning_content = '' %}\n {%- if message.reasoning_content is string %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- else %}\n {%- if '</think>' in content %}\n {%- set reasoning_content = content.split('</think>')[0].rstrip('\\n').split('<think>')[-1].lstrip('\\n') %}\n {%- set content = content.split('</think>')[-1].lstrip('\\n') %}\n {%- endif %}\n {%- endif %}\n {%- set reasoning_content = reasoning_content|trim %}\n {%- if loop.index0 > ns.last_query_index %}\n {{- '<|im_start|>' + message.role + '\\n<think>\\n' + reasoning_content + '\\n</think>\\n\\n' + content }}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}\n {%- for tool_call in message.tool_calls %}\n {%- if tool_call.function is defined %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {%- if loop.first %}\n {%- if content|trim %}\n {{- '\\n\\n<tool_call>\\n<function=' + tool_call.name + '>\\n' }}\n {%- else %}\n {{- '<tool_call>\\n<function=' + tool_call.name + '>\\n' }}\n {%- endif %}\n {%- else %}\n {{- '\\n<tool_call>\\n<function=' + tool_call.name + '>\\n' }}\n {%- endif %}\n {%- if tool_call.arguments is defined %}\n {%- for args_name, args_value in tool_call.arguments|items %}\n {{- '<parameter=' + args_name + '>\\n' }}\n {%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}\n {{- args_value }}\n {{- '\\n</parameter>\\n' }}\n {%- endfor %}\n {%- endif %}\n {{- '</function>\\n</tool_call>' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.previtem and loop.previtem.role != \"tool\" %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- content }}\n {{- '\\n</tool_response>' }}\n {%- if not loop.last and loop.nextitem.role != \"tool\" %}\n {{- '<|im_end|>\\n' }}\n {%- elif loop.last %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- else %}\n {{- raise_exception('Unexpected message role.') }}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n {#- 2026-11-09: thinking is OFF by default (Qwen3.8-style). Turn it on with enable_thinking=true or reasoning_effort\n low/medium/high. \"Model decides\" (no think block forced) made the 53M think on every prompt and skip tools. #}\n {%- if (enable_thinking is defined and enable_thinking is true) or (effort and effort != 'none') %}\n {{- '<think>\\n' }}\n {%- else %}\n {{- '<think>\\n\\n</think>\\n\\n' }}\n {%- endif %}\n{%- endif %}\n"
|
| 270 |
+
}
|