Downloads · 30 days
147
27% of all-time downloads
rautaditya/qwen2.5-0.5B-toolcall-mlx
qwen2.5-0.5B-toolcall-mlx is a text generation model from rautaditya. Use it when you need the model to write or continue text. It is set up for mlx.
Full fused MLX weights for a tool-calling SFT study: Qwen2.5-0.5B-Instruct + LoRA (rank 16) fused, best-val checkpoint (iter-300, val 0.102). No adapter needed at inference. Apple Silicon via mlx-lm. Project + trainin…
Downloads · 30 days
147
27% of all-time downloads
All-time downloads
550
Public
Parameters
494M
1000 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors988 MB · 99%
From the Hugging Face model README
Full fused MLX weights for a tool-calling SFT study: Qwen2.5-0.5B-Instruct + LoRA (rank 16) fused,
best-val checkpoint (iter-300, val 0.102). No adapter needed at inference. Apple Silicon via mlx-lm.
Project + training code: see GitHub repo qwen-tool-sft-mlx (prepare_data.py, train.sh, eval.py, eval_benchmark.py, agent.py).
get_weather: {"city": str (required), "unit": "celsius" | "fahrenheit" (optional)}calculator: {"expression": str} — emits canonical symbol form (144 / 12, keeps parens).Call format: <tool_call>{"name": ..., "arguments": {...}}</tool_call>. Missing args -> ask
(Which city should I look up?), never hallucinate. Same apply_chat_template(msgs, tools=...) everywhere.
from mlx_lm import load, generate
from mlx_lm.sample_utils import make_sampler
model, tok = load("rautaditya/qwen2.5-0.5B-toolcall-mlx")
TOOLS = [
{"type": "function", "function": {"name": "get_weather",
"description": "Get current temperature and conditions for a city.",
"parameters": {"type": "object",
"properties": {"city": {"type": "string"},
"unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}},
"required": ["city"]}}},
{"type": "function", "function": {"name": "calculator",
"description": "Evaluate basic arithmetic.",
"parameters": {"type": "object", "properties": {"expression": {"type": "string"}},
"required": ["expression"]}}},
]
prompt = tok.apply_chat_template(
[{"role": "user", "content": "Compute 47 * 13"}],
tools=[TOOLS[1]], tokenize=False, add_generation_prompt=True)
print(generate(model, tok, prompt=prompt, max_tokens=100, sampler=make_sampler(temp=0.0)))
# <tool_call>
# {"name": "calculator", "arguments": {"expression": "47 * 13"}}
# </tool_call>
Qwen/Qwen2.5-0.5B-Instruct (full precision), LoRA rank=16, scale=20.0, dropout=0.05,
lr=1e-4, batch 1, 16 layers, 800 iters. Trainable 1.187% (5.865M/494.033M). Data: 101 train / 11 valid / 4 test.2.717 (it1) -> 0.159 (50) -> 0.115 (100) -> 0.102 (300, BEST) -> 0.103 (400) -> 0.118 (800).
Train loss 0.552 -> 0.027 kept falling after val plateaued = overfit past ~300.0000300_adapters.safetensors + base, fp16, ~942 MB).8-case strict eval.py: base score 0.688 / name 0.750 -> LoRA 1.000 / 1.000
(fixed dropped parens, 81/9 -> get_weather misfire, New York hallucination on clarify).
22-case held-out eval_benchmark.py (unseen cities/numbers, greedy):
| model | score | name | calc | clarify | no_tool | pick | weather | tricky |
|---|---|---|---|---|---|---|---|---|
| base | 0.682 | 0.727 | 0.667 | 0.250 | 0.750 | 1.000 | 0.750 | 1.000 |
| lora | 0.864 | 0.955 | 1.000 | 1.000 | 1.000 | 1.000 | 0.500 | 0.500 |
Reykjavik -> Reykur, Lima -> Lisbon): train vocab was ~22 cities.Is it raining in Paris? -> asks city)."unit": "fahrenheit"; this model omits unit unless asked (correct).no_tool answers are short SFT strings, not grounded (trivia can be factually wrong); no RAG.