madamLLM-tools / README.md
emeke's picture
Upload folder using huggingface_hub
d60d596 verified
---
language:
- en
- ig
- ha
- yo
license: apache-2.0
base_model: McGill-NLP/AfriqueQwen-8B
tags:
- tool-calling
- function-calling
- igbo
- hausa
- yoruba
- nigeria
- voice-assistant
---
# MadamLLM-Tools
**Madam** is a Nigerian multilingual voice assistant fine-tuned for native tool calling across Igbo, Hausa, Yoruba, and English.
This model (`madamLLM-tools`) extends [`babs/madamLLM-dpo`](https://huggingface.co/babs/madamLLM-dpo) with tool calling capabilities using Qwen3's native Hermes-style `<tool_call>` format.
## Model Details
- **Base model:** [McGill-NLP/AfriqueQwen-8B](https://huggingface.co/McGill-NLP/AfriqueQwen-8B) (Qwen3-8B continued pretrained on 27.5B tokens across 20 African languages)
- **Training stages:** SFT β†’ SimPO DPO β†’ Tool Calling SFT (this model)
- **Method:** LoRA SFT (rank 64, alpha 128, RSLoRA, all linear layers + lm_head)
- **Framework:** LLaMA-Factory
- **Hardware:** 2Γ— NVIDIA A100 SXM 80GB
## Tool Calling Evaluation
| Metric | Score |
|--------|-------|
| Tool calling accuracy | 20/20 β€” **100%** |
| Irrelevance detection | 10/10 β€” **100%** |
| Args in English | 19/20 β€” 95% |
| Weighted overall | **99.0%** |
All four languages scored 100% on tool accuracy: English βœ… Igbo βœ… Hausa βœ… Yoruba βœ…
## Supported Tools
Madam knows 8 Nigeria-specific tools out of the box:
| Tool | Description |
|------|-------------|
| `get_weather` | Current weather for Nigerian cities |
| `get_exchange_rate` | NGN exchange rates |
| `get_news` | Nigerian news headlines |
| `get_market_prices` | Commodity prices (rice, garri, fuel, etc.) |
| `search_health_info` | Basic health and first-aid guidance |
| `get_prayer_times` | Islamic prayer times |
| `send_message` | Send SMS/WhatsApp messages |
| `set_reminder` | Set time-based reminders |
## Tool Calling Format
Uses Qwen3's native Hermes-style format. Pass tools via `apply_chat_template`:
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model = AutoModelForCausalLM.from_pretrained("babs/madamLLM-tools", torch_dtype=torch.bfloat16, device_map="auto")
tokenizer = AutoTokenizer.from_pretrained("babs/madamLLM-tools")
tools = [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather conditions for a city in Nigeria",
"parameters": {
"type": "object",
"properties": {
"city": {"type": "string", "description": "City name, e.g. Lagos, Kano, Abuja"}
},
"required": ["city"]
}
}
}
]
messages = [
{"role": "system", "content": "You are Madam, a Nigerian voice assistant."},
{"role": "user", "content": "Yaya yanayi a Kano yau?"} # Hausa: What's the weather in Kano today?
]
text = tokenizer.apply_chat_template(messages, tools=tools, tokenize=False, add_generation_prompt=True, enable_thinking=False)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
output = model.generate(**inputs, max_new_tokens=200, temperature=0.3, do_sample=True, eos_token_id=[151645, 151643])
print(tokenizer.decode(output[0][inputs["input_ids"].shape[1]:], skip_special_tokens=False))
# β†’ <tool_call>{"name": "get_weather", "arguments": {"city": "Kano"}}</tool_call>
```
## vLLM Serving
```bash
vllm serve babs/madamLLM-tools \
--tool-call-parser hermes \
--enable-auto-tool-choice \
--dtype bfloat16 \
--max-model-len 4096
```
## Training Data
| Source | Examples | Purpose |
|--------|----------|---------|
| Synthetic (Groq gpt-oss-120b) | 11,924 | Nigeria-specific tool calls, 4 languages |
| APIGen-MT-5k | 1,009 | Multi-turn tool chains |
| xLAM-60k sample | 2,500 | Diverse tool schemas (1,240 unique tools) |
| Hermes FC v1 | 1,100 | Format alignment |
| SFT replay | 4,000 | Anti-forgetting (Igbo/Hausa/Yoruba/English) |
| **Total** | **20,533** | |
50% of tool-calling examples use function masking (Hammer technique) for generalization to unseen tools.
## Soul
Madam embodies the nine fruits of the Spirit (Galatians 5:22-23): love, joy, peace, patience, kindness, goodness, faithfulness, gentleness, and self-control.