Views
No views yet
Qwen2.5-1.5B-Instruct for function calling tasks using the Berkeley Function Calling Leaderboard (BFCL) dataset.| Adapter | Description | Accuracy |
|---|---|---|
sft/ | SFT on diverse BFCL data | 57.0% |
sft_dpo/ | SFT + DPO preference tuning | 57.7% |
sft_rl/ | SFT + reward-filtered RL | 58.0% |
tool_generalization/sft/ | SFT for unseen tools experiment | 79% on held-out tools |
category_holdout/sft/ | SFT for pattern generalization | 42% on held-out patterns |
diversity/high_diversity/ | Diverse training (125 x 4 categories) | 53% |
diversity/low_diversity/ | Homogeneous training (500 simple) | 27% |
1from mlx_lm import load, generate
2
3# Load base model with SFT adapter
4model, tokenizer = load(
5 "mlx-community/Qwen2.5-1.5B-Instruct-4bit",
6 adapter_path="path/to/sft"
7)
8
9# Format your prompt with function definitions
10messages = [
11 {"role": "system", "content": "You are a helpful assistant with access to functions..."},
12 {"role": "user", "content": "What's the weather in Paris?"}
13]
14
15prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
16output = generate(model, tokenizer, prompt=prompt, max_tokens=256)
17print(output)
18# Output: {"name": "get_weather", "arguments": {"city": "Paris"}}get_weather(city="Paris"))1@article{ramakrishnan2024toolcalling,
2 title={What Actually Improves LLM Tool Calling?},
3 author={Ramakrishnan, Siddharth},
4 year={2024}
5}