Downloads · 30 days
0
elbruno/Qwen2.5-0.5B-LocalLLMs-ToolCalling
Qwen2.5-0.5B-LocalLLMs-ToolCalling is a machine learning model from elbruno. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
Fine-tuned version of Qwen/Qwen2.5-0.5B-Instruct optimized for tool calling in ElBruno.LocalLLMs.
Downloads · 30 days
0
Access
Public
Updated Mar 27, 2026
Repo size
877 MB
Likes
0
Public
Click a slice to open those files.
.data866 MB · 99%
From the Hugging Face model README
Fine-tuned version of Qwen/Qwen2.5-0.5B-Instruct optimized for tool calling in ElBruno.LocalLLMs.
No Python needed. Download and use directly in .NET with ONNX Runtime GenAI.
| Property | Value |
|---|---|
| Base Model | Qwen/Qwen2.5-0.5B-Instruct |
| Fine-Tuning | QLoRA (rank 16, alpha 32) |
| Training Data | Tool calling + RAG + instruction following (5,000 examples) |
| Format | ONNX INT4 (ONNX Runtime GenAI) |
| Size | ~837 MB |
| Context Length | 2,048 tokens |
| Parameters | 0.5B |
| License | Apache 2.0 |
✅ No Python needed — Download and use directly in .NET
✅ Optimized for ElBruno.LocalLLMs — Matches QwenFormatter ChatML template exactly
✅ Better tool calling accuracy — Improved <tool_call> JSON format compliance
✅ RAG grounded answering — Cites context sources accurately
✅ Runs on CPU — No GPU required (faster with GPU)
✅ Tiny model — 0.5B parameters fit on edge devices and laptops
dotnet add package ElBruno.LocalLLMs
using ElBruno.LocalLLMs;
using Microsoft.Extensions.AI;
// Configure the fine-tuned model
var options = new LocalLLMsOptions
{
Model = new ModelDefinition
{
Id = "Qwen2.5-0.5B-LocalLLMs-ToolCalling".ToLower(),
HuggingFaceRepoId = "elbruno/Qwen2.5-0.5B-LocalLLMs-ToolCalling",
RequiredFiles = ["*"],
ModelType = OnnxModelType.GenAI,
ChatTemplate = ChatTemplateFormat.Qwen,
SupportsToolCalling = true
}
};
// Create the chat client (downloads model automatically on first use)
using var client = await LocalChatClient.CreateAsync(options);
// --- Tool Calling Example ---
var tools = new List<AITool>
{
AIFunctionFactory.Create(
(string city) => $"{{\"temp\": 22, \"condition\": \"sunny\"}}",
"get_weather",
"Get current weather for a city"
)
};
var response = await client.GetResponseAsync(
new[] { new ChatMessage(ChatRole.User, "What's the weather in Paris?") },
new ChatOptions { Tools = tools }
);
Console.WriteLine(response);
// --- RAG Example ---
var ragMessages = new[]
{
new ChatMessage(ChatRole.System, "Answer based on the provided context."),
new ChatMessage(ChatRole.User,
"Context:\n[1] ONNX Runtime GenAI enables local LLM inference.\n\n"
+ "Question: What does ONNX Runtime GenAI do?")
};
var ragResponse = await client.GetResponseAsync(ragMessages);
Console.WriteLine(ragResponse);
| Parameter | Value |
|---|---|
| LoRA Rank | 16 |
| LoRA Alpha | 32 |
| LoRA Dropout | 0.05 |
| Target Modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Learning Rate | 2e-4 |
| Epochs | 3 |
| Batch Size | 16 (effective: 4 × 4 gradient accumulation) |
| Optimizer | paged_adamw_8bit |
| Scheduler | Cosine with 50-step warmup |
| Max Sequence Length | 2,048 |
| Precision | FP16 (mixed precision training) |
The model was fine-tuned on a curated dataset of 5,000 examples:
| Category | Count | Source |
|---|---|---|
| Tool Calling | 2,000 | Glaive Function Calling v2 + custom ElBruno.LocalLLMs examples |
| RAG Grounded | 1,500 | MS MARCO + custom library documentation Q&A |
| Chat Template | 1,500 | Alpaca + ShareGPT (filtered, reformatted to ChatML) |
All training data matches the exact format produced by QwenFormatter.cs — including <tool_call> tags, ChatML tokens (<|im_start|>, <|im_end|>), and tool result formatting.
| Metric | Base Model | Fine-Tuned | Improvement |
|---|---|---|---|
| Tool Call Accuracy | — | — | — |
| JSON Format Compliance | — | — | — |
| RAG Citation Accuracy | — | — | — |
| ChatML Adherence | — | — | — |
| Inference Speed (tokens/sec) | — | — | — |
Benchmarks will be updated after comprehensive evaluation.
The model was converted using this pipeline:
Qwen2.5 Base → QLoRA Fine-tune → Merge LoRA → ONNX Export (INT4)
merge_lora.py)onnxruntime_genai.models.builder INT4 quantization (convert_to_onnx.py)validate_onnx.py)upload_to_hf.py)All scripts are available at: scripts/finetune/
<tool_call> JSON for function execution@misc{{{MODEL_NAME.lower().replace('-', '_').replace('.', '_')}}},
author = {{Bruno Capuano}},
title = {Qwen2.5-0.5B-LocalLLMs-ToolCalling},
year = {2026},
publisher = {HuggingFace},
url = {https://huggingface.co/elbruno/Qwen2.5-0.5B-LocalLLMs-ToolCalling}
}