Downloads · 30 days
232
0% of all-time downloads
contextboxai/Qwen3-1.7B-FC
Qwen3-1.7B-FC is a text generation model from contextboxai. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
A function calling model based on Qwen3-1.7B, fine-tuned using RLVR (Reinforcement Learning with Verifiable Rewards) to improve tool-use capabilities on the BFCL V3 benchmark.
Downloads · 30 days
232
0% of all-time downloads
All-time downloads
46.6K
Public
Parameters
1.7B
20.7 GB on disk
Likes
4
Public
Click a slice to open those files.
.pt13.8 GB · 67%
From the Hugging Face model README
A function calling model based on Qwen3-1.7B, fine-tuned using RLVR (Reinforcement Learning with Verifiable Rewards) to improve tool-use capabilities on the BFCL V3 benchmark.
| Model | Size | BFCL Overall | Category Avg |
|---|---|---|---|
| Qwen3-1.7B-FC (Our) | 1.7B | 54.2% | 50.8% |
| Qwen3-1.7B (Base) | 1.7B | 48.8% | 45.8% |
| Qwen3-8B | 8B | 51.9% | 48.6% |
| Qwen3-14B | 14B | 51.6% | 49.0% |
| Model | Avg Response Tokens | Efficiency vs Base |
|---|---|---|
| Base Qwen3-1.7B | 35.6 tokens | - |
| Qwen3-1.7B-FC (Our) | 22.7 tokens | -36% |
The fine-tuned model generates 36% fewer tokens while maintaining higher accuracy, thanks to:
<think> reasoning blocks| Category | Qwen3-1.7B-FC (Our) | Base 1.7B | Qwen3-8B | Qwen3-14B |
|---|---|---|---|---|
| simple | 81.0% | 61.5% | 69.2% | 65.5% |
| multiple | 79.0% | 55.5% | 66.0% | 57.0% |
| parallel | 78.0% | 68.0% | 78.0% | 77.0% |
| parallel_multiple | 64.5% | 51.5% | 66.5% | 66.5% |
| irrelevance | 81.2% | 86.2% | 85.4% | 90.4% |
| Category | Qwen3-1.7B-FC (Our) | Base 1.7B | 8B | 14B |
|---|---|---|---|---|
| exec_simple | 84.0% | 82.0% | 84.0% | 87.0% |
| exec_multiple | 70.0% | 70.0% | 78.0% | 78.0% |
| exec_parallel | 80.0% | 76.0% | 86.0% | 90.0% |
| exec_parallel_multiple | 60.0% | 60.0% | 67.5% | 65.0% |
| Category | Qwen3-1.7B-FC (Our) | Base 1.7B | Qwen3-8B | Qwen3-14B |
|---|---|---|---|---|
| live_simple | 63.6% | 43.8% | 51.2% | 51.6% |
| live_multiple | 55.0% | 36.8% | 43.7% | 42.5% |
| live_parallel | 50.0% | 18.8% | 43.8% | 43.8% |
| live_parallel_multiple | 66.7% | 37.5% | 54.2% | 50.0% |
| live_irrelevance | 66.1% | 80.3% | 78.7% | 79.9% |
| Source | Samples | Type | Description |
|---|---|---|---|
| xLAM | ~60,000 | Positive | High-quality function calling examples from Salesforce |
| ToolACE | ~11,000 | Positive | Diverse multi-turn tool usage scenarios |
| Toucan-1.5M | 40,000 | Negative | Irrelevant queries (Server Shuffle method) |
| Synthetic Negatives | 6,000 | Negative | Domain mismatch, partial fulfillment, permission errors |
The model is trained to refuse appropriately using diverse negative samples:
| Type | Description | Example |
|---|---|---|
| Toucan Irrelevant | Query has no matching tool in available functions | "What's the weather?" when only get_stock_price is available |
| Domain Mismatch | Tools from wrong domain | Asking about finance when only cooking tools available |
| Action Mismatch | Similar name but wrong action | Asking to "delete" when only "get" function exists |
| Partial Fulfillment | Tools can't fully solve query | Need 2 steps but only 1 tool available |
| Permission/Auth | Missing required permissions | Admin action without credentials |
| Format Mismatch | Wrong data format requirements | Tool expects JSON but query provides CSV |
Stage 1: Accuracy-focused training (V3)
Stage 2: Efficiency optimization (V4)
<think> tags# Combined Reward Formula
total_reward = (
format_weight * format_reward + # Valid <tool_call> JSON (0.0-1.0)
correct_weight * correctness_reward + # Tool name + arguments match (0.0-1.0)
refusal_weight * refusal_reward + # +1.0 correct refusal, -1.0 hallucination
efficiency_weight * efficiency_reward # Penalty for verbose <think>
)
# Stage 1 Weights (Accuracy Focus)
STAGE1_WEIGHTS = {
'format': 0.2,
'correctness': 1.0, # Main focus
'efficiency': 0.2,
'refusal': 0.3,
}
# Stage 2 Weights (Efficiency Focus)
STAGE2_WEIGHTS = {
'format': 0.1,
'correctness': 0.5, # Reduced - already accurate from Stage 1
'efficiency': 1.0, # Main focus - penalize <think> tags
'refusal': 0.3,
}
| Component | Description | Range |
|---|---|---|
| format_reward | Valid <tool_call>JSON</tool_call> structure | 0.0 - 1.0 |
| correctness_reward | Tool name match + argument similarity | 0.0 - 1.0 |
| refusal_reward | +1.0 correct refusal, -1.0 hallucination | -1.0 to +1.0 |
| efficiency_reward | Stage 1: -0.3 for <think>, Stage 2: -1.0 | -1.0 to +0.1 |
ground_truth = []<think> Tags: Strong penalty (-1.0) for verbose reasoning blocksimport torch
from transformers import AutoTokenizer, AutoModelForCausalLM
model_name = "contextboxai/Qwen3-1.7B-FC"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.bfloat16, device_map="auto")
# Define tools
tools = [{
"name": "get_weather",
"description": "Get weather for a location",
"parameters": {
"type": "object",
"properties": {
"location": {"type": "string", "description": "City name"}
},
"required": ["location"]
}
}]
messages = [{"role": "user", "content": "What's the weather in Tokyo?"}]
prompt = tokenizer.apply_chat_template(
messages,
tools=tools,
add_generation_prompt=True,
tokenize=False,
enable_thinking=False # Disable thinking for efficiency
)
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=256)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
<tool_call>
{"name": "get_weather", "arguments": {"location": "Tokyo"}}
</tool_call>
When asked "What is the meaning of life?" with only get_weather tool available:
None of the provided tools can answer this question.
from vllm import LLM, SamplingParams
llm = LLM(model="contextboxai/Qwen3-1.7B-FC")
sampling_params = SamplingParams(temperature=0, max_tokens=256)
# Generate with same prompt format as above
outputs = llm.generate([prompt], sampling_params)
This model is optimized for edge deployment and customer service automation where a small, efficient model is needed:
| Use Case | Description |
|---|---|
| Edge Device Deployment | Run locally on devices with limited GPU/RAM |
| Customer Service Chatbot | Automate order lookup, ticket creation, FAQ with tool calls |
| Voice Agent / Call Center | Real-time voice-to-action for phone support systems |
| IoT/Smart Home | Control devices via function calling on edge hardware |
| Mobile AI Assistant | On-device tool execution without cloud dependency |
| Cost-Efficient API Gateway | Route requests to appropriate backend services |
# Example: Customer asks about their order
tools = [
{"name": "lookup_order", "parameters": {"order_id": "string"}},
{"name": "create_ticket", "parameters": {"issue": "string", "priority": "string"}},
{"name": "get_faq", "parameters": {"topic": "string"}}
]
# User: "Đơn hàng #12345 của tôi ở đâu rồi?"
# Model output:
# <tool_call>
# {"name": "lookup_order", "arguments": {"order_id": "12345"}}
# </tool_call>
# User: "Tôi muốn đổi trả sản phẩm"
# Model output:
# <tool_call>
# {"name": "create_ticket", "arguments": {"issue": "product_return", "priority": "normal"}}
# </tool_call>
| Benefit | Description |
|---|---|
| Low Latency | ~50ms inference on consumer GPU |
| Low Cost | 8x cheaper than 14B model to deploy |
| Privacy | Run entirely on-premise, no data leaves device |
| Offline Capable | Works without internet connection |
This model uses RLVR (Reinforcement Learning from Verifiable Rewards) instead of traditional SFT, which helps reduce capability loss:
| Attribute | Value |
|---|---|
| Base Model | Qwen/Qwen3-1.7B |
| Training Method | RLVR (RL fine-tuning) |
| Training Steps | 100 (V3) + 3000 (V4) |
| Peak LR | 1e-6 → 2e-7 |
| Training Data | 117K samples (71K positive + 46K negative) |
| Precision | bfloat16 |
| Max Sequence Length | 32768 tokens |
| Tool Format | XML-style (<tool_call>...</tool_call>) |
If you use this model, please cite:
@misc{qwen3-fc,
title={Qwen3-1.7B-FC: Efficient Function Calling via GRPO Fine-tuning},
author={ContextboxAI},
year={2024},
howpublished={\url{https://huggingface.co/contextboxai/Qwen3-1.7B-FC}},
}
Apache 2.0
Model Card Contact: ContextboxAI