Run this model with HF Jobs
Run monte-inc/gemma4-26b-a4b-banking-sft-v3 on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/monte-inc/gemma4-26b-a4b-banking-sft-v3. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/monte-inc/gemma4-26b-a4b-banking-sft-v3 on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use monte-inc/gemma4-26b-a4b-banking-sft-v3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use monte-inc/gemma4-26b-a4b-banking-sft-v3 with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/gemma-4-26B-A4B-it") model = PeftModel.from_pretrained(base_model, "monte-inc/gemma4-26b-a4b-banking-sft-v3") - Notebooks
- Google Colab
- Kaggle
gemma4-26b-a4b-banking-sft-v3
QLoRA adapter for unsloth/gemma-4-26B-A4B-it trained on the tau2-bench
banking_knowledge v2 data (Claude Opus/Sonnet + GPT-5.2 trajectories with
reasoning traces).
Training
- Framework: axolotl 0.16.1 (pivoted off Unsloth due to unsloth#4907 โ broken MoE expert LoRA targeting)
- Config:
training/axolotl/gemma4_banking.yamlinMonte-Inc/tau2-banking-sft - Hardware: H100 PCIe 80 GB (amd64)
- Runtime: 1 epoch, 563 steps, ~2h47m
- Rank 32 QLoRA, seq_len 5120, ScatterMoE, bf16 base + 4-bit quant experts at load time, adamw_torch_8bit, lr 2e-4, cosine schedule, warmup 0.1
- LoRA targets: attention
{q,k,v,o,up,down,gate}_projregex + MoE expert 3D fused params (experts.gate_up_proj,experts.down_proj) - Final eval_loss: 0.77 (step 50)
Repo contents
adapter_model.safetensors(3.96 GB) โ PEFT LoRA weightsadapter_config.jsonโtarget_parameters: [experts.gate_up_proj, experts.down_proj]chat_template.jinjaโ Google's native 347-line Gemma 4 template (rendersreasoning_contentas<|channel>thought\n...<channel|>) โ not the older 266-line template shipped withunsloth/gemma-4-26B-A4B-it/tokenizer_config.jsontokenizer.json,tokenizer_config.json,config.json,processor_config.json
Inference setup (tested on vLLM 0.19.0, amd64)
Merge the adapter
# Requires axolotl 0.16.1 + transformers 5.5.0 in a dedicated venv
# (vllm 0.19.0 pins transformers<5 which breaks the merge)
python -m venv ~/merge-venv
~/merge-venv/bin/pip install axolotl==0.16.1
export AXOLOTL_DO_NOT_TRACK=1 # axolotl 0.16.1 wheel is missing whitelist.yaml
# Use a merge yaml with: adapter=lora, load_in_4bit=false, quantize_moe_experts removed
~/merge-venv/bin/axolotl merge-lora /tmp/merge.yaml
Serve with vLLM
# vllm 0.19.0 has Gemma 4 in its own registry but still needs transformers
# to resolve the AutoConfig, so force transformers 5.5.0 via --no-deps:
~/vllm-venv/bin/pip install --no-deps transformers==5.5.0
~/vllm-venv/bin/pip install --upgrade huggingface_hub # โ 1.10+
vllm serve /path/to/merged-gemma4-sft \
--served-model-name gemma4-banking-sft \
--host 0.0.0.0 --port 8000 \
--dtype bfloat16 \
--max-model-len 100000 \
--gpu-memory-utilization 0.90 \
--tool-call-parser gemma4 \
--reasoning-parser gemma4 \
--enable-auto-tool-choice \
--default-chat-template-kwargs '{"enable_thinking":true}'
Known issues + required patches for serving
Template's string-arg branch is broken for litellm/OpenAI requests. tau2-bench / litellm sends
tool_calls[].function.argumentsas a JSON string, but the template's string branch just echoes it, producing{{"account_id":"A1"}}(double braces) instead of the Gemma format{account_id:<|"|>A1<|"|>}. Fix: inchat_template.jinja, replace the tool_call arguments block with:{%- set args = function['arguments'] -%} {%- if args is string -%} {%- set args = args | fromjson -%} {%- endif -%} {%- if args is mapping -%} {%- set ns_args = namespace(found_first=false) -%} {%- for key, value in args | dictsort -%} {%- if ns_args.found_first %},{% endif -%} {%- set ns_args.found_first = true -%} {{- key -}}:{{- format_argument(value, escape_keys=False) -}} {%- endfor -%} {%- endif -%}Then register a
fromjsonfilter in transformers' chat template utils:# in transformers/utils/chat_template_utils.py, near where tojson is set: jinja_env.filters["fromjson"] = lambda x: __import__("json").loads(x) if isinstance(x, str) else xSFT model skips thinking by default at T=0. Only ~75% of reasoning-bearing training examples had reasoning rendered, so the greedy prior is to jump straight to
<|tool_call>. Symptom: model loops on the same tool call indefinitely (hits max_steps). Fix: in the generation-prompt block ofchat_template.jinja, force<|channel>thought\non both the initial turn and continuation after tool responses whenenable_thinking=True:{%- if add_generation_prompt -%} {%- if ns.prev_message_type != 'tool_response' and ns.prev_message_type != 'tool_call' -%} {{- '<|turn>model\n' -}} {%- if enable_thinking | default(false) -%} {{- '<|channel>thought\n' -}} {%- else -%} {{- '<|channel>thought\n<channel|>' -}} {%- endif -%} {%- elif ns.prev_message_type == 'tool_response' and enable_thinking | default(false) -%} {#- force thinking on continuation to avoid tool-call loops -#} {{- '<|channel>thought\n' -}} {%- endif -%} {%- endif -%}
Baselines to compare against
| Run | Pass rate (banking_knowledge, gpt-5.2 user, terminal_use) |
|---|---|
| Gemma 4 26B MoE base (thinking) | 13.9% (53/382) |
| Qwen v6 SFT (thinking) | 13.8% |
tau2-bench eval command
tau2 run --domain banking_knowledge \
--agent-llm openai/gemma4-banking-sft \
--agent-llm-args '{"api_base":"http://localhost:8000/v1","temperature":0.0}' \
--user-llm gpt-5.2 \
--retrieval-config terminal_use \
--max-concurrency 10 --num-trials 4 --max-steps 200 \
--seed 42 --max-retries 3 \
--save-to gemma4-sft-v3-4t-test
- Downloads last month
- 14
Model tree for monte-inc/gemma4-26b-a4b-banking-sft-v3
Base model
google/gemma-4-26B-A4B