ermiaazarkhalili/Qwen3-4B-Function-Calling-xLAM-Unsloth
089
Qwen3-4B-Function-Calling-xLAM-Unsloth
This model is a fine-tuned version of Qwen3-4B (Unsloth 4-bit) optimized for function calling using Unsloth for 2x faster training and 60% less VRAM.
Trained on the Salesforce/xlam-function-calling-60k dataset, which contains 60,000 function calling examples with queries, tool definitions, and structured answers.
Overview
Training Configuration
SFT + LoRA Settings
LoRA Configuration
Dataset
Hardware
Training Outcome
Usage
Quick Start (Transformers)
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "ermiaazarkhalili/Qwen3-4B-Function-Calling-xLAM-Unsloth"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
)
messages = [
{"role": "user", "content": "Check if the numbers 8 and 1233 are powers of two."}
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.7, do_sample=True)
response = tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)
print(response)Using with Unsloth (Fastest)
from unsloth import FastLanguageModel
model, tokenizer = FastLanguageModel.from_pretrained(
"ermiaazarkhalili/Qwen3-4B-Function-Calling-xLAM-Unsloth",
max_seq_length=2048,
load_in_4bit=True,
)
4-bit Quantized Inference
from transformers import AutoModelForCausalLM, BitsAndBytesConfig
import torch
quantization_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_compute_dtype=torch.bfloat16,
bnb_4bit_use_double_quant=True,
bnb_4bit_quant_type="nf4",
)
model = AutoModelForCausalLM.from_pretrained(
"ermiaazarkhalili/Qwen3-4B-Function-Calling-xLAM-Unsloth",
quantization_config=quantization_config,
device_map="auto",
)GGUF Versions
Quantized GGUF versions for CPU and edge inference are available at: [Qwen3-4B-Function-Calling-xLAM-Unsloth-GGUF](https://huggingface.co/ermiaazarkhalili/Qwen3-4B-Function-Calling-xLAM-Unsloth-GGUF)
Using with Ollama
ollama pull hf.co/ermiaazarkhalili/Qwen3-4B-Function-Calling-xLAM-Unsloth-GGUF:Q4_K_M
ollama run hf.co/ermiaazarkhalili/Qwen3-4B-Function-Calling-xLAM-Unsloth-GGUF:Q4_K_M "Check if the numbers 8 and 1233 are powers of two."Using with llama.cpp
./llama-cli -m Qwen3-4B-Function-Calling-xLAM-Unsloth-Q4_K_M.gguf -p "Check if the numbers 8 and 1233 are powers of two." -n 512Limitations
- Language: Primarily trained on English data
- Knowledge Cutoff: Limited to base model's training data cutoff
- Hallucinations: May generate plausible-sounding but incorrect information
- Context Length: Fine-tuned with 2,048 token context window
- Safety: Not extensively safety-tuned; use with appropriate guardrails
Training Framework Versions
Citation
@misc{ermiaazarkhalili_qwen3_4b_function_calling_xlam_unsloth,
author = {ermiaazarkhalili},
title = {Qwen3-4B-Function-Calling-xLAM-Unsloth: Fine-tuned Qwen3-4B (Unsloth 4-bit) with Unsloth},
year = {2026},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/ermiaazarkhalili/Qwen3-4B-Function-Calling-xLAM-Unsloth}}
}Acknowledgments
- Unsloth for 2x faster fine-tuning
- Base model developers (unsloth)
- Hugging Face TRL Team for the training library
- Salesforce xLAM for the function calling dataset
- Compute Canada / DRAC for HPC resources
