Run this model with HF Jobs
Run giux78/zagreus-3B-sft-v4-rl-tooluse 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 and TRL to fine-tune https://huggingface.co/giux78/zagreus-3B-sft-v4-rl-tooluse. 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/giux78/zagreus-3B-sft-v4-rl-tooluse 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.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/giux78/zagreus-3B-sft-v4-rl-tooluse. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/giux78/zagreus-3B-sft-v4-rl-tooluse. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use giux78/zagreus-3B-sft-v4-rl-tooluse with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use giux78/zagreus-3B-sft-v4-rl-tooluse with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="giux78/zagreus-3B-sft-v4-rl-tooluse") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("giux78/zagreus-3B-sft-v4-rl-tooluse") model = AutoModelForCausalLM.from_pretrained("giux78/zagreus-3B-sft-v4-rl-tooluse", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use giux78/zagreus-3B-sft-v4-rl-tooluse with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "giux78/zagreus-3B-sft-v4-rl-tooluse" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "giux78/zagreus-3B-sft-v4-rl-tooluse", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/giux78/zagreus-3B-sft-v4-rl-tooluse
- SGLang
How to use giux78/zagreus-3B-sft-v4-rl-tooluse with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "giux78/zagreus-3B-sft-v4-rl-tooluse" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "giux78/zagreus-3B-sft-v4-rl-tooluse", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "giux78/zagreus-3B-sft-v4-rl-tooluse" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "giux78/zagreus-3B-sft-v4-rl-tooluse", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use giux78/zagreus-3B-sft-v4-rl-tooluse with Docker Model Runner:
docker model run hf.co/giux78/zagreus-3B-sft-v4-rl-tooluse
zagreus-3B-sft-v4-rl-tooluse
zagreus-3B is a 3B-parameter bilingual (Italian / English) language model trained from scratch.
This is a tool-use reinforcement-learning update of giux78/zagreus-3B-sft-v4-rl-math,
which is itself a math RL update of giux78/zagreus-3B-sft-v4.
Status: the license and the final recipe are not decided yet. It improves tool calling and instruction following. It is not better at everything: see the limits below.
Training
- Method: GRPO-style RL with palingenesis (
pgs rl), on 8 AMD MI250X GPU dies. - Start: the math RL model above (not SFT v4).
- Data: 9,600 prompts in six families, each with its own verifier:
- single tool call (2,400) and several calls in one turn (1,200);
- a message to the user instead of a call (2,400) and no tool fits the request (1,200);
- instructions with verifiable constraints (1,200);
- GSM8K math (1,200). Tool rows come from the Nemotron agentic tool-calling data. Rows overlapping the test prompts (our suites, BFCL, IFEval, GSM8K) were removed.
- Reward for calls: calls are paired with the expected ones in the best possible way, order does not matter. Each call scores 0 for a wrong tool, otherwise 0.4 plus 0.6 times the share of matching arguments. Long free-text arguments only need to be filled in. A wrong number of calls can never reach the pass mark; a malformed call scores 0.
- Settings: 200 steps, learning rate 1e-6, groups of 8 samples, 4,096 new tokens at most, 32-bit master weights, published in bfloat16.
- A first attempt that rewarded exactly one call per turn lost parallel calls entirely (BFCL parallel 0.0) and called tools when none fit. It is not released. This version fixes the reward and adds the multi-call and "no tool fits" examples.
Evaluation
Same scripts for all models, greedy decoding, one training run; run-to-run variation was not measured.
The evaluations loaded the 32-bit final weights in bfloat16, which is the conversion used for these files. As a check, the no-think math tests were run again on the saved files: 69.4 (GSM8K English), 61.1 (GSM8K Italian) and 34.2 (MATH-500), within chance of the values below.
"Math model" is giux78/zagreus-3B-sft-v4-rl-math.
Tool calling: BFCL (4,425 cases, our scoring)
| Category | Math model (coherent / bare) | This model (coherent / bare) |
|---|---|---|
| Overall | 40.1 / 38.8 | 41.7 / 42.0 |
| parallel | 76.5 / 68.5 | 79.5 / 75.0 |
| parallel_multiple | 61.0 / 31.0 | 66.0 / 48.0 |
| live_parallel_multiple | 54.2 / 33.3 | 62.5 / 54.2 |
| live_parallel | 68.8 / 43.8 | 56.2 / 56.2 |
| simple_python | 88.8 / 84.5 | 91.0 / 88.5 |
| multiple | 87.5 / 88.5 | 87.0 / 89.5 |
| irrelevance (no tool fits) | 75.0 / 77.9 | 76.7 / 78.3 |
| live_irrelevance | 85.3 / 86.9 | 81.7 / 83.8 |
| multi-turn (800) | 8.8 / 9.8 | 11.1 / 13.0 |
BFCL overall has a standard error of about 0.7 points; the live_parallel categories have 16 cases each.
Agents, instructions and knowledge
| Test | Math model | This model |
|---|---|---|
| Internal agent suites: English / Italian / v4 | 62.5 / 65.9 / 64.7 | 64.5 / 66.7 / 64.9 |
| WorkBench | 16.9 | 19.6 |
| IFEval, prompt-level strict | 65.8 | 72.3 |
| IFEval, instruction-level strict | 74.3 | 80.1 |
| MMLU / MMLU Italian (5-shot) | 55.1 / 51.6 | 55.1 / 51.5 |
| HellaSwag / Italian (acc_norm) | 66.3 / 60.6 | 66.4 / 60.8 |
| ARC-Challenge / Italian (acc_norm) | 47.0 / 45.5 | 47.0 / 46.2 |
| HumanEval / MBPP (pass@1) | 46.3 / 36.2 | 43.9 / 35.4 |
The IFEval gain is paired over the same prompts (56 prompts gained, 22 lost, p = 0.0001). Part of it is teaching to the test: the RL data uses IFEval-type constraints.
Math (accuracy %, full test sets)
| Test | Mode | Math model | This model |
|---|---|---|---|
| GSM8K English (1,319) | think | 75.0 | 76.8 |
| GSM8K Italian (1,319) | think | 68.1 | 68.5 |
| MATH-500 | think | 45.2 | 46.4 |
| GSM8K English | no-think | 69.4 | 68.6 |
| GSM8K Italian | no-think | 59.7 | 61.6 |
| MATH-500 | no-think | 43.8 | 34.6 |
Differences in think mode are within chance on a paired test. The no-think MATH-500 drop is real (p < 0.001).
Limits
- No-think MATH-500 is 9.2 points lower than the math model, and 13.4% of its answers are cut off at the length limit.
- Deciding whether to call a tool: in our agent suites the model replies in text when it should call a tool a little more often than the math model (the call decision is 1.5 to 6 points lower, in English 91.3 to 85.1). It also replies in text more correctly when no call is needed.
- HumanEval is 2.4 points lower (one run of 164 problems).
- BFCL:
live_parallelin the coherent prompt is 12.6 points lower (16 cases). Multi-turn is better than the math model but still low (11 to 13%). - Training data: the expected parallel calls come from agent traces and some are incomplete. The "no tool fits" training cases are easier than BFCL's. The tool data may overlap the SFT v4 data.
- Think mode can still run to the length limit on harder problems.
How to use
- Llama-3 headers; turns end with
<|eot_id|>. - Thinking switch: the system message ends with
/thinkor/no_think. With the included chat template, passenable_thinking=Trueto switch thinking on; the default is off. - Tools: pass
tools=[...]to the chat template; calls are written as<tool_call>{"name": ..., "arguments": {...}}</tool_call>, one block per call.
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "giux78/zagreus-3B-sft-v4-rl-tooluse"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, dtype="bfloat16", device_map="auto")
tools = [{"type": "function", "function": {"name": "get_weather", "description": "Weather in a city",
"parameters": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]}}}]
msgs = [{"role": "user", "content": "Che tempo fa a Roma e a Milano?"}]
ids = tok.apply_chat_template(msgs, tools=tools, add_generation_prompt=True, return_tensors="pt", return_dict=True).to(model.device)
out = model.generate(**ids, max_new_tokens=512, do_sample=False)
print(tok.decode(out[0][ids["input_ids"].shape[1]:], skip_special_tokens=True))
- Downloads last month
- 603