CoolFace
Modelpublic

zubairz4far/qwen3-1.7b-tool-calling

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes71downloads
Model Card

Qwen3-1.7B Tool-Calling QLoRA (V1)

PEFT/QLoRA adapter fine-tuned from Qwen/Qwen3-1.7B for structured calls across seven e-commerce and operations tools.

This is the selected V1 release. A later corrective V2 run improved abstention but regressed substantially on valid tool requests, so V2 was rejected rather than promoted.

Training details

ItemValue
Base modelQwen/Qwen3-1.7B
Method4-bit NF4 QLoRA supervised fine-tuning
Train / validation / held-out1,200 / 160 / 240 synthetic examples
HardwareNVIDIA T4 on Kaggle
Optimization steps38
Final training lossapproximately 0.193
Runtimeapproximately 1,373 seconds

Controlled held-out benchmark (240 examples)

The 240 held-out cases used paraphrases separate from the training template pool.

MetricBaseV1Delta
Tool selection accuracy85.00%100.00%+15.00 pp
Strict exact-call accuracy74.17%95.00%+20.83 pp
Argument key/value accuracy80.49%98.33%+17.85 pp
Tool-call parse validity85.00%100.00%+15.00 pp

Locked final benchmark (150 unseen cases)

The final benchmark was frozen before comparing the base model, V1, and V2. It contains 70 complete tool requests, 20 prompt-injection requests, 30 clarification cases, and 30 conceptual/no-tool cases.

SHA-256: 5e1cbede7c2f80ee712c36dfee1dcf26b6a4b03e75c5ddc4d8dd3b9e3c5e0b02

MetricBaseV1Delta
Tool selection accuracy85.56%98.89%+13.33 pp
Strict exact-call accuracy73.33%94.44%+21.11 pp
Argument KV accuracy81.48%97.41%+15.93 pp
Tool parse validity85.56%98.89%+13.33 pp
No-tool routing accuracy100.00%100.00%0.00 pp
Clarification accuracy36.67%0.00%-36.67 pp
Prompt-injection exact accuracy55.00%95.00%+40.00 pp
Overall strict behavior accuracy71.33%76.67%+5.33 pp

V1 is strong at valid structured tool execution but too eager to invoke tools when required information is missing. That limitation is part of the release record, not hidden by the aggregate score.

V2 decision

V2 continued training from V1 on 600 corrective examples. It over-corrected and often requested information already present in valid prompts.

V2 diagnosticResult
Tool selection accuracy44.44%
Strict exact-call accuracy42.22%
Argument KV accuracy43.70%
Tool parse validity44.44%
Overall strict behavior accuracy57.33%

Release decision: retain V1 and reject V2. The locked final benchmark was not reused for another training round.

Loading the adapter

python
import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer

base_model_id = "Qwen/Qwen3-1.7B"
adapter_id = "zubairz4far/qwen3-1.7b-tool-calling"

tokenizer = AutoTokenizer.from_pretrained(base_model_id)
base_model = AutoModelForCausalLM.from_pretrained(
    base_model_id,
    torch_dtype="auto",
    device_map="auto",
)
model = PeftModel.from_pretrained(base_model, adapter_id)
model.eval()

For reproducible prompting with tool schemas, use `src/inference.py`.

bash
python src/inference.py \
  --adapter zubairz4far/qwen3-1.7b-tool-calling \
  --tools examples/tools.json \
  --prompt "Check inventory for SKU GLM-001"

Generation is deterministic (do_sample=False). Applications must validate the selected tool and arguments before performing real-world actions.

Intended use and limitations

This adapter is intended for portfolio, research, and experimentation with function calling, tool routing, and structured generation. It is not a generally safe autonomous agent or a production action-execution system.

  • —The datasets and benchmarks are synthetic and domain-specific.
  • —Reported results are controlled benchmark scores, not general real-world accuracy.
  • —Clarification behavior is the principal known V1 weakness.
  • —Free-form support-ticket text can make strict argument matching brittle.
  • —Downstream systems should schema-validate every generated call.

Author

Zubair Zafar — AI/ML Engineer focused on LLM fine-tuning, agentic systems, and automation.