Skip to content

The platform for continuously improving AI agents.

Add Ornith, Fara, and Bolt E4B to the training catalog (#333)

Rohit Gupta9ad7df67f0ae
diff --git a/frontend/src/components/model-provider.ts b/frontend/src/components/model-provider.ts
index 356825f0..818947b7 100644
--- a/frontend/src/components/model-provider.ts
+++ b/frontend/src/components/model-provider.ts
@@ -153,6 +153,7 @@ const PROVIDER_ALIASES: Record<string, Exclude<ProviderId, "unknown">> = {
moonshot: "kimi",
moonshotai: "kimi",
nousresearch: "nous",
+ ornithai: "qwen",
palm: "google",
seed: "bytedance",
zai: "zhipu",
diff --git a/modal_shared/modelfam/families.py b/modal_shared/modelfam/families.py
index 2a4ba463..28129d3c 100644
--- a/modal_shared/modelfam/families.py
+++ b/modal_shared/modelfam/families.py
@@ -168,6 +168,18 @@ ANTARES = FamilySpec(
hooks_module="families.antares",
)
+# Before NEMOTRON35: "nemotron-3.5" would send Bolt through the Nemotron-H hooks.
+BOLT = FamilySpec(
+ key="bolt",
+ patterns=("nemotron-3.5-bolt",),
+ train_image=TRAIN_U2026_8_TF510,
+ tool_call_parser="gemma4",
+ pretok_headers=(r"<\|turn>(\w+)\n",),
+ force_mask_pairs=(("<|tool_response>", "<tool_response|>"),),
+ notes="Gemma 4 E4B finetune. FastModel, SDPA, checkpointing off.",
+ hooks_module="families.bolt",
+)
+
# Before generic NEMOTRON — "nemotron-3.5" would otherwise inherit SPECIAL_N pretok.
NEMOTRON35 = FamilySpec(
key="nemotron35",
@@ -226,14 +238,14 @@ QWEN38 = FamilySpec(
QWEN35 = FamilySpec(
key="qwen35",
- patterns=("qwen3.5", "qwen3.6"),
+ patterns=("qwen3.5", "qwen3.6", "ornith", "fara"),
train_image=TRAIN_U2026_10_7,
tool_call_parser="qwen3_coder",
pretok_headers=(r"<\|im_start\|>(\w+)\n",),
natively_multimodal=True,
multimodal_id_tokens=("qwen3-5", "qwen3-6"),
config_fixups=("nest_qwen3_5_text",),
- notes="Qwen3.5/3.6 XML tool calls; natively multimodal — wrap content as text parts.",
+ notes="Qwen3.5/3.6 and their Ornith and Fara finetunes. XML tool calls; natively multimodal.",
hooks_module="families.qwen35",
)
diff --git a/modal_shared/modelfam/registry.py b/modal_shared/modelfam/registry.py
index 95b2caf7..fd1dc923 100644
--- a/modal_shared/modelfam/registry.py
+++ b/modal_shared/modelfam/registry.py
@@ -6,6 +6,7 @@ from __future__ import annotations
from modal_shared.modelfam.families import (
ANTARES,
+ BOLT,
CLEF,
D1,
D3,
@@ -43,6 +44,7 @@ _FAMILIES: tuple[FamilySpec, ...] = (
LFM2,
MINISTRAL,
ANTARES,
+ BOLT,
NEMOTRON35,
NEMOTRON,
LLAMA,
diff --git a/overbae/modal/models.json b/overbae/modal/models.json
index 833e840f..9cbd74ff 100644
--- a/overbae/modal/models.json
+++ b/overbae/modal/models.json
@@ -10,13 +10,15 @@
"google": "Google",
"nvidia": "NVIDIA",
"liquidai": "Liquid AI",
+ "microsoft": "Microsoft",
+ "ornith-ai": "Ornith",
"deepseek": "DeepSeek",
"x-ai": "xAI",
"anthropic": "Anthropic"
}
},
"models": [
- {
+{
"id": "Qwen/Qwen3.5-2B",
"openrouter_id": null,
"backend": "together",
@@ -71,7 +73,7 @@
"tool-calling"
]
},
- {
+{
"id": "Qwen/Qwen3.5-0.8B",
"openrouter_id": null,
"backend": "together",
@@ -126,7 +128,7 @@
"tool-calling"
]
},
- {
+{
"id": "Qwen/Qwen3-4B",
"openrouter_id": null,
"backend": "together",
@@ -181,7 +183,7 @@
"tool-calling"
]
},
- {
+{
"id": "Qwen/Qwen3-1.7B",
"openrouter_id": null,
"backend": "together",
@@ -236,7 +238,7 @@
"tool-calling"
]
},
- {
+{
"id": "meta-llama/Llama-3.2-3B-Instruct",
"openrouter_id": "meta-llama/llama-3.2-3b-instruct",
"backend": "together",
@@ -291,7 +293,7 @@
"tool-calling"
]
},
- {
+{
"id": "meta-llama/Llama-3.2-1B-Instruct",
"openrouter_id": "meta-llama/llama-3.2-1b-instruct",
"backend": "together",
@@ -346,7 +348,7 @@
"tool-calling"
]
},
- {
+{
"id": "Qwen/Qwen3.5-9B",
"openrouter_id": "qwen/qwen3.5-9b",
"backend": "together",
@@ -401,7 +403,7 @@
"tool-calling"
]
},
- {
+{
"id": "Qwen/Qwen3-8B",
"openrouter_id": "qwen/qwen3-8b",
"backend": "together",
@@ -456,7 +458,7 @@
"tool-calling"
]
},
- {
+{
"id": "Qwen/Qwen2.5-7B-Instruct",
"openrouter_id": "qwen/qwen-2.5-7b-instruct",
"backend": "together",
@@ -511,7 +513,7 @@
"tool-calling"
]
},
- {
+{
"id": "meta-llama/Meta-Llama-3.1-8B-Instruct-Reference",
"openrouter_id": "meta-llama/llama-3.1-8b-instruct",
"backend": "together",
@@ -566,7 +568,7 @@
"tool-calling"
]
},
- {
+{
"id": "Qwen/Qwen3.5-27B",
"openrouter_id": "qwen/qwen3.5-27b",
"backend": "together",
@@ -621,7 +623,7 @@
"tool-calling"
]
},
- {
+{
"id": "Qwen/Qwen3-14B",
"openrouter_id": "qwen/qwen3-14b",
"backend": "together",
@@ -676,7 +678,7 @@
"tool-calling"
]
},
- {
+{
"id": "Qwen/Qwen3.5-35B-A3B",
"openrouter_id": "qwen/qwen3.5-35b-a3b",
"backend": "together",
@@ -731,7 +733,7 @@
"tool-calling"
]
},
- {
+{
"id": "Qwen/Qwen3.5-4B",
"openrouter_id": null,
"hf_model_id": "unsloth/Qwen3.5-4B",
@@ -794,7 +796,7 @@
"Qwen/Qwen3.5-4B"
]
},
- {
+{
"id": "Qwen/Qwen3.5-2B",
"openrouter_id": null,
"hf_model_id": "unsloth/Qwen3.5-2B",
@@ -857,7 +859,7 @@
"Qwen/Qwen3.5-2B"
]
},
- {
+{
"id": "Qwen/Qwen3.5-0.8B",
"openrouter_id": null,
"hf_model_id": "unsloth/Qwen3.5-0.8B",
@@ -920,7 +922,7 @@
"Qwen/Qwen3.5-0.8B"
]
},
- {
+{
"id": "Qwen/Qwen3-4B",
"openrouter_id": null,
"backend": "baseten",
@@ -983,7 +985,7 @@
"Qwen/Qwen3-4B"
]
},
- {
+{
"id": "Qwen/Qwen3-1.7B",
"openrouter_id": null,
"backend": "baseten",
@@ -1044,7 +1046,7 @@
"Qwen/Qwen3-1.7B"
]
},
- {
+{
"id": "Qwen/Qwen3-0.6B",
"openrouter_id": null,
"backend": "baseten",
@@ -1105,7 +1107,7 @@
"Qwen/Qwen3-0.6B"
]
},
- {
+{
"id": "Qwen/Qwen2.5-0.5B-Instruct",
"openrouter_id": null,
"backend": "baseten",
@@ -1166,7 +1168,7 @@
"Qwen/Qwen2.5-0.5B-Instruct"
]
},
- {
+{
"id": "meta-llama/Llama-3.2-3B-Instruct",
"openrouter_id": "meta-llama/llama-3.2-3b-instruct",
"backend": "baseten",
@@ -1227,7 +1229,7 @@
"meta-llama/Llama-3.2-3B-Instruct"
]
},
- {
+{
"id": "meta-llama/Llama-3.2-1B-Instruct",
"openrouter_id": "meta-llama/llama-3.2-1b-instruct",
"backend": "baseten",
@@ -1288,7 +1290,7 @@
"meta-llama/Llama-3.2-1B-Instruct"
]
},
- {
+{
"id": "LiquidAI/LFM3-1.7B",
"openrouter_id": null,
"backend": "baseten",
@@ -1351,7 +1353,7 @@
"LiquidAI/LFM3-1.7B"
]
},
- {
+{
"id": "LiquidAI/LFM2.5-2.6B",
"openrouter_id": "liquid/lfm-2.5-2.6b:free",
"backend": "baseten",
@@ -1411,7 +1413,7 @@
"tool-calling"
]
},
- {
+{
"id": "LiquidAI/LFM2.5-1.2B-Instruct",
"openrouter_id": null,
"backend": "baseten",
@@ -1474,7 +1476,7 @@
"LiquidAI/LFM2.5-1.2B-Instruct"
]
},
- {
+{
"id": "LiquidAI/LFM2.5-350M",
"openrouter_id": null,
"backend": "baseten",
@@ -1534,7 +1536,7 @@
"tool-calling"
]
},
- {
+{
"id": "LiquidAI/LFM2.5-230M",
"openrouter_id": null,
"backend": "baseten",
@@ -1597,7 +1599,7 @@
"LiquidAI/LFM2.5-230M"
]
},
- {
+{
"id": "fdtn-ai/antares-1b",
"openrouter_id": null,
"backend": "baseten",
@@ -1658,7 +1660,7 @@
"security"
]
},
- {
+{
"id": "fdtn-ai/antares-350m",
"openrouter_id": null,
"backend": "baseten",
@@ -1719,7 +1721,7 @@
"security"
]
},
- {
+{
"id": "Qwen/Qwen3.5-9B",
"openrouter_id": "qwen/qwen3.5-9b",
"hf_model_id": "unsloth/Qwen3.5-9B",
@@ -1782,7 +1784,7 @@
"Qwen/Qwen3.5-9B"
]
},
- {
+{
"id": "Qwen/Qwen3-8B",
"openrouter_id": "qwen/qwen3-8b",
"backend": "baseten",
@@ -1845,7 +1847,7 @@
"Qwen/Qwen3-8B"
]
},
- {
+{
"id": "Qwen/Qwen2.5-7B-Instruct",
"openrouter_id": "qwen/qwen-2.5-7b-instruct",
"backend": "baseten",
@@ -1908,7 +1910,70 @@
"Qwen/Qwen2.5-7B-Instruct"
]
},
- {
+{
+ "id": "ornith-ai/Ornith-1.5-9B",
+ "openrouter_id": null,
+ "hf_model_id": "ornith-ai/Ornith-1.5-9B",
+ "display": "Ornith 1.5 9B",
+ "tier": "small",
+ "params": "9B",
+ "total_params_b": 9.0,
+ "context_length": 262144,
+ "supports_tool_calling": true,
+ "type": "chat",
+ "hidden_size": 4096,
+ "fp8_supported": true,
+ "inference": {
+ "gpu_type": "L4",
+ "max_model_len": 16384
+ },
+ "finetuning": {
+ "context_length": 262144,
+ "max_batch_size": 8,
+ "min_batch_size": 1,
+ "training_type": {
+ "full": {
+ "enabled": false,
+ "context_length": 131072,
+ "validated_context_length": false
+ },
+ "lora": {
+ "enabled": true,
+ "context_length": 131072,
+ "validated_context_length": false
+ }
+ },
+ "real_max_context_length": 131072
+ },
+ "num_attn_layers": 8,
+ "num_kv_heads": 4,
+ "head_dim": 256,
+ "backend": "baseten",
+ "disabled": false,
+ "disabled_reason": null,
+ "group": "Ornith",
+ "pricing": {
+ "train_from_usd": 1.0,
+ "run_from_usd_per_1m_output": 6.0
+ },
+ "marketing": {
+ "pitch": "9B Qwen 3.5 finetune with a 256K window and tool calling.",
+ "description": "Ornith 1.5 9B is a Qwen 3.5 9B finetune. It trains with LoRA on the Qwen 3.5 stack and serves on the pinned vLLM image with thinking disabled.",
+ "overview": "Same architecture as Qwen 3.5 9B: 8 full-attention layers, 256K positions, tool calling. LoRA uses the 128K window measured on that base.",
+ "good_for": [
+ "Agents that start from the Ornith 1.5 9B checkpoint",
+ "LoRA on a 9B Qwen 3.5 architecture",
+ "Tool-calling rows"
+ ]
+ },
+ "use_cases": [
+ "tool-calling"
+ ],
+ "benchmark_hf_model_ids": [
+ "ornith-ai/Ornith-1.5-9B"
+ ]
+ },
+{
"id": "google/gemma-4-E4B-it",
"openrouter_id": null,
"backend": "baseten",
@@ -1971,7 +2036,7 @@
"coding"
]
},
- {
+{
"id": "google/gemma-4-E2B-it",
"openrouter_id": null,
"backend": "baseten",
@@ -2034,7 +2099,7 @@
"coding"
]
},
- {
+{
"id": "meta-llama/Llama-3.1-8B-Instruct",
"openrouter_id": "meta-llama/llama-3.1-8b-instruct",
"backend": "baseten",
@@ -2097,7 +2162,7 @@
"meta-llama/Llama-3.1-8B-Instruct"
]
},
- {
+{
"id": "LiquidAI/LFM2.5-8B-A1B",
"openrouter_id": null,
"backend": "baseten",
@@ -2157,7 +2222,7 @@
"tool-calling"
]
},
- {
+{
"id": "Qwen/Qwen3.8-27B",
"openrouter_id": "qwen/qwen3.8-27b",
"hf_model_id": "unsloth/Qwen3.8-27B",
@@ -2220,7 +2285,7 @@
"Qwen/Qwen3.8-27B"
]
},
- {
+{
"id": "Qwen/Qwen3.6-27B",
"openrouter_id": "qwen/qwen3.6-27b",
"hf_model_id": "unsloth/Qwen3.6-27B",
@@ -2283,7 +2348,7 @@
"Qwen/Qwen3.6-27B"
]
},
- {
+{
"id": "Qwen/Qwen3.5-27B",
"openrouter_id": "qwen/qwen3.5-27b",
"hf_model_id": "unsloth/Qwen3.5-27B",
@@ -2346,7 +2411,7 @@
"Qwen/Qwen3.5-27B"
]
},
- {
+{
"id": "Qwen/Qwen3-Coder-30B-A3B-Instruct",
"openrouter_id": "qwen/qwen3-coder-30b-a3b-instruct",
"hf_model_id": "Qwen/Qwen3-Coder-30B-A3B-Instruct",
@@ -2409,7 +2474,7 @@
"coding"
]
},
- {
+{
"id": "Qwen/Qwen3-14B",
"openrouter_id": "qwen/qwen3-14b",
"backend": "baseten",
@@ -2472,7 +2537,7 @@
"Qwen/Qwen3-14B"
]
},
- {
+{
"id": "Qwen/Qwen2.5-14B-Instruct",
"openrouter_id": null,
"backend": "baseten",
@@ -2535,7 +2600,70 @@
"Qwen/Qwen2.5-14B-Instruct"
]
},
- {
+{
+ "id": "microsoft/Fara1.5-27B",
+ "openrouter_id": null,
+ "hf_model_id": "microsoft/Fara1.5-27B",
+ "display": "Fara 1.5 27B",
+ "tier": "mid",
+ "params": "27B",
+ "total_params_b": 27.0,
+ "context_length": 262144,
+ "supports_tool_calling": true,
+ "type": "chat",
+ "hidden_size": 5120,
+ "fp8_supported": true,
+ "inference": {
+ "gpu_type": "L40S",
+ "max_model_len": 16384
+ },
+ "finetuning": {
+ "context_length": 262144,
+ "max_batch_size": 4,
+ "min_batch_size": 1,
+ "training_type": {
+ "full": {
+ "enabled": false,
+ "context_length": 262144,
+ "validated_context_length": false
+ },
+ "lora": {
+ "enabled": true,
+ "context_length": 262144,
+ "validated_context_length": false
+ }
+ },
+ "real_max_context_length": 262144
+ },
+ "num_attn_layers": 16,
+ "num_kv_heads": 4,
+ "head_dim": 256,
+ "backend": "baseten",
+ "disabled": false,
+ "disabled_reason": null,
+ "group": "Fara",
+ "pricing": {
+ "train_from_usd": 2.0,
+ "run_from_usd_per_1m_output": 15.0
+ },
+ "marketing": {
+ "pitch": "27B Qwen 3.5 finetune with a 256K window and tool calling.",
+ "description": "Fara 1.5 27B is a Qwen 3.5 27B finetune. Its chat template takes the training path, and a 2-step LoRA completed on the Qwen 3.5 Unsloth image.",
+ "overview": "Same architecture as Qwen 3.5 27B: 16 full-attention layers, 256K positions, tool calling. LoRA uses that full window.",
+ "good_for": [
+ "Agents that start from the Fara 1.5 checkpoint",
+ "LoRA on a 27B Qwen 3.5 architecture",
+ "Tool-calling rows"
+ ]
+ },
+ "use_cases": [
+ "tool-calling"
+ ],
+ "benchmark_hf_model_ids": [
+ "microsoft/Fara1.5-27B"
+ ]
+ },
+{
"id": "google/gemma-4-12B-it",
"openrouter_id": null,
"backend": "baseten",
@@ -2597,7 +2725,7 @@
"coding"
]
},
- {
+{
"id": "openai/gpt-oss-20b",
"openrouter_id": "openai/gpt-oss-20b",
"hf_model_id": "unsloth/gpt-oss-20b-BF16",
@@ -2662,7 +2790,7 @@
"openai/gpt-oss-20b"
]
},
- {
+{
"id": "Qwen/Qwen3.5-35B-A3B",
"openrouter_id": "qwen/qwen3.5-35b-a3b",
"hf_model_id": "unsloth/Qwen3.5-35B-A3B",
@@ -2725,7 +2853,7 @@
"Qwen/Qwen3.5-35B-A3B"
]
},
- {
+{
"id": "Qwen/Qwen3-32B",
"openrouter_id": "qwen/qwen3-32b",
"backend": "baseten",
@@ -2788,7 +2916,7 @@
"Qwen/Qwen3-32B"
]
},
- {
+{
"id": "Qwen/Qwen2.5-72B-Instruct",
"openrouter_id": "qwen/qwen-2.5-72b-instruct",
"backend": "baseten",
@@ -2849,7 +2977,7 @@
"Qwen/Qwen2.5-72B-Instruct"
]
},
- {
+{
"id": "Qwen/Qwen2.5-32B-Instruct",
"openrouter_id": null,
"backend": "baseten",
@@ -2912,7 +3040,7 @@
"Qwen/Qwen2.5-32B-Instruct"
]
},
- {
+{
"id": "Qwen/Qwen2.5-Coder-32B-Instruct",
"openrouter_id": "qwen/qwen-2.5-coder-32b-instruct",
"backend": "baseten",
@@ -2976,7 +3104,72 @@
"Qwen/Qwen2.5-Coder-32B-Instruct"
]
},
- {
+{
+ "id": "ornith-ai/Ornith-1.5-35B-A3B",
+ "openrouter_id": null,
+ "hf_model_id": "ornith-ai/Ornith-1.5-35B-A3B",
+ "display": "Ornith 1.5 35B MoE",
+ "tier": "large",
+ "params": "35B MoE (3B active)",
+ "total_params_b": 35.0,
+ "moe": true,
+ "context_length": 262144,
+ "supports_tool_calling": true,
+ "type": "chat",
+ "hidden_size": 2048,
+ "fp8_supported": true,
+ "inference": {
+ "gpu_type": "H100",
+ "lora_supported": true,
+ "max_model_len": 16384
+ },
+ "finetuning": {
+ "context_length": 262144,
+ "max_batch_size": 2,
+ "min_batch_size": 1,
+ "training_type": {
+ "full": {
+ "enabled": false,
+ "context_length": 262144,
+ "validated_context_length": false
+ },
+ "lora": {
+ "enabled": true,
+ "context_length": 262144,
+ "validated_context_length": false
+ }
+ },
+ "real_max_context_length": 262144
+ },
+ "num_attn_layers": 10,
+ "num_kv_heads": 2,
+ "head_dim": 256,
+ "backend": "baseten",
+ "disabled": false,
+ "disabled_reason": null,
+ "group": "Ornith",
+ "pricing": {
+ "train_from_usd": 2.5,
+ "run_from_usd_per_1m_output": 8.0
+ },
+ "marketing": {
+ "pitch": "35B MoE Qwen 3.5 finetune, 3B active, with a 256K window.",
+ "description": "Ornith 1.5 35B-A3B is a Qwen 3.5 35B-A3B finetune. A 2-step LoRA completed on the Qwen 3.5 Unsloth image, and the pinned vLLM image serves it with thinking disabled.",
+ "overview": "Same architecture as Qwen 3.5 35B-A3B: 10 full-attention layers, 256 experts, 256K positions. LoRA uses that full window.",
+ "good_for": [
+ "Agents that start from the Ornith 1.5 MoE checkpoint",
+ "LoRA on a 35B Qwen 3.5 mixture of experts",
+ "Tool-calling rows"
+ ]
+ },
+ "use_cases": [
+ "tool-calling"
+ ],
+ "benchmark_hf_model_ids": [
+ "ornith-ai/Ornith-1.5-35B-A3B"
+ ]
+ },
+{
"id": "google/gemma-4-31B-it",
"openrouter_id": "google/gemma-4-31b-it",
"backend": "baseten",
@@ -3038,7 +3231,7 @@
"coding"
]
},
- {
+{
"id": "google/gemma-4-26B-A4B-it",
"openrouter_id": "google/gemma-4-26b-a4b-it",
"backend": "baseten",
@@ -3100,7 +3293,7 @@
"coding"
]
},
- {
+{
"id": "meta-llama/Llama-3.3-70B-Instruct",
"openrouter_id": "meta-llama/llama-3.3-70b-instruct",
"backend": "baseten",
@@ -3163,7 +3356,7 @@
"meta-llama/Llama-3.3-70B-Instruct"
]
},
- {
+{
"id": "unsloth/Muse-Glimmer-30B",
"openrouter_id": null,
"backend": "baseten",
@@ -3225,7 +3418,72 @@
"coding"
]
},
- {
+{
+ "id": "nvidia/NVIDIA-Nemotron-3.5-Bolt-E4B-BF16",
+ "openrouter_id": null,
+ "hf_model_id": "nvidia/NVIDIA-Nemotron-3.5-Bolt-E4B-BF16",
+ "display": "Nemotron 3.5 Bolt E4B",
+ "tier": "small",
+ "params": "E4B (~8B)",
+ "total_params_b": 8.0,
+ "context_length": 65536,
+ "supports_tool_calling": true,
+ "type": "chat",
+ "hidden_size": 2560,
+ "fp8_supported": false,
+ "inference": {
+ "gpu_type": "L40S",
+ "min_vram_gb": 48,
+ "max_model_len": 8192
+ },
+ "finetuning": {
+ "context_length": 65536,
+ "max_batch_size": 4,
+ "min_batch_size": 1,
+ "unsloth_image": "gemma4",
+ "training_type": {
+ "full": {
+ "enabled": false,
+ "context_length": 65536,
+ "validated_context_length": false
+ },
+ "lora": {
+ "enabled": true,
+ "context_length": 65536,
+ "validated_context_length": false
+ }
+ },
+ "real_max_context_length": 65536
+ },
+ "num_attn_layers": 42,
+ "num_kv_heads": 2,
+ "head_dim": 256,
+ "backend": "baseten",
+ "disabled": false,
+ "disabled_reason": null,
+ "group": "Nemotron",
+ "pricing": {
+ "train_from_usd": 0.75,
+ "run_from_usd_per_1m_output": 4.0
+ },
+ "marketing": {
+ "pitch": "8B Gemma 4 finetune with thinking that can be turned off.",
+ "description": "Nemotron 3.5 Bolt E4B is an NVIDIA finetune of Gemma 4 E4B. It trains with LoRA on the Gemma 4 image and serves on the pinned vLLM image.",
+ "overview": "42 layers, a 65,536-token window, and tool calling. LoRA is the enabled training method.",
+ "good_for": [
+ "Agents that start from the Bolt E4B checkpoint",
+ "LoRA on a Gemma 4 E4B architecture",
+ "Tool-calling rows"
+ ]
+ },
+ "use_cases": [
+ "tool-calling"
+ ],
+ "benchmark_hf_model_ids": [
+ "nvidia/NVIDIA-Nemotron-3.5-Bolt-E4B-BF16"
+ ]
+ },
+{
"id": "nvidia/NVIDIA-Nemotron-3.5-Lightning-30B-A3B",
"openrouter_id": "nvidia/nemotron-3.5-lightning",
"backend": "baseten",
@@ -3291,7 +3549,7 @@
"coding"
]
},
- {
+{
"id": "Cloudflare/clef",
"openrouter_id": null,
"backend": "decision",
@@ -3334,7 +3592,7 @@
"disabled": false,
"disabled_reason": null
},
- {
+{
"id": "Cloudflare/clef-flash",
"openrouter_id": null,
"backend": "decision",
@@ -3377,7 +3635,7 @@
"disabled": false,
"disabled_reason": null
},
- {
+{
"id": "OvermindLab/qwen-3.5-0.8B-decision",
"openrouter_id": null,
"backend": "decision",
@@ -3420,7 +3678,7 @@
"disabled": false,
"disabled_reason": null
},
- {
+{
"id": "OvermindLab/qwen-3.5-2B-decision",
"openrouter_id": null,
"backend": "decision",
@@ -3463,7 +3721,7 @@
"disabled": false,
"disabled_reason": null
},
- {
+{
"id": "vllm-sr/d3-edge",
"openrouter_id": null,
"backend": "decision",
@@ -3506,7 +3764,7 @@
"disabled": true,
"disabled_reason": "Exact training and verified serving runtime not yet qualified"
},
- {
+{
"id": "vllm-sr/d3-lite",
"openrouter_id": null,
"backend": "decision",
@@ -3549,7 +3807,7 @@
"disabled": true,
"disabled_reason": "Exact training and verified serving runtime not yet qualified"
},
- {
+{
"id": "vllm-sr/d3-nano",
"openrouter_id": null,
"backend": "decision",
@@ -3592,7 +3850,7 @@
"disabled": true,
"disabled_reason": "Exact training and verified serving runtime not yet qualified"
},
- {
+{
"id": "vllm-sr/d3-mini",
"openrouter_id": null,
"backend": "decision",
@@ -3635,7 +3893,7 @@
"disabled": true,
"disabled_reason": "Exact training and verified serving runtime not yet qualified"
},
- {
+{
"id": "vllm-sr/d3-flash",
"openrouter_id": null,
"backend": "decision",
@@ -3678,7 +3936,7 @@
"disabled": true,
"disabled_reason": "Exact training and verified serving runtime not yet qualified"
},
- {
+{
"id": "vllm-sr/d3",
"openrouter_id": null,
"backend": "decision",
@@ -3721,7 +3979,7 @@
"disabled": true,
"disabled_reason": "Exact training and verified serving runtime not yet qualified"
},
- {
+{
"id": "LiquidAI/d1-omni-600M",
"openrouter_id": null,
"backend": "decision",
@@ -3765,7 +4023,7 @@
"disabled": true,
"disabled_reason": "vLLM 0.33.0 cannot load this checkpoint: text_config has no num_attention_heads."
},
- {
+{
"id": "LiquidAI/d1-3B",
"openrouter_id": null,
"backend": "decision",
diff --git a/overbae/modal/serving_benchmarks.json b/overbae/modal/serving_benchmarks.json
index 37f8ebd1..231c132b 100644
--- a/overbae/modal/serving_benchmarks.json
+++ b/overbae/modal/serving_benchmarks.json
@@ -2402,6 +2402,94 @@
"runtime": "vllm-0.30.0"
}
}
+ },
+ "ornith-ai/Ornith-1.5-9B": {
+ "lora_bf16": {
+ "L40S": {
+ "ttft_ms_p50": 59.4,
+ "tokens_per_second_p50": 44.6,
+ "measured_at": "2026-11-17T02:57:12Z",
+ "runtime": "vllm-0.33.0"
+ },
+ "A100-80GB": {
+ "ttft_ms_p50": 51.6,
+ "tokens_per_second_p50": 86.5,
+ "measured_at": "2026-11-17T02:56:37Z",
+ "runtime": "vllm-0.33.0"
+ },
+ "H100": {
+ "ttft_ms_p50": 36.3,
+ "tokens_per_second_p50": 150.3,
+ "measured_at": "2026-11-17T02:55:14Z",
+ "runtime": "vllm-0.33.0"
+ },
+ "H200": {
+ "ttft_ms_p50": 45.4,
+ "tokens_per_second_p50": 190.1,
+ "measured_at": "2026-11-17T02:56:08Z",
+ "runtime": "vllm-0.33.0"
+ }
+ }
+ },
+ "microsoft/Fara1.5-27B": {
+ "lora_bf16": {
+ "A100-80GB": {
+ "ttft_ms_p50": 144.2,
+ "tokens_per_second_p50": 29.2,
+ "measured_at": "2026-11-17T03:01:41Z",
+ "runtime": "vllm-0.33.0"
+ },
+ "H100": {
+ "ttft_ms_p50": 62.3,
+ "tokens_per_second_p50": 50.9,
+ "measured_at": "2026-11-17T02:58:16Z",
+ "runtime": "vllm-0.33.0"
+ },
+ "H200": {
+ "ttft_ms_p50": 77.8,
+ "tokens_per_second_p50": 66.5,
+ "measured_at": "2026-11-17T03:00:07Z",
+ "runtime": "vllm-0.33.0"
+ }
+ }
+ },
+ "ornith-ai/Ornith-1.5-35B-A3B": {
+ "lora_bf16": {
+ "H200": {
+ "ttft_ms_p50": 99.4,
+ "tokens_per_second_p50": 236.2,
+ "measured_at": "2026-11-17T02:59:34Z",
+ "runtime": "vllm-0.33.0"
+ }
+ }
+ },
+ "nvidia/NVIDIA-Nemotron-3.5-Bolt-E4B-BF16": {
+ "lora_bf16": {
+ "L40S": {
+ "ttft_ms_p50": 89.9,
+ "tokens_per_second_p50": 70.6,
+ "measured_at": "2026-11-17T11:36:50Z",
+ "runtime": "vllm-0.33.0"
+ },
+ "A100-80GB": {
+ "ttft_ms_p50": 52.1,
+ "tokens_per_second_p50": 115.4,
+ "measured_at": "2026-11-17T11:34:16Z",
+ "runtime": "vllm-0.33.0"
+ },
+ "H100": {
+ "ttft_ms_p50": 97.7,
+ "tokens_per_second_p50": 171.9,
+ "measured_at": "2026-11-17T11:36:35Z",
+ "runtime": "vllm-0.33.0"
+ },
+ "H200": {
+ "ttft_ms_p50": 59.0,
+ "tokens_per_second_p50": 205.2,
+ "measured_at": "2026-11-17T11:35:36Z",
+ "runtime": "vllm-0.33.0"
+ }
+ }
}
}
}
diff --git a/overbae/services/benchmarks/data/benchmark_results.json b/overbae/services/benchmarks/data/benchmark_results.json
index 9c1b6d68..30d35e30 100644
--- a/overbae/services/benchmarks/data/benchmark_results.json
+++ b/overbae/services/benchmarks/data/benchmark_results.json
@@ -8218,6 +8218,194 @@
"percentile": 75.0,
"cohort_n": 2
}
+ ],
+ "ornith-ai/Ornith-1.5-9B": [
+ {
+ "benchmark": "gpqa-diamond",
+ "skills": [
+ "Reasoning"
+ ],
+ "domains": [
+ "Science"
+ ],
+ "raw_score": 0.8640000000000001,
+ "scale": "accuracy_0_1",
+ "source": "huggingface",
+ "source_url": "https://huggingface.co/ornith-ai/Ornith-1.5-9B",
+ "observed_at": "2026-08-18",
+ "provenance": "lab_claimed",
+ "percentile": 75.0,
+ "cohort_n": 14
+ },
+ {
+ "benchmark": "humanitys-last-exam",
+ "skills": [
+ "Reasoning"
+ ],
+ "domains": [
+ "Medical",
+ "Science",
+ "Math",
+ "Humanities"
+ ],
+ "raw_score": 0.20199999999999999,
+ "scale": "accuracy_0_1",
+ "source": "huggingface",
+ "source_url": "https://huggingface.co/ornith-ai/Ornith-1.5-9B",
+ "observed_at": "2026-08-18",
+ "provenance": "lab_claimed",
+ "percentile": 38.89,
+ "cohort_n": 9
+ },
+ {
+ "benchmark": "swe-bench-multilingual",
+ "skills": [
+ "Coding",
+ "Agentic"
+ ],
+ "domains": [
+ "Coding",
+ "Multilingual"
+ ],
+ "raw_score": 0.544,
+ "scale": "accuracy_0_1",
+ "source": "huggingface",
+ "source_url": "https://huggingface.co/ornith-ai/Ornith-1.5-9B",
+ "observed_at": "2026-08-18",
+ "provenance": "lab_claimed",
+ "percentile": 50.0,
+ "cohort_n": 5
+ },
+ {
+ "benchmark": "swe-bench-pro",
+ "skills": [
+ "Coding",
+ "Agentic"
+ ],
+ "domains": [
+ "Coding"
+ ],
+ "raw_score": 0.475,
+ "scale": "accuracy_0_1",
+ "source": "huggingface",
+ "source_url": "https://huggingface.co/ornith-ai/Ornith-1.5-9B",
+ "observed_at": "2026-08-18",
+ "provenance": "lab_claimed",
+ "percentile": 12.5,
+ "cohort_n": 4
+ },
+ {
+ "benchmark": "swe-bench-verified",
+ "skills": [
+ "Coding",
+ "Agentic"
+ ],
+ "domains": [
+ "Coding"
+ ],
+ "raw_score": 0.706,
+ "scale": "accuracy_0_1",
+ "source": "huggingface",
+ "source_url": "https://huggingface.co/ornith-ai/Ornith-1.5-9B",
+ "observed_at": "2026-08-18",
+ "provenance": "lab_claimed",
+ "percentile": 56.25,
+ "cohort_n": 8
+ }
+ ],
+ "ornith-ai/Ornith-1.5-35B-A3B": [
+ {
+ "benchmark": "gpqa-diamond",
+ "skills": [
+ "Reasoning"
+ ],
+ "domains": [
+ "Science"
+ ],
+ "raw_score": 0.892,
+ "scale": "accuracy_0_1",
+ "source": "huggingface",
+ "source_url": "https://huggingface.co/ornith-ai/Ornith-1.5-35B-A3B",
+ "observed_at": "2026-08-18",
+ "provenance": "lab_claimed",
+ "percentile": 92.86,
+ "cohort_n": 14
+ },
+ {
+ "benchmark": "humanitys-last-exam",
+ "skills": [
+ "Reasoning"
+ ],
+ "domains": [
+ "Medical",
+ "Science",
+ "Math",
+ "Humanities"
+ ],
+ "raw_score": 0.256,
+ "scale": "accuracy_0_1",
+ "source": "huggingface",
+ "source_url": "https://huggingface.co/ornith-ai/Ornith-1.5-35B-A3B",
+ "observed_at": "2026-08-18",
+ "provenance": "lab_claimed",
+ "percentile": 83.33,
+ "cohort_n": 9
+ },
+ {
+ "benchmark": "swe-bench-multilingual",
+ "skills": [
+ "Coding",
+ "Agentic"
+ ],
+ "domains": [
+ "Coding",
+ "Multilingual"
+ ],
+ "raw_score": 0.7140000000000001,
+ "scale": "accuracy_0_1",
+ "source": "huggingface",
+ "source_url": "https://huggingface.co/ornith-ai/Ornith-1.5-35B-A3B",
+ "observed_at": "2026-08-18",
+ "provenance": "lab_claimed",
+ "percentile": 90.0,
+ "cohort_n": 5
+ },
+ {
+ "benchmark": "swe-bench-pro",
+ "skills": [
+ "Coding",
+ "Agentic"
+ ],
+ "domains": [
+ "Coding"
+ ],
+ "raw_score": 0.596,
+ "scale": "accuracy_0_1",
+ "source": "huggingface",
+ "source_url": "https://huggingface.co/ornith-ai/Ornith-1.5-35B-A3B",
+ "observed_at": "2026-08-18",
+ "provenance": "lab_claimed",
+ "percentile": 62.5,
+ "cohort_n": 4
+ },
+ {
+ "benchmark": "swe-bench-verified",
+ "skills": [
+ "Coding",
+ "Agentic"
+ ],
+ "domains": [
+ "Coding"
+ ],
+ "raw_score": 0.79,
+ "scale": "accuracy_0_1",
+ "source": "huggingface",
+ "source_url": "https://huggingface.co/ornith-ai/Ornith-1.5-35B-A3B",
+ "observed_at": "2026-08-18",
+ "provenance": "lab_claimed",
+ "percentile": 93.75,
+ "cohort_n": 8
+ }
]
},
"catalog": {
@@ -8368,6 +8556,14 @@
"Qwen/Qwen3.8-27B": {
"hf_model_id": "Qwen/Qwen3.8-27B",
"match_type": "hub_only"
+ },
+ "ornith-ai/Ornith-1.5-9B": {
+ "hf_model_id": "ornith-ai/Ornith-1.5-9B",
+ "match_type": "hub_only"
+ },
+ "ornith-ai/Ornith-1.5-35B-A3B": {
+ "hf_model_id": "ornith-ai/Ornith-1.5-35B-A3B",
+ "match_type": "hub_only"
}
}
}
diff --git a/overbae/services/sft_assets/families/bolt.py b/overbae/services/sft_assets/families/bolt.py
new file mode 100644
index 00000000..db9ea967
--- /dev/null
+++ b/overbae/services/sft_assets/families/bolt.py
@@ -0,0 +1,20 @@
+"""Nemotron 3.5 Bolt is a Gemma 4 E4B finetune whose checkpoint graph is not picklable.
+
+Torch gradient checkpointing pickles ``ConfigModuleInstance`` and the step never
+starts. Leaving checkpointing off fits a 512-token LoRA on one H100.
+"""
+
+from families.gemma4 import Gemma4Hooks
+
+
+class BoltHooks(Gemma4Hooks):
+ def peft_gradient_checkpointing(self) -> bool:
+ return False
+
+ def sft_config_overrides(self, *, use_lora: bool) -> dict:
+ cfg = super().sft_config_overrides(use_lora=use_lora)
+ cfg["gradient_checkpointing"] = False
+ return cfg
+
+
+hooks = BoltHooks()
diff --git a/overbae/services/sft_assets/gemma_templates/bolt_e4b.jinja b/overbae/services/sft_assets/gemma_templates/bolt_e4b.jinja
new file mode 100644
index 00000000..e4ac6701
--- /dev/null
+++ b/overbae/services/sft_assets/gemma_templates/bolt_e4b.jinja
@@ -0,0 +1,415 @@
+{%- if conversational_mode | default(false) -%}
+ {%- set spoken_instruction = "You are having a spoken conversation with the user. Respond as briefly as possible while still addressing their questions fully." -%}
+ {%- if messages and messages[0]['role'] in ['system', 'developer'] -%}
+ {%- set spoken = namespace(text='') -%}
+ {%- if messages[0]['content'] is string -%}
+ {%- set spoken.text = messages[0]['content'] | trim -%}
+ {%- else -%}
+ {%- for part in messages[0]['content'] -%}
+ {%- set spoken.text = spoken.text + (part['text'] | trim) + ' ' -%}
+ {%- endfor -%}
+ {%- set spoken.text = spoken.text | trim -%}
+ {%- endif -%}
+ {%- if spoken.text != spoken_instruction -%}
+ {%- set spoken.text = (spoken.text + '\n\n' if spoken.text else '') + spoken_instruction -%}
+ {%- endif -%}
+ {%- set messages = [{'role': messages[0]['role'], 'content': spoken.text}] + messages[1:] -%}
+ {%- else -%}
+ {%- set messages = [{'role': 'system', 'content': spoken_instruction}] + messages -%}
+ {%- endif -%}
+{%- endif -%}
+{#
+ Template: Nemotron updated Gemma4 chat template, reasoning-off suffix ablation
+ Published: 2026-08-20
+ Context: Preserve content ordering before tool-calls while matching the original
+ Gemma 4 generation prompt when enable_thinking=false.
+#}
+{%- macro format_parameters(properties, required, filter_keys=false) -%}
+ {%- set standard_keys = ['description', 'type', 'properties', 'required', 'nullable'] -%}
+ {%- set ns = namespace(found_first=false) -%}
+ {%- for key, value in properties | dictsort -%}
+ {%- set add_comma = false -%}
+ {%- if not filter_keys or key not in standard_keys -%}
+ {%- if ns.found_first %},{% endif -%}
+ {%- set ns.found_first = true -%}
+ {{ key }}:{
+ {%- if value['description'] -%}
+ description:<|"|>{{ value['description'] }}<|"|>
+ {%- set add_comma = true -%}
+ {%- endif -%}
+ {%- if value['type'] | upper == 'STRING' -%}
+ {%- if value['enum'] -%}
+ {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
+ enum:{{ format_argument(value['enum']) }}
+ {%- endif -%}
+ {%- elif value['type'] | upper == 'ARRAY' -%}
+ {%- if value['items'] is mapping and value['items'] -%}
+ {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
+ items:{
+ {%- set ns_items = namespace(found_first=false) -%}
+ {%- for item_key, item_value in value['items'] | dictsort -%}
+ {%- if item_value is not none -%}
+ {%- if ns_items.found_first %},{% endif -%}
+ {%- set ns_items.found_first = true -%}
+ {%- if item_key == 'properties' -%}
+ properties:{
+ {%- if item_value is mapping -%}
+ {{- format_parameters(item_value, value['items']['required'] | default([])) -}}
+ {%- endif -%}
+ }
+ {%- elif item_key == 'required' -%}
+ required:[
+ {%- for req_item in item_value -%}
+ <|"|>{{- req_item -}}<|"|>
+ {%- if not loop.last %},{% endif -%}
+ {%- endfor -%}
+ ]
+ {%- elif item_key == 'type' -%}
+ {%- if item_value is string -%}
+ type:{{ format_argument(item_value | upper) }}
+ {%- else -%}
+ type:{{ format_argument(item_value | map('upper') | list) }}
+ {%- endif -%}
+ {%- else -%}
+ {{ item_key }}:{{ format_argument(item_value) }}
+ {%- endif -%}
+ {%- endif -%}
+ {%- endfor -%}
+ }
+ {%- endif -%}
+ {%- endif -%}
+ {%- if value['nullable'] %}
+ {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
+ nullable:true
+ {%- endif -%}
+ {%- if value['type'] | upper == 'OBJECT' -%}
+ {%- if value['properties'] is defined and value['properties'] is mapping -%}
+ {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
+ properties:{
+ {{- format_parameters(value['properties'], value['required'] | default([])) -}}
+ }
+ {%- elif value is mapping -%}
+ {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
+ properties:{
+ {{- format_parameters(value, value['required'] | default([]), filter_keys=true) -}}
+ }
+ {%- endif -%}
+ {%- if value['required'] -%}
+ {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
+ required:[
+ {%- for item in value['required'] | default([]) -%}
+ <|"|>{{- item -}}<|"|>
+ {%- if not loop.last %},{% endif -%}
+ {%- endfor -%}
+ ]
+ {%- endif -%}
+ {%- endif -%}
+ {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
+ type:<|"|>{{ value['type'] | upper }}<|"|>}
+ {%- endif -%}
+ {%- endfor -%}
+{%- endmacro -%}
+{%- macro format_function_declaration(tool_data) -%}
+ declaration:{{- tool_data['function']['name'] -}}{description:<|"|>{{- tool_data['function']['description'] -}}<|"|>
+ {%- set params = tool_data['function']['parameters'] -%}
+ {%- if params -%}
+ ,parameters:{
+ {%- if params['properties'] -%}
+ properties:{ {{- format_parameters(params['properties'], params['required']) -}} },
+ {%- endif -%}
+ {%- if params['required'] -%}
+ required:[
+ {%- for item in params['required'] -%}
+ <|"|>{{- item -}}<|"|>
+ {{- ',' if not loop.last -}}
+ {%- endfor -%}
+ ],
+ {%- endif -%}
+ {%- if params['type'] -%}
+ type:<|"|>{{- params['type'] | upper -}}<|"|>}
+ {%- endif -%}
+ {%- endif -%}
+ {%- if 'response' in tool_data['function'] -%}
+ {%- set response_declaration = tool_data['function']['response'] -%}
+ ,response:{
+ {%- if response_declaration['description'] -%}
+ description:<|"|>{{- response_declaration['description'] -}}<|"|>,
+ {%- endif -%}
+ {%- if response_declaration['type'] | upper == 'OBJECT' -%}
+ type:<|"|>{{- response_declaration['type'] | upper -}}<|"|>}
+ {%- endif -%}
+ {%- endif -%}
+ }
+{%- endmacro -%}
+{%- macro format_argument(argument, escape_keys=True) -%}
+ {%- if argument is none -%}
+ {{- 'null' -}}
+ {%- elif argument is string -%}
+ {{- '<|"|>' + argument + '<|"|>' -}}
+ {%- elif argument is boolean -%}
+ {{- 'true' if argument else 'false' -}}
+ {%- elif argument is mapping -%}
+ {{- '{' -}}
+ {%- set ns = namespace(found_first=false) -%}
+ {%- for key, value in argument | dictsort -%}
+ {%- if ns.found_first %},{% endif -%}
+ {%- set ns.found_first = true -%}
+ {%- if escape_keys -%}
+ {{- '<|"|>' + key + '<|"|>' -}}
+ {%- else -%}
+ {{- key -}}
+ {%- endif -%}
+ :{{- format_argument(value, escape_keys=escape_keys) -}}
+ {%- endfor -%}
+ {{- '}' -}}
+ {%- elif argument is sequence -%}
+ {{- '[' -}}
+ {%- for item in argument -%}
+ {{- format_argument(item, escape_keys=escape_keys) -}}
+ {%- if not loop.last %},{% endif -%}
+ {%- endfor -%}
+ {{- ']' -}}
+ {%- else -%}
+ {{- argument -}}
+ {%- endif -%}
+{%- endmacro -%}
+{%- macro strip_thinking(text) -%}
+ {%- set ns = namespace(result='') -%}
+ {%- for part in text.split('<channel|>') -%}
+ {%- if '<|channel>' in part -%}
+ {%- set ns.result = ns.result + part.split('<|channel>')[0] -%}
+ {%- else -%}
+ {%- set ns.result = ns.result + part -%}
+ {%- endif -%}
+ {%- endfor -%}
+ {{- ns.result | trim -}}
+{%- endmacro -%}
+
+{%- macro format_tool_response_block(tool_name, response) -%}
+ {{- '<|tool_response>' -}}
+ {%- if response is mapping -%}
+ {{- 'response:' + tool_name + '{' -}}
+ {%- for key, value in response | dictsort -%}
+ {{- key -}}:{{- format_argument(value, escape_keys=False) -}}
+ {%- if not loop.last %},{% endif -%}
+ {%- endfor -%}
+ {{- '}' -}}
+ {%- else -%}
+ {{- 'response:' + tool_name + '{value:' + format_argument(response, escape_keys=False) + '}' -}}
+ {%- endif -%}
+ {{- '<tool_response|>' -}}
+{%- endmacro -%}
+
+{#- ===== SETUP ===== -#}
+{%- set ns = namespace(prev_message_type=None, prev_non_tool_role=None) -%}
+{%- set loop_messages = messages -%}
+{%- set enable_thinking = enable_thinking | default(false) -%}
+{%- set preserve_thinking = preserve_thinking | default(false) -%}
+{{- bos_token -}}
+{#- Handle System/Tool Definitions Block -#}
+{%- if enable_thinking or tools or (messages and messages[0]['role'] in ['system', 'developer']) -%}
+ {{- '<|turn>system\n' -}}
+ {#- Inject Thinking token at the very top of the FIRST system turn -#}
+ {%- if enable_thinking -%}
+ {{- '<|think|>\n' -}}
+ {%- set ns.prev_message_type = 'think' -%}
+ {%- endif -%}
+ {%- if messages and messages[0]['role'] in ['system', 'developer'] -%}
+ {%- if messages[0]['content'] is string -%}
+ {{- messages[0]['content'] | trim -}}
+ {%- elif messages[0]['content'] is sequence -%}
+ {%- for item in messages[0]['content'] -%}
+ {{- item['text'] | trim + ' '-}}
+ {%- endfor -%}
+ {%- endif -%}
+ {%- set loop_messages = messages[1:] -%}
+ {%- endif -%}
+ {%- if tools -%}
+ {%- for tool in tools %}
+ {{- '<|tool>' -}}
+ {{- format_function_declaration(tool) | trim -}}
+ {{- '<tool|>' -}}
+ {%- endfor %}
+ {%- set ns.prev_message_type = 'tool' -%}
+ {%- endif -%}
+ {{- '<turn|>\n' -}}
+{%- endif %}
+
+{#- Pre-scan: find last user message index for reasoning guard -#}
+{%- set ns_turn = namespace(last_user_idx=-1) -%}
+{%- for i in range(loop_messages | length) -%}
+ {%- if loop_messages[i]['role'] == 'user' -%}
+ {%- set ns_turn.last_user_idx = i -%}
+ {%- endif -%}
+{%- endfor -%}
+
+{#- Loop through messages -#}
+{%- for message in loop_messages -%}
+ {%- if message['role'] != 'tool' -%}
+ {%- set ns.prev_message_type = None -%}
+ {%- set role = 'model' if message['role'] == 'assistant' else message['role'] -%}
+ {#- Detect continuation using tracked state — O(1) instead of O(n) backward scan -#}
+ {%- set continue_same_model_turn = (role == 'model' and ns.prev_non_tool_role == 'assistant') -%}
+ {%- if not continue_same_model_turn -%}
+ {{- '<|turn>' + role + '\n' }}
+
+ {%- endif -%}
+
+ {#- Render reasoning/reasoning_content as thinking channel -#}
+ {%- set thinking_text = message.get('reasoning') or message.get('reasoning_content') -%}
+ {%- set thinking_gate = (loop.index0 > ns_turn.last_user_idx) or (preserve_thinking and message.get('tool_calls')) -%}
+ {%- if thinking_text and thinking_gate -%}
+ {{- '<|channel>thought\n' + thinking_text + '\n<channel|>' -}}
+ {%- endif -%}
+
+ {%- set captured_content -%}
+ {%- if message.get('content') is string -%}
+ {%- if role == 'model' -%}
+ {{- strip_thinking(message['content']) -}}
+ {%- else -%}
+ {{- message['content'] | trim -}}
+ {%- endif -%}
+ {%- elif message.get('content') is sequence -%}
+ {%- for item in message['content'] -%}
+ {%- if item.get('type') == 'text' -%}
+ {%- if role == 'model' -%}
+ {{- strip_thinking(item['text']) -}}
+ {%- else -%}
+ {{- item['text'] | trim -}}
+ {%- endif -%}
+ {%- elif item.get('type') in ['image', 'image_url'] -%}
+ {{- '<|image|>' -}}
+ {%- elif item.get('type') in ['audio', 'input_audio'] -%}
+ {{- '<|audio|>' -}}
+ {%- elif item.get('type') == 'video' -%}
+ {{- '<|video|>' -}}
+ {%- endif -%}
+ {%- endfor -%}
+ {%- endif -%}
+ {%- endset -%}
+
+ {#- The sole intentional behavior change from HF main: preserve
+ OpenAI assistant content before its tool calls. -#}
+ {%- if role == 'model' and message.get('tool_calls') -%}
+ {{- captured_content -}}
+ {%- endif -%}
+
+ {%- if message.get('tool_calls') -%}
+ {%- for tool_call in message.get('tool_calls') -%}
+ {%- set function = tool_call['function'] -%}
+ {{- '<|tool_call>call:' + function['name'] + '{' -}}
+ {%- if function['arguments'] is mapping -%}
+ {%- set ns_args = namespace(found_first=false) -%}
+ {%- for key, value in function['arguments'] | dictsort -%}
+ {%- if ns_args.found_first %},{% endif -%}
+ {%- set ns_args.found_first = true -%}
+ {{- key -}}:{{- format_argument(value, escape_keys=False) -}}
+ {%- endfor -%}
+ {%- elif function['arguments'] is none -%}
+ {%- else -%}
+ {{- raise_exception(
+ "chat_template: tool_calls[].function.arguments must be a "
+ "JSON object (mapping), not a string. Deserialize arguments "
+ "before passing to the template."
+ ) -}}
+ {%- endif -%}
+ {{- '}<tool_call|>' -}}
+ {%- endfor -%}
+ {%- set ns.prev_message_type = 'tool_call' -%}
+ {%- endif -%}
+
+ {%- set ns_tr_out = namespace(flag=false) -%}
+ {%- if message.get('tool_responses') -%}
+ {#- Legacy: tool_responses embedded on the assistant message (Google/Gemma native) -#}
+ {%- for tool_response in message.get('tool_responses') -%}
+ {{- format_tool_response_block(tool_response['name'] | default('unknown', true), tool_response['response']) -}}
+ {%- set ns_tr_out.flag = true -%}
+ {%- set ns.prev_message_type = 'tool_response' -%}
+ {%- endfor -%}
+ {%- elif message.get('tool_calls') -%}
+ {#- OpenAI Chat Completions: forward-scan consecutive role:tool messages -#}
+ {%- set ns_tool_scan = namespace(stopped=false) -%}
+ {%- for k in range(loop.index0 + 1, loop_messages | length) -%}
+ {%- if ns_tool_scan.stopped -%}
+ {%- elif loop_messages[k]['role'] != 'tool' -%}
+ {%- set ns_tool_scan.stopped = true -%}
+ {%- else -%}
+ {%- set follow = loop_messages[k] -%}
+ {#- Resolve tool_call_id to function name -#}
+ {%- set ns_tname = namespace(name=follow.get('name') or 'unknown') -%}
+ {%- for tc in message.get('tool_calls') -%}
+ {%- if tc.get('id') == follow.get('tool_call_id') -%}
+ {%- set ns_tname.name = tc['function']['name'] -%}
+ {%- endif -%}
+ {%- endfor -%}
+ {#- Handle content as string or content-parts array -#}
+ {%- set tool_body = follow.get('content') -%}
+ {%- if tool_body is string -%}
+ {{- format_tool_response_block(ns_tname.name, tool_body) -}}
+ {%- elif tool_body is sequence and tool_body is not string -%}
+ {%- set ns_txt = namespace(s='') -%}
+ {%- for part in tool_body -%}
+ {%- if part.get('type') == 'text' -%}
+ {%- set ns_txt.s = ns_txt.s + (part.get('text') | default('')) -%}
+ {%- endif -%}
+ {%- endfor -%}
+ {{- format_tool_response_block(ns_tname.name, ns_txt.s) -}}
+ {%- for part in tool_body -%}
+ {%- if part.get('type') in ['image', 'image_url'] -%}
+ {{- '<|image|>' -}}
+ {%- elif part.get('type') in ['audio', 'input_audio'] -%}
+ {{- '<|audio|>' -}}
+ {%- elif part.get('type') == 'video' -%}
+ {{- '<|video|>' -}}
+ {%- endif -%}
+ {%- endfor -%}
+ {%- else -%}
+ {{- format_tool_response_block(ns_tname.name, tool_body) -}}
+ {%- endif -%}
+ {%- set ns_tr_out.flag = true -%}
+ {%- set ns.prev_message_type = 'tool_response' -%}
+ {%- endif -%}
+ {%- endfor -%}
+ {%- endif -%}
+
+ {%- if not (role == 'model' and message.get('tool_calls')) -%}
+ {{- captured_content -}}
+ {%- endif -%}
+ {%- set has_content = captured_content | trim | length > 0 -%}
+
+ {#- Forward-scan: find next non-tool message role for continuation detection -#}
+ {%- set next_nt = namespace(role=None, found=false) -%}
+ {%- for j in range(loop.index0 + 1, loop_messages | length) -%}
+ {%- if not next_nt.found -%}
+ {%- if loop_messages[j]['role'] != 'tool' -%}
+ {%- set next_nt.role = loop_messages[j]['role'] -%}
+ {%- set next_nt.found = true -%}
+ {%- endif -%}
+ {%- endif -%}
+ {%- endfor -%}
+
+ {%- set continues_into_next = (
+ role == 'model'
+ and next_nt.role == 'assistant'
+ and (not message.get('tool_calls') or ns_tr_out.flag)
+ ) -%}
+
+ {%- if ns.prev_message_type == 'tool_call' and not ns_tr_out.flag -%}
+ {{- '<|tool_response>' -}}
+ {%- elif continues_into_next -%}
+ {%- elif not (ns_tr_out.flag and not has_content and not next_nt.found) -%}
+ {{- '<turn|>\n' -}}
+ {%- endif -%}
+
+ {#- Track previous non-tool role for next iteration (avoids O(n) backward scan) -#}
+ {%- set ns.prev_non_tool_role = message['role'] -%}
+ {%- endif -%}
+{%- endfor -%}
+
+{%- if add_generation_prompt -%}
+ {%- if ns.prev_message_type != 'tool_response' and ns.prev_message_type != 'tool_call' -%}
+ {{- '<|turn>model\n' -}}
+ {%- elif ns.prev_message_type == 'tool_response' and enable_thinking -%}
+ {{- '<|channel>thought\n' -}}
+ {%- endif -%}
+{%- endif -%}
diff --git a/overbae/services/sft_assets/gemma_templates/bolt_e4b_training.jinja b/overbae/services/sft_assets/gemma_templates/bolt_e4b_training.jinja
new file mode 100644
index 00000000..81ca09dc
--- /dev/null
+++ b/overbae/services/sft_assets/gemma_templates/bolt_e4b_training.jinja
@@ -0,0 +1,421 @@
+{%- if conversational_mode | default(false) -%}
+ {%- set spoken_instruction = "You are having a spoken conversation with the user. Respond as briefly as possible while still addressing their questions fully." -%}
+ {%- if messages and messages[0]['role'] in ['system', 'developer'] -%}
+ {%- set spoken = namespace(text='') -%}
+ {%- if messages[0]['content'] is string -%}
+ {%- set spoken.text = messages[0]['content'] | trim -%}
+ {%- else -%}
+ {%- for part in messages[0]['content'] -%}
+ {%- set spoken.text = spoken.text + (part['text'] | trim) + ' ' -%}
+ {%- endfor -%}
+ {%- set spoken.text = spoken.text | trim -%}
+ {%- endif -%}
+ {%- if spoken.text != spoken_instruction -%}
+ {%- set spoken.text = (spoken.text + '\n\n' if spoken.text else '') + spoken_instruction -%}
+ {%- endif -%}
+ {%- set messages = [{'role': messages[0]['role'], 'content': spoken.text}] + messages[1:] -%}
+ {%- else -%}
+ {%- set messages = [{'role': 'system', 'content': spoken_instruction}] + messages -%}
+ {%- endif -%}
+{%- endif -%}
+{#
+ Template: Nemotron updated Gemma4 chat template, reasoning-off suffix ablation
+ Published: 2026-08-20
+ Context: Preserve content ordering before tool-calls while matching the original
+ Gemma 4 generation prompt when enable_thinking=false.
+#}
+{%- macro format_parameters(properties, required, filter_keys=false) -%}
+ {%- set standard_keys = ['description', 'type', 'properties', 'required', 'nullable'] -%}
+ {%- set ns = namespace(found_first=false) -%}
+ {%- for key, value in properties | dictsort -%}
+ {%- set add_comma = false -%}
+ {%- if not filter_keys or key not in standard_keys -%}
+ {%- if ns.found_first %},{% endif -%}
+ {%- set ns.found_first = true -%}
+ {{ key }}:{
+ {%- if value['description'] -%}
+ description:<|"|>{{ value['description'] }}<|"|>
+ {%- set add_comma = true -%}
+ {%- endif -%}
+ {%- if value['type'] | upper == 'STRING' -%}
+ {%- if value['enum'] -%}
+ {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
+ enum:{{ format_argument(value['enum']) }}
+ {%- endif -%}
+ {%- elif value['type'] | upper == 'ARRAY' -%}
+ {%- if value['items'] is mapping and value['items'] -%}
+ {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
+ items:{
+ {%- set ns_items = namespace(found_first=false) -%}
+ {%- for item_key, item_value in value['items'] | dictsort -%}
+ {%- if item_value is not none -%}
+ {%- if ns_items.found_first %},{% endif -%}
+ {%- set ns_items.found_first = true -%}
+ {%- if item_key == 'properties' -%}
+ properties:{
+ {%- if item_value is mapping -%}
+ {{- format_parameters(item_value, value['items']['required'] | default([])) -}}
+ {%- endif -%}
+ }
+ {%- elif item_key == 'required' -%}
+ required:[
+ {%- for req_item in item_value -%}
+ <|"|>{{- req_item -}}<|"|>
+ {%- if not loop.last %},{% endif -%}
+ {%- endfor -%}
+ ]
+ {%- elif item_key == 'type' -%}
+ {%- if item_value is string -%}
+ type:{{ format_argument(item_value | upper) }}
+ {%- else -%}
+ type:{{ format_argument(item_value | map('upper') | list) }}
+ {%- endif -%}
+ {%- else -%}
+ {{ item_key }}:{{ format_argument(item_value) }}
+ {%- endif -%}
+ {%- endif -%}
+ {%- endfor -%}
+ }
+ {%- endif -%}
+ {%- endif -%}
+ {%- if value['nullable'] %}
+ {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
+ nullable:true
+ {%- endif -%}
+ {%- if value['type'] | upper == 'OBJECT' -%}
+ {%- if value['properties'] is defined and value['properties'] is mapping -%}
+ {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
+ properties:{
+ {{- format_parameters(value['properties'], value['required'] | default([])) -}}
+ }
+ {%- elif value is mapping -%}
+ {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
+ properties:{
+ {{- format_parameters(value, value['required'] | default([]), filter_keys=true) -}}
+ }
+ {%- endif -%}
+ {%- if value['required'] -%}
+ {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
+ required:[
+ {%- for item in value['required'] | default([]) -%}
+ <|"|>{{- item -}}<|"|>
+ {%- if not loop.last %},{% endif -%}
+ {%- endfor -%}
+ ]
+ {%- endif -%}
+ {%- endif -%}
+ {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
+ type:<|"|>{{ value['type'] | upper }}<|"|>}
+ {%- endif -%}
+ {%- endfor -%}
+{%- endmacro -%}
+{%- macro format_function_declaration(tool_data) -%}
+ declaration:{{- tool_data['function']['name'] -}}{description:<|"|>{{- tool_data['function']['description'] -}}<|"|>
+ {%- set params = tool_data['function']['parameters'] -%}
+ {%- if params -%}
+ ,parameters:{
+ {%- if params['properties'] -%}
+ properties:{ {{- format_parameters(params['properties'], params['required']) -}} },
+ {%- endif -%}
+ {%- if params['required'] -%}
+ required:[
+ {%- for item in params['required'] -%}
+ <|"|>{{- item -}}<|"|>
+ {{- ',' if not loop.last -}}
+ {%- endfor -%}
+ ],
+ {%- endif -%}
+ {%- if params['type'] -%}
+ type:<|"|>{{- params['type'] | upper -}}<|"|>}
+ {%- endif -%}
+ {%- endif -%}
+ {%- if 'response' in tool_data['function'] -%}
+ {%- set response_declaration = tool_data['function']['response'] -%}
+ ,response:{
+ {%- if response_declaration['description'] -%}
+ description:<|"|>{{- response_declaration['description'] -}}<|"|>,
+ {%- endif -%}
+ {%- if response_declaration['type'] | upper == 'OBJECT' -%}
+ type:<|"|>{{- response_declaration['type'] | upper -}}<|"|>}
+ {%- endif -%}
+ {%- endif -%}
+ }
+{%- endmacro -%}
+{%- macro format_argument(argument, escape_keys=True) -%}
+ {%- if argument is none -%}
+ {{- 'null' -}}
+ {%- elif argument is string -%}
+ {{- '<|"|>' + argument + '<|"|>' -}}
+ {%- elif argument is boolean -%}
+ {{- 'true' if argument else 'false' -}}
+ {%- elif argument is mapping -%}
+ {{- '{' -}}
+ {%- set ns = namespace(found_first=false) -%}
+ {%- for key, value in argument | dictsort -%}
+ {%- if ns.found_first %},{% endif -%}
+ {%- set ns.found_first = true -%}
+ {%- if escape_keys -%}
+ {{- '<|"|>' + key + '<|"|>' -}}
+ {%- else -%}
+ {{- key -}}
+ {%- endif -%}
+ :{{- format_argument(value, escape_keys=escape_keys) -}}
+ {%- endfor -%}
+ {{- '}' -}}
+ {%- elif argument is sequence -%}
+ {{- '[' -}}
+ {%- for item in argument -%}
+ {{- format_argument(item, escape_keys=escape_keys) -}}
+ {%- if not loop.last %},{% endif -%}
+ {%- endfor -%}
+ {{- ']' -}}
+ {%- else -%}
+ {{- argument -}}
+ {%- endif -%}
+{%- endmacro -%}
+{%- macro strip_thinking(text) -%}
+ {%- set ns = namespace(result='') -%}
+ {%- for part in text.split('<channel|>') -%}
+ {%- if '<|channel>' in part -%}
+ {%- set ns.result = ns.result + part.split('<|channel>')[0] -%}
+ {%- else -%}
+ {%- set ns.result = ns.result + part -%}
+ {%- endif -%}
+ {%- endfor -%}
+ {{- ns.result | trim -}}
+{%- endmacro -%}
+
+{%- macro format_tool_response_block(tool_name, response) -%}
+ {{- '<|tool_response>' -}}
+ {%- if response is mapping -%}
+ {{- 'response:' + tool_name + '{' -}}
+ {%- for key, value in response | dictsort -%}
+ {{- key -}}:{{- format_argument(value, escape_keys=False) -}}
+ {%- if not loop.last %},{% endif -%}
+ {%- endfor -%}
+ {{- '}' -}}
+ {%- else -%}
+ {{- 'response:' + tool_name + '{value:' + format_argument(response, escape_keys=False) + '}' -}}
+ {%- endif -%}
+ {{- '<tool_response|>' -}}
+{%- endmacro -%}
+
+{#- ===== SETUP ===== -#}
+{%- set ns = namespace(prev_message_type=None, prev_non_tool_role=None) -%}
+{%- set loop_messages = messages -%}
+{%- set enable_thinking = enable_thinking | default(false) -%}
+{%- set preserve_thinking = preserve_thinking | default(false) -%}
+{{- bos_token -}}
+{#- Handle System/Tool Definitions Block -#}
+{%- if enable_thinking or tools or (messages and messages[0]['role'] in ['system', 'developer']) -%}
+ {{- '<|turn>system\n' -}}
+ {#- Inject Thinking token at the very top of the FIRST system turn -#}
+ {%- if enable_thinking -%}
+ {{- '<|think|>\n' -}}
+ {%- set ns.prev_message_type = 'think' -%}
+ {%- endif -%}
+ {%- if messages and messages[0]['role'] in ['system', 'developer'] -%}
+ {%- if messages[0]['content'] is string -%}
+ {{- messages[0]['content'] | trim -}}
+ {%- elif messages[0]['content'] is sequence -%}
+ {%- for item in messages[0]['content'] -%}
+ {{- item['text'] | trim + ' '-}}
+ {%- endfor -%}
+ {%- endif -%}
+ {%- set loop_messages = messages[1:] -%}
+ {%- endif -%}
+ {%- if tools -%}
+ {%- for tool in tools %}
+ {{- '<|tool>' -}}
+ {{- format_function_declaration(tool) | trim -}}
+ {{- '<tool|>' -}}
+ {%- endfor %}
+ {%- set ns.prev_message_type = 'tool' -%}
+ {%- endif -%}
+ {{- '<turn|>\n' -}}
+{%- endif %}
+
+{#- Pre-scan: find last user message index for reasoning guard -#}
+{%- set ns_turn = namespace(last_user_idx=-1) -%}
+{%- for i in range(loop_messages | length) -%}
+ {%- if loop_messages[i]['role'] == 'user' -%}
+ {%- set ns_turn.last_user_idx = i -%}
+ {%- endif -%}
+{%- endfor -%}
+
+{#- Loop through messages -#}
+{%- for message in loop_messages -%}
+ {%- if message['role'] != 'tool' -%}
+ {%- set ns.prev_message_type = None -%}
+ {%- set role = 'model' if message['role'] == 'assistant' else message['role'] -%}
+ {#- Detect continuation using tracked state — O(1) instead of O(n) backward scan -#}
+ {%- set continue_same_model_turn = (role == 'model' and ns.prev_non_tool_role == 'assistant') -%}
+ {%- if not continue_same_model_turn -%}
+ {{- '<|turn>' + role + '\n' }}
+
+ {%- endif -%}
+ {%- set captured_content -%}
+ {%- if message.get('content') is string -%}
+ {%- if role == 'model' -%}
+ {{- strip_thinking(message['content']) -}}
+ {%- else -%}
+ {{- message['content'] | trim -}}
+ {%- endif -%}
+ {%- elif message.get('content') is sequence -%}
+ {%- for item in message['content'] -%}
+ {%- if item.get('type') == 'text' -%}
+ {%- if role == 'model' -%}
+ {{- strip_thinking(item['text']) -}}
+ {%- else -%}
+ {{- item['text'] | trim -}}
+ {%- endif -%}
+ {%- elif item.get('type') in ['image', 'image_url'] -%}
+ {{- '<|image|>' -}}
+ {%- elif item.get('type') in ['audio', 'input_audio'] -%}
+ {{- '<|audio|>' -}}
+ {%- elif item.get('type') == 'video' -%}
+ {{- '<|video|>' -}}
+ {%- endif -%}
+ {%- endfor -%}
+ {%- endif -%}
+ {%- endset -%}
+
+ {%- set gen_head -%}
+
+ {#- Render reasoning/reasoning_content as thinking channel -#}
+ {%- set thinking_text = message.get('reasoning') or message.get('reasoning_content') -%}
+ {%- set thinking_gate = (loop.index0 > ns_turn.last_user_idx) or (preserve_thinking and message.get('tool_calls')) -%}
+ {%- if thinking_text and thinking_gate -%}
+ {{- '<|channel>thought\n' + thinking_text + '\n<channel|>' -}}
+ {%- endif -%}
+
+ {#- The sole intentional behavior change from HF main: preserve
+ OpenAI assistant content before its tool calls. -#}
+ {%- if role == 'model' and message.get('tool_calls') -%}
+ {{- captured_content -}}
+ {%- endif -%}
+
+ {%- if message.get('tool_calls') -%}
+ {%- for tool_call in message.get('tool_calls') -%}
+ {%- set function = tool_call['function'] -%}
+ {{- '<|tool_call>call:' + function['name'] + '{' -}}
+ {%- if function['arguments'] is mapping -%}
+ {%- set ns_args = namespace(found_first=false) -%}
+ {%- for key, value in function['arguments'] | dictsort -%}
+ {%- if ns_args.found_first %},{% endif -%}
+ {%- set ns_args.found_first = true -%}
+ {{- key -}}:{{- format_argument(value, escape_keys=False) -}}
+ {%- endfor -%}
+ {%- elif function['arguments'] is none -%}
+ {%- else -%}
+ {{- raise_exception(
+ "chat_template: tool_calls[].function.arguments must be a "
+ "JSON object (mapping), not a string. Deserialize arguments "
+ "before passing to the template."
+ ) -}}
+ {%- endif -%}
+ {{- '}<tool_call|>' -}}
+ {%- endfor -%}
+ {%- set ns.prev_message_type = 'tool_call' -%}
+ {%- endif -%}
+
+ {%- endset -%}
+ {%- if role == 'model' -%}{%- generation -%}{{- gen_head -}}{%- endgeneration -%}{%- else -%}{{- gen_head -}}{%- endif -%}
+ {%- set ns_tr_out = namespace(flag=false) -%}
+ {%- if message.get('tool_responses') -%}
+ {#- Legacy: tool_responses embedded on the assistant message (Google/Gemma native) -#}
+ {%- for tool_response in message.get('tool_responses') -%}
+ {{- format_tool_response_block(tool_response['name'] | default('unknown', true), tool_response['response']) -}}
+ {%- set ns_tr_out.flag = true -%}
+ {%- set ns.prev_message_type = 'tool_response' -%}
+ {%- endfor -%}
+ {%- elif message.get('tool_calls') -%}
+ {#- OpenAI Chat Completions: forward-scan consecutive role:tool messages -#}
+ {%- set ns_tool_scan = namespace(stopped=false) -%}
+ {%- for k in range(loop.index0 + 1, loop_messages | length) -%}
+ {%- if ns_tool_scan.stopped -%}
+ {%- elif loop_messages[k]['role'] != 'tool' -%}
+ {%- set ns_tool_scan.stopped = true -%}
+ {%- else -%}
+ {%- set follow = loop_messages[k] -%}
+ {#- Resolve tool_call_id to function name -#}
+ {%- set ns_tname = namespace(name=follow.get('name') or 'unknown') -%}
+ {%- for tc in message.get('tool_calls') -%}
+ {%- if tc.get('id') == follow.get('tool_call_id') -%}
+ {%- set ns_tname.name = tc['function']['name'] -%}
+ {%- endif -%}
+ {%- endfor -%}
+ {#- Handle content as string or content-parts array -#}
+ {%- set tool_body = follow.get('content') -%}
+ {%- if tool_body is string -%}
+ {{- format_tool_response_block(ns_tname.name, tool_body) -}}
+ {%- elif tool_body is sequence and tool_body is not string -%}
+ {%- set ns_txt = namespace(s='') -%}
+ {%- for part in tool_body -%}
+ {%- if part.get('type') == 'text' -%}
+ {%- set ns_txt.s = ns_txt.s + (part.get('text') | default('')) -%}
+ {%- endif -%}
+ {%- endfor -%}
+ {{- format_tool_response_block(ns_tname.name, ns_txt.s) -}}
+ {%- for part in tool_body -%}
+ {%- if part.get('type') in ['image', 'image_url'] -%}
+ {{- '<|image|>' -}}
+ {%- elif part.get('type') in ['audio', 'input_audio'] -%}
+ {{- '<|audio|>' -}}
+ {%- elif part.get('type') == 'video' -%}
+ {{- '<|video|>' -}}
+ {%- endif -%}
+ {%- endfor -%}
+ {%- else -%}
+ {{- format_tool_response_block(ns_tname.name, tool_body) -}}
+ {%- endif -%}
+ {%- set ns_tr_out.flag = true -%}
+ {%- set ns.prev_message_type = 'tool_response' -%}
+ {%- endif -%}
+ {%- endfor -%}
+ {%- endif -%}
+
+ {%- set gen_tail -%}
+ {%- if not (role == 'model' and message.get('tool_calls')) -%}
+ {{- captured_content -}}
+ {%- endif -%}
+ {%- set has_content = captured_content | trim | length > 0 -%}
+
+ {#- Forward-scan: find next non-tool message role for continuation detection -#}
+ {%- set next_nt = namespace(role=None, found=false) -%}
+ {%- for j in range(loop.index0 + 1, loop_messages | length) -%}
+ {%- if not next_nt.found -%}
+ {%- if loop_messages[j]['role'] != 'tool' -%}
+ {%- set next_nt.role = loop_messages[j]['role'] -%}
+ {%- set next_nt.found = true -%}
+ {%- endif -%}
+ {%- endif -%}
+ {%- endfor -%}
+
+ {%- set continues_into_next = (
+ role == 'model'
+ and next_nt.role == 'assistant'
+ and (not message.get('tool_calls') or ns_tr_out.flag)
+ ) -%}
+
+ {%- if ns.prev_message_type == 'tool_call' and not ns_tr_out.flag -%}
+ {{- '<|tool_response>' -}}
+ {%- elif continues_into_next -%}
+ {%- elif not (ns_tr_out.flag and not has_content and not next_nt.found) -%}
+ {{- '<turn|>\n' -}}
+ {%- endif -%}
+ {%- endset -%}
+ {%- if role == 'model' -%}{%- generation -%}{{- gen_tail -}}{%- endgeneration -%}{%- else -%}{{- gen_tail -}}{%- endif -%}
+
+ {#- Track previous non-tool role for next iteration (avoids O(n) backward scan) -#}
+ {%- set ns.prev_non_tool_role = message['role'] -%}
+ {%- endif -%}
+{%- endfor -%}
+
+{%- if add_generation_prompt -%}
+ {%- if ns.prev_message_type != 'tool_response' and ns.prev_message_type != 'tool_call' -%}
+ {{- '<|turn>model\n' -}}
+ {%- elif ns.prev_message_type == 'tool_response' and enable_thinking -%}
+ {{- '<|channel>thought\n' -}}
+ {%- endif -%}
+{%- endif -%}
diff --git a/overbae/services/sft_assets/qwen_templates/ornith15_35b.jinja b/overbae/services/sft_assets/qwen_templates/ornith15_35b.jinja
new file mode 100644
index 00000000..b07660cc
--- /dev/null
+++ b/overbae/services/sft_assets/qwen_templates/ornith15_35b.jinja
@@ -0,0 +1,150 @@
+{%- set image_count = namespace(value=0) %}
+{%- set video_count = namespace(value=0) %}
+{%- macro render_content(content, do_vision_count, is_system_content=false) %}
+ {%- if content is string %}
+ {{- content }}
+ {%- elif content is iterable and content is not mapping %}
+ {%- for item in content %}
+ {%- if 'image' in item or 'image_url' in item or item.type == 'image' %}
+ {%- if is_system_content %}
+ {{- raise_exception('System message cannot contain images.') }}
+ {%- endif %}
+ {%- if do_vision_count %}
+ {%- set image_count.value = image_count.value + 1 %}
+ {%- endif %}
+ {%- if add_vision_id %}
+ {{- 'Picture ' ~ image_count.value ~ ': ' }}
+ {%- endif %}
+ {{- '<|vision_start|><|image_pad|><|vision_end|>' }}
+ {%- elif 'video' in item or item.type == 'video' %}
+ {%- if is_system_content %}
+ {{- raise_exception('System message cannot contain videos.') }}
+ {%- endif %}
+ {%- if do_vision_count %}
+ {%- set video_count.value = video_count.value + 1 %}
+ {%- endif %}
+ {%- if add_vision_id %}
+ {{- 'Video ' ~ video_count.value ~ ': ' }}
+ {%- endif %}
+ {{- '<|vision_start|><|video_pad|><|vision_end|>' }}
+ {%- elif 'text' in item %}
+ {{- item.text }}
+ {%- else %}
+ {{- raise_exception('Unexpected item type in content.') }}
+ {%- endif %}
+ {%- endfor %}
+ {%- elif content is none or content is undefined %}
+ {{- '' }}
+ {%- else %}
+ {{- raise_exception('Unexpected content type.') }}
+ {%- endif %}
+{%- endmacro %}
+{%- if not messages %}
+ {{- raise_exception('No messages provided.') }}
+{%- endif %}
+{%- if tools and tools is iterable and tools is not mapping %}
+ {{- '<|im_start|>system\n' }}
+ {{- "# Tools\n\nYou have access to the following functions:\n\n<tools>" }}
+ {%- for tool in tools %}
+ {{- "\n" }}
+ {{- tool | tojson }}
+ {%- endfor %}
+ {{- "\n</tools>" }}
+ {{- '\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>' }}
+ {%- if messages[0].role == 'system' %}
+ {%- set content = render_content(messages[0].content, false, true)|trim %}
+ {%- if content %}
+ {{- '\n\n' + content }}
+ {%- endif %}
+ {%- endif %}
+ {{- '<|im_end|>\n' }}
+{%- else %}
+ {%- if messages[0].role == 'system' %}
+ {%- set content = render_content(messages[0].content, false, true)|trim %}
+ {{- '<|im_start|>system\n' + content + '<|im_end|>\n' }}
+ {%- endif %}
+{%- endif %}
+{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
+{%- for message in messages[::-1] %}
+ {%- set index = (messages|length - 1) - loop.index0 %}
+ {%- if ns.multi_step_tool and message.role == "user" %}
+ {%- set content = render_content(message.content, false)|trim %}
+ {%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}
+ {%- set ns.multi_step_tool = false %}
+ {%- set ns.last_query_index = index %}
+ {%- endif %}
+ {%- endif %}
+{%- endfor %}
+{%- if ns.multi_step_tool %}
+ {{- raise_exception('No user query found in messages.') }}
+{%- endif %}
+{%- for message in messages %}
+ {%- set content = render_content(message.content, true)|trim %}
+ {%- if message.role == "system" %}
+ {%- if not loop.first %}
+ {{- raise_exception('System message must be at the beginning.') }}
+ {%- endif %}
+ {%- elif message.role == "user" %}
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
+ {%- elif message.role == "assistant" %}
+ {%- set reasoning_content = '' %}
+ {%- if message.reasoning_content is string %}
+ {%- set reasoning_content = message.reasoning_content %}
+ {%- else %}
+ {%- if '</think>' in content %}
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
+ {%- endif %}
+ {%- endif %}
+ {%- set reasoning_content = reasoning_content|trim %}
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content + '\n</think>\n\n' + content }}
+ {%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}
+ {%- for tool_call in message.tool_calls %}
+ {%- if tool_call.function is defined %}
+ {%- set tool_call = tool_call.function %}
+ {%- endif %}
+ {%- if loop.first %}
+ {%- if content|trim %}
+ {{- '\n\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
+ {%- else %}
+ {{- '<tool_call>\n<function=' + tool_call.name + '>\n' }}
+ {%- endif %}
+ {%- else %}
+ {{- '\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
+ {%- endif %}
+ {%- if tool_call.arguments is defined %}
+ {%- for args_name, args_value in tool_call.arguments|items %}
+ {{- '<parameter=' + args_name + '>\n' }}
+ {%- set args_value = args_value | string if args_value is string else args_value | tojson | safe %}
+ {{- args_value }}
+ {{- '\n</parameter>\n' }}
+ {%- endfor %}
+ {%- endif %}
+ {{- '</function>\n</tool_call>' }}
+ {%- endfor %}
+ {%- endif %}
+ {{- '<|im_end|>\n' }}
+ {%- elif message.role == "tool" %}
+ {%- if loop.previtem and loop.previtem.role != "tool" %}
+ {{- '<|im_start|>user' }}
+ {%- endif %}
+ {{- '\n<tool_response>\n' }}
+ {{- content }}
+ {{- '\n</tool_response>' }}
+ {%- if not loop.last and loop.nextitem.role != "tool" %}
+ {{- '<|im_end|>\n' }}
+ {%- elif loop.last %}
+ {{- '<|im_end|>\n' }}
+ {%- endif %}
+ {%- else %}
+ {{- raise_exception('Unexpected message role.') }}
+ {%- endif %}
+{%- endfor %}
+{%- if add_generation_prompt %}
+ {{- '<|im_start|>assistant\n' }}
+ {%- if enable_thinking is defined and enable_thinking is false %}
+ {{- '<think>\n\n</think>\n\n' }}
+ {%- else %}
+ {{- '<think>\n' }}
+ {%- endif %}
+{%- endif %}
diff --git a/overbae/services/sft_assets/qwen_templates/ornith15_35b_training.jinja b/overbae/services/sft_assets/qwen_templates/ornith15_35b_training.jinja
new file mode 100644
index 00000000..aa7c94a2
--- /dev/null
+++ b/overbae/services/sft_assets/qwen_templates/ornith15_35b_training.jinja
@@ -0,0 +1,153 @@
+{%- set image_count = namespace(value=0) %}
+{%- set video_count = namespace(value=0) %}
+{%- macro render_content(content, do_vision_count, is_system_content=false) %}
+ {%- if content is string %}
+ {{- content }}
+ {%- elif content is iterable and content is not mapping %}
+ {%- for item in content %}
+ {%- if 'image' in item or 'image_url' in item or item.type == 'image' %}
+ {%- if is_system_content %}
+ {{- raise_exception('System message cannot contain images.') }}
+ {%- endif %}
+ {%- if do_vision_count %}
+ {%- set image_count.value = image_count.value + 1 %}
+ {%- endif %}
+ {%- if add_vision_id %}
+ {{- 'Picture ' ~ image_count.value ~ ': ' }}
+ {%- endif %}
+ {{- '<|vision_start|><|image_pad|><|vision_end|>' }}
+ {%- elif 'video' in item or item.type == 'video' %}
+ {%- if is_system_content %}
+ {{- raise_exception('System message cannot contain videos.') }}
+ {%- endif %}
+ {%- if do_vision_count %}
+ {%- set video_count.value = video_count.value + 1 %}
+ {%- endif %}
+ {%- if add_vision_id %}
+ {{- 'Video ' ~ video_count.value ~ ': ' }}
+ {%- endif %}
+ {{- '<|vision_start|><|video_pad|><|vision_end|>' }}
+ {%- elif 'text' in item %}
+ {{- item.text }}
+ {%- else %}
+ {{- raise_exception('Unexpected item type in content.') }}
+ {%- endif %}
+ {%- endfor %}
+ {%- elif content is none or content is undefined %}
+ {{- '' }}
+ {%- else %}
+ {{- raise_exception('Unexpected content type.') }}
+ {%- endif %}
+{%- endmacro %}
+{%- if not messages %}
+ {{- raise_exception('No messages provided.') }}
+{%- endif %}
+{%- if tools and tools is iterable and tools is not mapping %}
+ {{- '<|im_start|>system\n' }}
+ {{- "# Tools\n\nYou have access to the following functions:\n\n<tools>" }}
+ {%- for tool in tools %}
+ {{- "\n" }}
+ {{- tool | tojson }}
+ {%- endfor %}
+ {{- "\n</tools>" }}
+ {{- '\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>' }}
+ {%- if messages[0].role == 'system' %}
+ {%- set content = render_content(messages[0].content, false, true)|trim %}
+ {%- if content %}
+ {{- '\n\n' + content }}
+ {%- endif %}
+ {%- endif %}
+ {{- '<|im_end|>\n' }}
+{%- else %}
+ {%- if messages[0].role == 'system' %}
+ {%- set content = render_content(messages[0].content, false, true)|trim %}
+ {{- '<|im_start|>system\n' + content + '<|im_end|>\n' }}
+ {%- endif %}
+{%- endif %}
+{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
+{%- for message in messages[::-1] %}
+ {%- set index = (messages|length - 1) - loop.index0 %}
+ {%- if ns.multi_step_tool and message.role == "user" %}
+ {%- set content = render_content(message.content, false)|trim %}
+ {%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}
+ {%- set ns.multi_step_tool = false %}
+ {%- set ns.last_query_index = index %}
+ {%- endif %}
+ {%- endif %}
+{%- endfor %}
+{%- if ns.multi_step_tool %}
+ {{- raise_exception('No user query found in messages.') }}
+{%- endif %}
+{%- for message in messages %}
+ {%- set content = render_content(message.content, true)|trim %}
+ {%- if message.role == "system" %}
+ {%- if not loop.first %}
+ {{- raise_exception('System message must be at the beginning.') }}
+ {%- endif %}
+ {%- elif message.role == "user" %}
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
+ {%- elif message.role == "assistant" %}
+ {%- set reasoning_content = '' %}
+ {%- if message.reasoning_content is string %}
+ {%- set reasoning_content = message.reasoning_content %}
+ {%- else %}
+ {%- if '</think>' in content %}
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
+ {%- endif %}
+ {%- endif %}
+ {%- set reasoning_content = reasoning_content|trim %}
+ {{- '<|im_start|>' + message.role + '\n' }}
+ {%- generation %}
+ {{- '<think>\n' + reasoning_content + '\n</think>\n\n' + content }}
+ {%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}
+ {%- for tool_call in message.tool_calls %}
+ {%- if tool_call.function is defined %}
+ {%- set tool_call = tool_call.function %}
+ {%- endif %}
+ {%- if loop.first %}
+ {%- if content|trim %}
+ {{- '\n\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
+ {%- else %}
+ {{- '<tool_call>\n<function=' + tool_call.name + '>\n' }}
+ {%- endif %}
+ {%- else %}
+ {{- '\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
+ {%- endif %}
+ {%- if tool_call.arguments is defined %}
+ {%- for args_name, args_value in tool_call.arguments|items %}
+ {{- '<parameter=' + args_name + '>\n' }}
+ {%- set args_value = args_value | string if args_value is string else args_value | tojson | safe %}
+ {{- args_value }}
+ {{- '\n</parameter>\n' }}
+ {%- endfor %}
+ {%- endif %}
+ {{- '</function>\n</tool_call>' }}
+ {%- endfor %}
+ {%- endif %}
+ {{- '<|im_end|>\n' }}
+ {%- endgeneration %}
+ {%- elif message.role == "tool" %}
+ {%- if loop.previtem and loop.previtem.role != "tool" %}
+ {{- '<|im_start|>user' }}
+ {%- endif %}
+ {{- '\n<tool_response>\n' }}
+ {{- content }}
+ {{- '\n</tool_response>' }}
+ {%- if not loop.last and loop.nextitem.role != "tool" %}
+ {{- '<|im_end|>\n' }}
+ {%- elif loop.last %}
+ {{- '<|im_end|>\n' }}
+ {%- endif %}
+ {%- else %}
+ {{- raise_exception('Unexpected message role.') }}
+ {%- endif %}
+{%- endfor %}
+{%- if add_generation_prompt %}
+ {{- '<|im_start|>assistant\n' }}
+ {%- if enable_thinking is defined and enable_thinking is false %}
+ {{- '<think>\n\n</think>\n\n' }}
+ {%- else %}
+ {{- '<think>\n' }}
+ {%- endif %}
+{%- endif %}
diff --git a/overbae/services/sft_assets/qwen_templates/ornith15_9b.jinja b/overbae/services/sft_assets/qwen_templates/ornith15_9b.jinja
new file mode 100644
index 00000000..11be7e25
--- /dev/null
+++ b/overbae/services/sft_assets/qwen_templates/ornith15_9b.jinja
@@ -0,0 +1,150 @@
+{%- set image_count = namespace(value=0) %}
+{%- set video_count = namespace(value=0) %}
+{%- macro render_content(content, do_vision_count, is_system_content=false) %}
+ {%- if content is string %}
+ {{- content }}
+ {%- elif content is iterable and content is not mapping %}
+ {%- for item in content %}
+ {%- if 'image' in item or 'image_url' in item or item.type == 'image' %}
+ {%- if is_system_content %}
+ {{- raise_exception('System message cannot contain images.') }}
+ {%- endif %}
+ {%- if do_vision_count %}
+ {%- set image_count.value = image_count.value + 1 %}
+ {%- endif %}
+ {%- if add_vision_id %}
+ {{- 'Picture ' ~ image_count.value ~ ': ' }}
+ {%- endif %}
+ {{- '<|vision_start|><|image_pad|><|vision_end|>' }}
+ {%- elif 'video' in item or item.type == 'video' %}
+ {%- if is_system_content %}
+ {{- raise_exception('System message cannot contain videos.') }}
+ {%- endif %}
+ {%- if do_vision_count %}
+ {%- set video_count.value = video_count.value + 1 %}
+ {%- endif %}
+ {%- if add_vision_id %}
+ {{- 'Video ' ~ video_count.value ~ ': ' }}
+ {%- endif %}
+ {{- '<|vision_start|><|video_pad|><|vision_end|>' }}
+ {%- elif 'text' in item %}
+ {{- item.text }}
+ {%- else %}
+ {{- raise_exception('Unexpected item type in content.') }}
+ {%- endif %}
+ {%- endfor %}
+ {%- elif content is none or content is undefined %}
+ {{- '' }}
+ {%- else %}
+ {{- raise_exception('Unexpected content type.') }}
+ {%- endif %}
+{%- endmacro %}
+{%- if not messages %}
+ {{- raise_exception('No messages provided.') }}
+{%- endif %}
+{%- if tools and tools is iterable and tools is not mapping %}
+ {{- '<|im_start|>system\n' }}
+ {{- "# Tools\n\nYou have access to the following functions:\n\n<tools>" }}
+ {%- for tool in tools %}
+ {{- "\n" }}
+ {{- tool | tojson }}
+ {%- endfor %}
+ {{- "\n</tools>" }}
+ {{- '\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>' }}
+ {%- if messages[0].role == 'system' %}
+ {%- set content = render_content(messages[0].content, false, true)|trim %}
+ {%- if content %}
+ {{- '\n\n' + content }}
+ {%- endif %}
+ {%- endif %}
+ {{- '<|im_end|>\n' }}
+{%- else %}
+ {%- if messages[0].role == 'system' %}
+ {%- set content = render_content(messages[0].content, false, true)|trim %}
+ {{- '<|im_start|>system\n' + content + '<|im_end|>\n' }}
+ {%- endif %}
+{%- endif %}
+{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
+{%- for message in messages[::-1] %}
+ {%- set index = (messages|length - 1) - loop.index0 %}
+ {%- if ns.multi_step_tool and message.role == "user" %}
+ {%- set content = render_content(message.content, false)|trim %}
+ {%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}
+ {%- set ns.multi_step_tool = false %}
+ {%- set ns.last_query_index = index %}
+ {%- endif %}
+ {%- endif %}
+{%- endfor %}
+{%- if ns.multi_step_tool %}
+ {{- raise_exception('No user query found in messages.') }}
+{%- endif %}
+{%- for message in messages %}
+ {%- set content = render_content(message.content, true)|trim %}
+ {%- if message.role == "system" %}
+ {%- if not loop.first %}
+ {{- raise_exception('System message must be at the beginning.') }}
+ {%- endif %}
+ {%- elif message.role == "user" %}
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
+ {%- elif message.role == "assistant" %}
+ {%- set reasoning_content = '' %}
+ {%- if message.reasoning_content is string %}
+ {%- set reasoning_content = message.reasoning_content %}
+ {%- else %}
+ {%- if '</think>' in content %}
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
+ {%- endif %}
+ {%- endif %}
+ {%- set reasoning_content = reasoning_content|trim %}
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content + '\n</think>\n\n' + content }}
+ {%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}
+ {%- for tool_call in message.tool_calls %}
+ {%- if tool_call.function is defined %}
+ {%- set tool_call = tool_call.function %}
+ {%- endif %}
+ {%- if loop.first %}
+ {%- if content|trim %}
+ {{- '\n\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
+ {%- else %}
+ {{- '<tool_call>\n<function=' + tool_call.name + '>\n' }}
+ {%- endif %}
+ {%- else %}
+ {{- '\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
+ {%- endif %}
+ {%- if tool_call.arguments is defined %}
+ {%- for args_name, args_value in tool_call.arguments|items %}
+ {{- '<parameter=' + args_name + '>\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 %}
+ {{- args_value }}
+ {{- '\n</parameter>\n' }}
+ {%- endfor %}
+ {%- endif %}
+ {{- '</function>\n</tool_call>' }}
+ {%- endfor %}
+ {%- endif %}
+ {{- '<|im_end|>\n' }}
+ {%- elif message.role == "tool" %}
+ {%- if loop.previtem and loop.previtem.role != "tool" %}
+ {{- '<|im_start|>user' }}
+ {%- endif %}
+ {{- '\n<tool_response>\n' }}
+ {{- content }}
+ {{- '\n</tool_response>' }}
+ {%- if not loop.last and loop.nextitem.role != "tool" %}
+ {{- '<|im_end|>\n' }}
+ {%- elif loop.last %}
+ {{- '<|im_end|>\n' }}
+ {%- endif %}
+ {%- else %}
+ {{- raise_exception('Unexpected message role.') }}
+ {%- endif %}
+{%- endfor %}
+{%- if add_generation_prompt %}
+ {{- '<|im_start|>assistant\n' }}
+ {%- if enable_thinking is defined and enable_thinking is false %}
+ {{- '<think>\n\n</think>\n\n' }}
+ {%- else %}
+ {{- '<think>\n' }}
+ {%- endif %}
+{%- endif %}
diff --git a/overbae/services/sft_assets/qwen_templates/ornith15_9b_training.jinja b/overbae/services/sft_assets/qwen_templates/ornith15_9b_training.jinja
new file mode 100644
index 00000000..6c1409bd
--- /dev/null
+++ b/overbae/services/sft_assets/qwen_templates/ornith15_9b_training.jinja
@@ -0,0 +1,153 @@
+{%- set image_count = namespace(value=0) %}
+{%- set video_count = namespace(value=0) %}
+{%- macro render_content(content, do_vision_count, is_system_content=false) %}
+ {%- if content is string %}
+ {{- content }}
+ {%- elif content is iterable and content is not mapping %}
+ {%- for item in content %}
+ {%- if 'image' in item or 'image_url' in item or item.type == 'image' %}
+ {%- if is_system_content %}
+ {{- raise_exception('System message cannot contain images.') }}
+ {%- endif %}
+ {%- if do_vision_count %}
+ {%- set image_count.value = image_count.value + 1 %}
+ {%- endif %}
+ {%- if add_vision_id %}
+ {{- 'Picture ' ~ image_count.value ~ ': ' }}
+ {%- endif %}
+ {{- '<|vision_start|><|image_pad|><|vision_end|>' }}
+ {%- elif 'video' in item or item.type == 'video' %}
+ {%- if is_system_content %}
+ {{- raise_exception('System message cannot contain videos.') }}
+ {%- endif %}
+ {%- if do_vision_count %}
+ {%- set video_count.value = video_count.value + 1 %}
+ {%- endif %}
+ {%- if add_vision_id %}
+ {{- 'Video ' ~ video_count.value ~ ': ' }}
+ {%- endif %}
+ {{- '<|vision_start|><|video_pad|><|vision_end|>' }}
+ {%- elif 'text' in item %}
+ {{- item.text }}
+ {%- else %}
+ {{- raise_exception('Unexpected item type in content.') }}
+ {%- endif %}
+ {%- endfor %}
+ {%- elif content is none or content is undefined %}
+ {{- '' }}
+ {%- else %}
+ {{- raise_exception('Unexpected content type.') }}
+ {%- endif %}
+{%- endmacro %}
+{%- if not messages %}
+ {{- raise_exception('No messages provided.') }}
+{%- endif %}
+{%- if tools and tools is iterable and tools is not mapping %}
+ {{- '<|im_start|>system\n' }}
+ {{- "# Tools\n\nYou have access to the following functions:\n\n<tools>" }}
+ {%- for tool in tools %}
+ {{- "\n" }}
+ {{- tool | tojson }}
+ {%- endfor %}
+ {{- "\n</tools>" }}
+ {{- '\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>' }}
+ {%- if messages[0].role == 'system' %}
+ {%- set content = render_content(messages[0].content, false, true)|trim %}
+ {%- if content %}
+ {{- '\n\n' + content }}
+ {%- endif %}
+ {%- endif %}
+ {{- '<|im_end|>\n' }}
+{%- else %}
+ {%- if messages[0].role == 'system' %}
+ {%- set content = render_content(messages[0].content, false, true)|trim %}
+ {{- '<|im_start|>system\n' + content + '<|im_end|>\n' }}
+ {%- endif %}
+{%- endif %}
+{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
+{%- for message in messages[::-1] %}
+ {%- set index = (messages|length - 1) - loop.index0 %}
+ {%- if ns.multi_step_tool and message.role == "user" %}
+ {%- set content = render_content(message.content, false)|trim %}
+ {%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}
+ {%- set ns.multi_step_tool = false %}
+ {%- set ns.last_query_index = index %}
+ {%- endif %}
+ {%- endif %}
+{%- endfor %}
+{%- if ns.multi_step_tool %}
+ {{- raise_exception('No user query found in messages.') }}
+{%- endif %}
+{%- for message in messages %}
+ {%- set content = render_content(message.content, true)|trim %}
+ {%- if message.role == "system" %}
+ {%- if not loop.first %}
+ {{- raise_exception('System message must be at the beginning.') }}
+ {%- endif %}
+ {%- elif message.role == "user" %}
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
+ {%- elif message.role == "assistant" %}
+ {%- set reasoning_content = '' %}
+ {%- if message.reasoning_content is string %}
+ {%- set reasoning_content = message.reasoning_content %}
+ {%- else %}
+ {%- if '</think>' in content %}
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
+ {%- endif %}
+ {%- endif %}
+ {%- set reasoning_content = reasoning_content|trim %}
+ {{- '<|im_start|>' + message.role + '\n' }}
+ {%- generation %}
+ {{- '<think>\n' + reasoning_content + '\n</think>\n\n' + content }}
+ {%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}
+ {%- for tool_call in message.tool_calls %}
+ {%- if tool_call.function is defined %}
+ {%- set tool_call = tool_call.function %}
+ {%- endif %}
+ {%- if loop.first %}
+ {%- if content|trim %}
+ {{- '\n\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
+ {%- else %}
+ {{- '<tool_call>\n<function=' + tool_call.name + '>\n' }}
+ {%- endif %}
+ {%- else %}
+ {{- '\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
+ {%- endif %}
+ {%- if tool_call.arguments is defined %}
+ {%- for args_name, args_value in tool_call.arguments|items %}
+ {{- '<parameter=' + args_name + '>\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 %}
+ {{- args_value }}
+ {{- '\n</parameter>\n' }}
+ {%- endfor %}
+ {%- endif %}
+ {{- '</function>\n</tool_call>' }}
+ {%- endfor %}
+ {%- endif %}
+ {{- '<|im_end|>\n' }}
+ {%- endgeneration %}
+ {%- elif message.role == "tool" %}
+ {%- if loop.previtem and loop.previtem.role != "tool" %}
+ {{- '<|im_start|>user' }}
+ {%- endif %}
+ {{- '\n<tool_response>\n' }}
+ {{- content }}
+ {{- '\n</tool_response>' }}
+ {%- if not loop.last and loop.nextitem.role != "tool" %}
+ {{- '<|im_end|>\n' }}
+ {%- elif loop.last %}
+ {{- '<|im_end|>\n' }}
+ {%- endif %}
+ {%- else %}
+ {{- raise_exception('Unexpected message role.') }}
+ {%- endif %}
+{%- endfor %}
+{%- if add_generation_prompt %}
+ {{- '<|im_start|>assistant\n' }}
+ {%- if enable_thinking is defined and enable_thinking is false %}
+ {{- '<think>\n\n</think>\n\n' }}
+ {%- else %}
+ {{- '<think>\n' }}
+ {%- endif %}
+{%- endif %}
diff --git a/overbae/services/sft_assets/training_chat_template.py b/overbae/services/sft_assets/training_chat_template.py
index 77be170b..ed3ba627 100644
--- a/overbae/services/sft_assets/training_chat_template.py
+++ b/overbae/services/sft_assets/training_chat_template.py
@@ -16,6 +16,7 @@ KNOWN_TEMPLATE_PATCHES: tuple[tuple[str, str], ...] = (
("olmo_templates/olmo3.jinja", "olmo_templates/olmo3_training.jinja"),
("qwen_templates/qwen3_coder.jinja", "qwen_templates/qwen3_coder_training.jinja"),
("gemma_templates/gemma4_e2b.jinja", "gemma_templates/gemma4_e2b_training.jinja"),
+ ("gemma_templates/bolt_e4b.jinja", "gemma_templates/bolt_e4b_training.jinja"),
("gemma_templates/gemma4_12b.jinja", "gemma_templates/gemma4_12b_training.jinja"),
("gpt_oss_templates/gpt_oss_unsloth.jinja", "gpt_oss_templates/gpt_oss_unsloth_training.jinja"),
("muse_templates/muse.jinja", "muse_templates/muse_training.jinja"),
@@ -26,6 +27,8 @@ KNOWN_TEMPLATE_PATCHES: tuple[tuple[str, str], ...] = (
("qwen_templates/qwen3_unsloth_06b.jinja", "qwen_templates/qwen3_unsloth_06b_training.jinja"),
("qwen_templates/qwen3_unsloth.jinja", "qwen_templates/qwen3_unsloth_training.jinja"),
("qwen_templates/qwen35_unsloth_08b.jinja", "qwen_templates/qwen35_unsloth_08b_training.jinja"),
+ ("qwen_templates/ornith15_9b.jinja", "qwen_templates/ornith15_9b_training.jinja"),
+ ("qwen_templates/ornith15_35b.jinja", "qwen_templates/ornith15_35b_training.jinja"),
("qwen_templates/qwen35_unsloth_4b.jinja", "qwen_templates/qwen35_unsloth_4b_training.jinja"),
("qwen_templates/qwen36_unsloth.jinja", "qwen_templates/qwen36_unsloth_training.jinja"),
("qwen_templates/qwen38_unsloth.jinja", "qwen_templates/qwen38_unsloth_training.jinja"),
diff --git a/tests/test_modelfam.py b/tests/test_modelfam.py
index fe09e9e6..b78ba964 100644
--- a/tests/test_modelfam.py
+++ b/tests/test_modelfam.py
@@ -47,6 +47,7 @@ _ORDERING = [
("LiquidAI/LFM2.5-1.2B-Instruct", "lfm2"),
("mistralai/Ministral-3-3B-Instruct-2512", "ministral"),
("fdtn-ai/antares-1b", "antares"),
+ ("nvidia/NVIDIA-Nemotron-3.5-Bolt-E4B-BF16", "bolt"),
("ibm-granite/granite-4.0-h-tiny", "antares"),
("nvidia/NVIDIA-Nemotron-3.5-Lightning-30B-A3B", "nemotron35"),
("unsloth/NVIDIA-Nemotron-3.5-Lightning-30B-A3B", "nemotron35"),
@@ -59,6 +60,9 @@ _ORDERING = [
("Qwen/Qwen3-Coder-30B-A3B-Instruct", "qwen3_coder"),
("Qwen/Qwen2.5-VL-7B-Instruct", "qwen_mm"),
("Qwen/Qwen3-8B", "qwen"),
+ ("ornith-ai/Ornith-1.5-9B", "qwen35"),
+ ("ornith-ai/Ornith-1.5-35B-A3B", "qwen35"),
+ ("microsoft/Fara1.5-27B", "qwen35"),
("allenai/Olmo-3-7B-Instruct", "olmo"),
("totally/unknown-model", "unknown"),
]
diff --git a/tests/test_sft_gemma4_hooks.py b/tests/test_sft_gemma4_hooks.py
index 1f1282a9..f86b8c93 100644
--- a/tests/test_sft_gemma4_hooks.py
+++ b/tests/test_sft_gemma4_hooks.py
@@ -10,6 +10,17 @@ pytestmark = pytest.mark.covers("model-runtime")
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "overbae" / "services" / "sft_assets"))
+def test_bolt_lora_leaves_checkpointing_off(monkeypatch):
+ monkeypatch.setenv("MODEL_ID", "nvidia/NVIDIA-Nemotron-3.5-Bolt-E4B-BF16")
+ from families.bolt import hooks
+
+ assert hooks.peft_gradient_checkpointing() is False
+ cfg = hooks.sft_config_overrides(use_lora=True)
+ assert cfg["gradient_checkpointing"] is False
+ assert cfg["optim"] == "adamw_8bit"
+ assert hooks.load_kwargs(use_lora=True)["attn_implementation"] == "sdpa"
+
+
def test_e2b_lora_enables_torch_gc(monkeypatch):
monkeypatch.setenv("MODEL_ID", "unsloth/gemma-4-E2B-it")
from families.gemma4 import hooks
diff --git a/tests/test_sft_training_chat_template.py b/tests/test_sft_training_chat_template.py
index bd886f2f..da9d7ab3 100644
--- a/tests/test_sft_training_chat_template.py
+++ b/tests/test_sft_training_chat_template.py
@@ -91,6 +91,44 @@ def test_every_training_template_compiles() -> None:
env.from_string(src)
+def test_ornith_training_templates_match_base() -> None:
+ env = _generation_env()
+ cases = [
+ [
+ {"role": "user", "content": "What is 2+2?"},
+ {"role": "assistant", "content": "4"},
+ ],
+ [
+ {"role": "user", "content": "first"},
+ {"role": "assistant", "content": "old", "reasoning_content": "kept"},
+ {"role": "user", "content": "second"},
+ {"role": "assistant", "content": "now"},
+ ],
+ [
+ {"role": "user", "content": "lookup"},
+ {
+ "role": "assistant",
+ "content": "",
+ "tool_calls": [{"function": {"name": "lookup", "arguments": {"q": "2+2", "n": 1}}}],
+ },
+ ],
+ ]
+ for stem in ("ornith15_9b", "ornith15_35b"):
+ base = env.from_string((_ASSETS / "qwen_templates" / f"{stem}.jinja").read_text())
+ training = env.from_string(
+ (_ASSETS / "qwen_templates" / f"{stem}_training.jinja").read_text()
+ )
+ for messages in cases:
+ for prompt in (False, True):
+ kwargs = {
+ "messages": messages,
+ "tools": None,
+ "add_generation_prompt": prompt,
+ "enable_thinking": False,
+ }
+ assert base.render(**kwargs) == training.render(**kwargs)
+
+
def test_qwen38_training_template_compiles_and_matches_base() -> None:
env = _generation_env()
base = (_ASSETS / "qwen_templates/qwen38_unsloth.jinja").read_text(encoding="utf-8")
@@ -106,6 +144,37 @@ def test_qwen38_training_template_compiles_and_matches_base() -> None:
assert env.from_string(base).render(**kwargs) == env.from_string(training).render(**kwargs)
+def test_bolt_e4b_training_matches_base() -> None:
+ env = _generation_env()
+ base = env.from_string((_ASSETS / "gemma_templates/bolt_e4b.jinja").read_text())
+ training = env.from_string((_ASSETS / "gemma_templates/bolt_e4b_training.jinja").read_text())
+ cases = [
+ [
+ {"role": "user", "content": "What is 2+2?"},
+ {"role": "assistant", "content": "4"},
+ ],
+ [
+ {"role": "user", "content": "lookup"},
+ {
+ "role": "assistant",
+ "content": "checking",
+ "tool_calls": [{"function": {"name": "lookup", "arguments": {"q": "2+2"}}}],
+ },
+ {"role": "tool", "name": "lookup", "content": "4"},
+ {"role": "assistant", "content": "4"},
+ ],
+ ]
+ for messages in cases:
+ for prompt in (False, True):
+ kwargs = {
+ "messages": messages,
+ "tools": None,
+ "add_generation_prompt": prompt,
+ "enable_thinking": False,
+ }
+ assert base.render(**kwargs) == training.render(**kwargs)
+
+
def test_gemma4_e2b_training_matches_base() -> None:
env = _generation_env()
base = (_ASSETS / "gemma_templates/gemma4_e2b.jinja").read_text(encoding="utf-8")