LLaMA 1B Tool Router - GRPO Trained
A 1B parameter model trained with pure PyTorch GRPO for fast, accurate tool selection in agentic AI systems.
Results
| Metric | Value |
|---|---|
| Validation Accuracy | 87.94% |
| Parameters | 1B |
| Training | GRPO only (no SFT) |
| Dataset | Salesforce xLAM 60k |
Why This Model?
| GPT-4 / Claude API | This Model | |
|---|---|---|
| Latency | 2-5 seconds | 100-500ms |
| Cost/call | $0.01-0.03 | ~$0.0001 |
| Privacy | Cloud | Local |
| Offline | ❌ | ✅ |
100x cheaper. 10x faster. Runs anywhere.
Quick Start
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained(
"debashis/llama-1b-tool-router-grpo",
torch_dtype=torch.bfloat16,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("debashis/llama-1b-tool-router-grpo")
def call_tool(query: str, tools: list) -> str:
tools_text = ""
for i, tool in enumerate(tools, 1):
tools_text += f"{i}. {tool['name']}\n"
tools_text += f" Description: {tool['description']}\n"
tools_text += f" Parameters: {', '.join(tool['parameters'])}\n"
prompt = f"""<|begin_of_text|><|start_header_id|>system<|end_header_id|>
You are a function calling assistant. Based on the user's query, call the appropriate function with correct arguments.
Available functions:
{tools_text}
Respond with a JSON object: {{"name": "function_name", "arguments": {{"param1": "value1"}}}}
Only output JSON.<|eot_id|><|start_header_id|>user<|end_header_id|}
{query}<|eot_id|><|start_header_id|>assistant<|end_header_id|>
"""
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=150, temperature=0.1, do_sample=False)
return tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)
Example
tools = [
{"name": "search_flights", "description": "Search for flights",
"parameters": ["origin", "destination", "date"]},
{"name": "book_hotel", "description": "Book a hotel room",
"parameters": ["city", "checkin", "checkout"]},
]
result = call_tool("Find flights from NYC to London on Dec 25th", tools)
# Output: {"name": "search_flights", "arguments": {"origin": "NYC", "destination": "London", "date": "Dec 25th"}}
Training Details
| Parameter | Value |
|---|---|
| Base model | LLaMA 3.2 1B Instruct |
| Algorithm | GRPO (Pure PyTorch) |
| Epochs | 3 |
| Learning rate | 1e-6 |
| KL coefficient | 0.1 |
| Temperature | 0.7 (train) / 0.1 (inference) |
Training Curves
Limitations
- May struggle with 10+ similar tools
- Complex nested objects may lose detail
- Domain-specific tools benefit from additional fine-tuning
Links
- Training Code: GitHub
- Dataset: Salesforce/xlam-function-calling-60k
Citation
@misc{llama-tool-router-grpo-2025,
author = {Debashis Ghosh},
title = {LLaMA 1B Tool Router: GRPO-Trained for Agentic Systems},
year = {2026},
publisher = {Hugging Face}
}
- Downloads last month
- 20
Model tree for debashis/llama-1b-tool-router-grpo
Base model
meta-llama/Llama-3.2-1B-Instruct