Downloads · 30 days
10
42% of all-time downloads
balaguhanesh/tool-call-ft
tool-call-ft is a text generation model from balaguhanesh. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
A QLoRA LoRA adapter that teaches Qwen/Qwen2.5-3B-Instruct to emit reliable, schema-correct tool calls in the compact {"name": ..., "arguments": {...}} format.
Downloads · 30 days
10
42% of all-time downloads
All-time downloads
24
Public
Repo size
131 MB
Likes
0
Public
Click a slice to open those files.
.safetensors120 MB · 91%
From the Hugging Face model README
A QLoRA LoRA adapter that teaches Qwen/Qwen2.5-3B-Instruct to emit reliable,
schema-correct tool calls in the compact {"name": ..., "arguments": {...}}
format.
Code, training staircase, and eval harness: https://github.com/balaguhanesh/tool-call-ft
Base vs. this adapter on 300 held-out examples (greedy decoding, strict exact-match grader):
| Metric | Base | Fine-tuned | Δ |
|---|---|---|---|
| JSON-valid rate | 51.7% | 100.0% | +48.3 |
| Function-name accuracy | 1.0% | 100.0% | +99.0 |
| Argument match (exact) | 0.3% | 95.0% | +94.7 |
The grader is strict: unparseable output fails all three axes, function name is
exact/case-sensitive, and arguments require exact dict equality ("5" != 5, any
extra/missing key fails the row). Fine-tuning here teaches format compliance and
schema discipline, not reasoning.
bitsandbytes), LoRA via peft
(r=16, α=32, all attention + MLP projections; ~30M trainable params, 0.96%)trl.SFTTrainer (supervised fine-tuning)glaiveai/glaive-function-calling-v2 → 2000 train / 300 evalfrom peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base = "Qwen/Qwen2.5-3B-Instruct"
tok = AutoTokenizer.from_pretrained(base)
model = AutoModelForCausalLM.from_pretrained(base, device_map="auto")
model = PeftModel.from_pretrained(model, "Balaguhanesh/tool-call-ft")
messages = [
{"role": "system", "content": "You are a helpful assistant with access to the following functions. Use them if required -\n{...function schema...}"},
{"role": "user", "content": "What's the weather in Paris?"},
]
inputs = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt", return_dict=True).to(model.device)
out = model.generate(**inputs, max_new_tokens=128, do_sample=False)
print(tok.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))