File size: 5,802 Bytes
24cf941
 
1b05b6d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24cf941
 
1b05b6d
 
 
 
 
 
 
 
24cf941
1b05b6d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24cf941
1b05b6d
24cf941
1b05b6d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
---
language:
- ar
license: apache-2.0
base_model: AISA-Framework/AISA-AR-FunctionCall-FT
tags:
- function-calling
- arabic
- tool-use
- agentic
- gemma
- reasoning
- lora
- think
datasets:
- AISA-Framework/AISA-AR-FunctionCall
pipeline_tag: text-generation
library_name: transformers
---

# AISA-AR-FunctionCall-Think (Lora Adapter)

<p align="center">
  <img src="https://cdn-uploads.huggingface.co/production/uploads/628f7a71dd993507cfcbe587/21Mxl67VW-RQFiXTnvheT.png" width="700"/>
</p>

**Reasoning-Augmented Arabic Structured Tool Calling**

`AISA-AR-FunctionCall-Think` is a reasoning-enhanced variant of the Arabic function-calling model introduced in the **AISA-AR-FunctionCall** framework. The model generates an intermediate reasoning trace before invoking a tool, enabling transparent decision-making for Arabic agentic systems.

This model extends [AISA-AR-FunctionCall-FT](https://huggingface.co/AISA-Framework/AISA-AR-FunctionCall-FT) by introducing explicit reasoning supervision using `<think>` blocks prior to tool execution.

---

## Model Overview

| Field | Value |
|---|---|
| **Model name** | AISA-AR-FunctionCall-Think |
| **Base model** | AISA-AR-FunctionCall-FT |
| **Architecture** | Gemma 3 (FunctionGemma 270M) |
| **Training method** | LoRA reasoning fine-tuning |
| **Primary task** | Arabic reasoning-aware function calling |

The model produces outputs in the following pattern:

```
<think>
reasoning about tool selection
</think>
<start_function_call>
call:tool_name{arguments}
</end_function_call>
```

This allows the system to expose the reasoning behind tool selection.

---

## Key Capabilities

- Reasoning-aware tool selection
- Explicit decision traces for tool invocation
- Improved argument extraction consistency
- Interpretable structured execution

**Supported domains:**

| Domain |
|---|
| Travel |
| Utilities |
| Islamic services |
| Weather |
| Healthcare |
| Banking & finance |
| E-commerce |
| Government services |

**Supported Arabic dialect groups:**

- Modern Standard Arabic (MSA)
- Gulf
- Egyptian
- Levantine
- Maghrebi

---

## Training Dataset

Training uses a subset of the [AISA-AR-FunctionCall](https://huggingface.co/datasets/AISA-Framework/AISA-AR-FunctionCall) dataset with reasoning annotations.

| Property | Value |
|---|---|
| Dataset size | ~12k reasoning-augmented samples |
| Dialect coverage | 5 Arabic dialects |
| Domains | 8 real-world domains |
| Tools | 27 structured tools |

---

## Training Methodology

The reasoning model is trained by augmenting assistant outputs with explicit reasoning segments.

**Training format:**

```
<think>
tool selection reasoning
</think>
<start_function_call>
call:tool{arguments}
</end_function_call>
```

Reasoning supervision is enforced during inference by priming the model to begin its generation with `<think>`.

**Training configuration:**

| Parameter | Value |
|---|---|
| Training type | LoRA fine-tuning |
| LoRA rank | 64 |
| Alpha | 64 |
| Dropout | 0.05 |
| Trainable parameters | ~5.36% |
| Epochs | 3 |
| Learning rate | 3e-6 |
| Effective batch size | 32 |
| Optimizer | 8-bit AdamW |
| Scheduler | Cosine |

Additional training signals include **negative tool examples** to reduce hallucinated tool calls when no tool invocation is required.

---

## Evaluation Results

Evaluation is performed on a strict reasoning evaluation subset.

### Strict Evaluation (n = 240)

| Metric | Score |
|---|---|
| Tool Call Rate | 0.992 |
| Think-Before-Call Rate | **1.000** |
| Function Name Accuracy | 0.992 |
| Argument F1 | **1.000** |
| Decision Accuracy | 0.992 |
| Hallucination Rate | **0.000** |

These results indicate that the model consistently performs reasoning before tool invocation and achieves near-perfect structured alignment within the evaluated subset.

### Important Note on Format Validation

Standard function-call validators may classify reasoning outputs as **parse failures** because `<think>` tokens appear before the function call marker.

This does **not** indicate structural instability — it reflects a difference in serialization format. When reasoning segments are permitted, tool invocation correctness remains near-perfect.

---

## Example Usage

**User query:**

```
ما حالة الطقس في الرياض اليوم؟
```

**Model output:**

```
<think>
المستخدم يريد معرفة حالة الطقس في مدينة الرياض، لذا يجب استخدام أداة get_weather.
</think>
<start_function_call>
call:get_weather{city:<escape>الرياض<escape>,days:1}
</end_function_call>
```

---

## Intended Use

This model is intended for:

- Research on reasoning-aware tool calling
- Interpretable agent systems
- Arabic reasoning supervision experiments
- Debugging tool selection behavior

### Production Recommendation

This model is an **exploratory research variant**. For production deployment, we recommend using:

[AISA-AR-FunctionCall-FT](https://huggingface.co/AISA-Framework/AISA-AR-FunctionCall-FT)

---

## Related Resources

| Resource | Link |
|---|---|
| Dataset | [AISA-Framework/AISA-AR-FunctionCall](https://huggingface.co/datasets/AISA-Framework/AISA-AR-FunctionCall) |
| Production model | [AISA-AR-FunctionCall-FT](https://huggingface.co/AISA-Framework/AISA-AR-FunctionCall-FT) |
| Model collection | [AISA Arabic FunctionCall](https://huggingface.co/collections/AISA-Framework/aisa-arabic-functioncall-datasets-and-models) |

---

## Paper

**From Language to Action in Arabic: Reliable Structured Tool Calling via Data-Centric Fine-Tuning**

*AISA Framework*

---

## AISA Framework

This model is part of the **AISA** (Agentic AI Systems Architecture) initiative for building reliable multilingual AI agents.

---

## License

[Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)