ToolSure CONSTRAINED (Qwen2.5 1.5B Instruct)
Small models break function calls: malformed JSON, invented function names, missing or mistyped arguments, and calls when no tool fits. Retrieval cannot fix that, because the failure is in how the model writes the call. ToolSure trains Qwen/Qwen2.5-1.5B-Instruct to call tools reliably. This model is one of six in the ToolSure collection: five training methods on the same data, plus constrained decoding, all on one table.
Method
The same weights as the best trained ToolSure model, served with grammar constrained decoding. Whenever the model opens a tool call, decoding is forced to one of the offered function names and to arguments that match that function's JSON schema, so calls always parse. The model can still answer in plain text when no tool fits.
Training data: AmareshHebbar/ToolSure_Calls_Qwen2.5_1.5B. Same weights as the source model listed below.
Why finetune instead of prompting
The table includes the base model prompted normally, the base model with a strict system prompt, and the base model with grammar constrained decoding. Constrained decoding guarantees valid JSON and real function names, but it cannot choose the right function, fill the right values, or decide when not to call. That gap is what training closes.
Results
All rows use greedy decoding and the same checker. BFCL columns are AST accuracy on the Berkeley Function Calling Leaderboard non live categories, scored with a reimplementation of the BFCL AST checker (function name, required parameters, no unexpected parameters, values against the possible answers; parallel calls matched in any order). Irrelevance is the share of prompts where the model correctly made no call. xLAM held out is exact call accuracy on 500 xLAM examples never used in training. JSON parse rate counts outputs that attempted a call. Latency is batch size 1 on vLLM; cost assumes $1.0/hour GPU at the measured batched throughput.


Training hyperparameters
Usage
from huggingface_hub import hf_hub_download
import importlib.util
from vllm import LLM
path = hf_hub_download("AmareshHebbar/ToolSure_Qwen2.5_1.5B_CONSTRAINED", "toolsure_constrained.py")
spec = importlib.util.spec_from_file_location("toolsure_constrained", path)
tc = importlib.util.module_from_spec(spec)
spec.loader.exec_module(tc)
llm = LLM("AmareshHebbar/ToolSure_Qwen2.5_1.5B_CONSTRAINED")
tools = [{"name": "get_weather", "description": "Current weather for a city", "parameters": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]}}]
print(tc.generate(llm, [{"role": "user", "content": "What is the weather in Paris?"}], tools))
toolsure_constrained.py builds an xgrammar structural tag from the offered tools: free text is allowed, but once the model writes <tool_call> the rest of the call is forced to a real function name and schema valid arguments.
Files
The repository root holds bf16 safetensors. adapter/ holds the LoRA adapter where one was trained, training/ holds logs and curves, and eval/ holds raw results and sample generations.