CoolFace
Modelpublic

ermiaazarkhalili/LFM2.5-350M-Function-Calling-xLAM-Unsloth

sourceHugging Faceapache-2.0updated 5mo agoView on Hugging Face
0likes40downloads
Model Card

LFM2.5-350M-Function-Calling-xLAM-Unsloth

This model is a fine-tuned version of LFM2.5-350M 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

PropertyValue
Developed byermiaazarkhalili
LicenseAPACHE-2.0
LanguageEnglish
Base ModelLFM2.5-350M
Model Size350M parameters
Training FrameworkUnsloth + TRL
Training MethodSFT with QLoRA (4-bit)
Context Length2,048 tokens
GGUF AvailableLFM2.5-350M-Function-Calling-xLAM-Unsloth-GGUF

Training Configuration

SFT + LoRA Settings

ParameterValue
Unsloth ClassFastLanguageModel
Chat TemplateLFM2.5 (chatml)
Learning Rate2e-4
Batch Size2 per device
Gradient Accumulation4 steps
Effective Batch Size8
Max Steps1 epoch (full dataset)
OptimizerAdamW 8-bit
LR SchedulerLinear
Warmup Steps5
PrecisionAuto (BF16/FP16)
Gradient CheckpointingEnabled (Unsloth optimized)
Seed3407

LoRA Configuration

ParameterValue
LoRA Rank (r)16
LoRA Alpha16
LoRA Dropout0
Quantization4-bit QLoRA
Target Modulesqproj, kproj, vproj, oproj, gateproj, upproj, down_proj

Dataset

PropertyValue
DatasetxLAM Function Calling 60K
Training Samples60,000
FormatXML-tagged: <query>, <tools>, <answers>

Hardware

PropertyValue
GPUNVIDIA H100 80GB HBM3 (MIG 3g.40gb slice)
ClusterDRAC Fir (Compute Canada)
ExecutionPapermill on SLURM

Training Outcome

MetricValue
SLURM Job ID36550863
Runtime43m 33s (2613s)
Final Training Loss0.6507
Peak VRAM5.73 GB
GPUH100 80GB HBM3 (MIG 3g.40gb)

Usage

Quick Start (Transformers)

python
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

model_id = "ermiaazarkhalili/LFM2.5-350M-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)

python
from unsloth import FastLanguageModel

model, tokenizer = FastLanguageModel.from_pretrained(
    "ermiaazarkhalili/LFM2.5-350M-Function-Calling-xLAM-Unsloth",
    max_seq_length=2048,
    load_in_4bit=True,
)

4-bit Quantized Inference

python
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/LFM2.5-350M-Function-Calling-xLAM-Unsloth",
    quantization_config=quantization_config,
    device_map="auto",
)

GGUF Versions

Quantized GGUF versions for CPU and edge inference are available at: [LFM2.5-350M-Function-Calling-xLAM-Unsloth-GGUF](https://huggingface.co/ermiaazarkhalili/LFM2.5-350M-Function-Calling-xLAM-Unsloth-GGUF)

FormatDescription
Q4_K_MRecommended — good balance of quality and size
Q5_K_MHigher quality, slightly larger
Q8_0Near-lossless, largest GGUF size

Using with Ollama

bash
ollama pull hf.co/ermiaazarkhalili/LFM2.5-350M-Function-Calling-xLAM-Unsloth-GGUF:Q4_K_M
ollama run hf.co/ermiaazarkhalili/LFM2.5-350M-Function-Calling-xLAM-Unsloth-GGUF:Q4_K_M "Check if the numbers 8 and 1233 are powers of two."

Using with llama.cpp

bash
./llama-cli -m LFM2.5-350M-Function-Calling-xLAM-Unsloth-Q4_K_M.gguf -p "Check if the numbers 8 and 1233 are powers of two." -n 512

Limitations

  • —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

PackageVersion
Unsloth2026.4.4
TRL0.24.0
Transformers5.5.0
PyTorch2.9.0
Datasets4.3.0
PEFT0.18.1
BitsAndBytes0.49.2

Citation

bibtex
@misc{ermiaazarkhalili_lfm25_350m_function_calling_xlam_unsloth,
    author = {ermiaazarkhalili},
    title = {LFM2.5-350M-Function-Calling-xLAM-Unsloth: Fine-tuned LFM2.5-350M with Unsloth},
    year = {2026},
    publisher = {Hugging Face},
    howpublished = {\url{https://huggingface.co/ermiaazarkhalili/LFM2.5-350M-Function-Calling-xLAM-Unsloth}}
}

Acknowledgments