qwen2.5-3B-Instruct-conversational-tool-call

This repository provides a LoRA fine-tuned adapter for Qwen/Qwen2.5-3B-Instruct, optimized specifically for multi-turn conversational tool-calling and function-execution accuracy.

Benchmark Results

Evaluation across standard tool-calling benchmark categories compared against the base model:

Model simple_python multiple parallel parallel_multiple irrelevance
Qwen2.5-3B-Instruct (Base) 92.00% 88.50% 79.00% 75.50% 72.08%
canbingol/qwen2.5-3B-Instruct-conversational-tool-call 93.75% 92.50% 82.50% 77.50% 81.25%

Key Takeaways:

  • Consistent improvements across single, multiple, and parallel tool calling scenarios.
  • Significant reduction in false tool triggers with 81.25% accuracy on irrelevance detection (+9.17% over base).

Dataset

  • Dataset: Salesforce/APIGen-MT-5k
  • Preprocessing: Formatted via the model's native chat template and filtered to a maximum sequence length of 8,500 tokens.
  • Splits:
    • Train: 4,291 samples
    • Test: 469 samples

Training Details

  • Method: LoRA (PEFT)
  • Epochs: 1 (67 steps)
  • Effective Batch Size: 64 (Batch size per device: 2, Gradient Accumulation Steps: 32)
  • Learning Rate: 2e-4 (Linear schedule)
  • Optimizer: AdamW Torch Fused
  • Final Validation Loss: 0.2295

Quickstart

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

base_model_id = "Qwen/Qwen2.5-3B-Instruct"
adapter_id = "canbingol/qwen2.5-3B-Instruct-conversational-tool-call"

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

tools = [
    {
        "type": "function",
        "function": {
            "name": "get_current_weather",
            "description": "Get the current weather for a given location.",
            "parameters": {
                "type": "object",
                "properties": {
                    "location": {"type": "string", "description": "City and state/country"}
                },
                "required": ["location"]
            }
        }
    }
]

messages = [{"role": "user", "content": "What's the weather like in Istanbul right now?"}]
prompt = tokenizer.apply_chat_template(messages, tools=tools, add_generation_prompt=True, tokenize=False)

inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))
Downloads last month
64
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for canbingol/qwen2.5-3B-Instruct-conversational-tool-call

Base model

Qwen/Qwen2.5-3B
Adapter
(1401)
this model

Dataset used to train canbingol/qwen2.5-3B-Instruct-conversational-tool-call