TACT weights, tokenizer and model card
Browse files- README.md +98 -0
- config.json +9 -0
- tact.safetensors +3 -0
- tokenizer.model +3 -0
README.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
library_name: pytorch
|
| 6 |
+
pipeline_tag: text-generation
|
| 7 |
+
tags:
|
| 8 |
+
- function-calling
|
| 9 |
+
- tool-calling
|
| 10 |
+
- device-control
|
| 11 |
+
- ternary
|
| 12 |
+
- tiny
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# TACT: a 2.39 MB function-calling language model, more accurate than open models up to 700 times its size
|
| 16 |
+
|
| 17 |
+
TACT (Ternary Action-Calling Transformer) reads a request in natural language and the list of functions a device offers, and returns the function calls that carry out the request. It has 7.4 million parameters and its weights occupy 2.39 MB.
|
| 18 |
+
|
| 19 |
+
```
|
| 20 |
+
request lock the garage and switch off the bedroom light
|
| 21 |
+
functions set_light(room, state, brightness) set_thermostat(temperature) lock_door(door, locked)
|
| 22 |
+
|
| 23 |
+
output [{"name": "lock_door", "arguments": {"door": "garage", "locked": true}},
|
| 24 |
+
{"name": "set_light", "arguments": {"room": "bedroom", "state": "off"}}]
|
| 25 |
+
```
|
| 26 |
+
|
| 27 |
+
The function list is given at run time. A new device only needs its own list.
|
| 28 |
+
|
| 29 |
+
Code: [github.com/Glimmer-X/TACT-tiny-function-calling-model](https://github.com/Glimmer-X/TACT-tiny-function-calling-model)
|
| 30 |
+
|
| 31 |
+
## Use
|
| 32 |
+
|
| 33 |
+
```bash
|
| 34 |
+
pip install git+https://github.com/Glimmer-X/TACT-tiny-function-calling-model
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
```python
|
| 38 |
+
import tact
|
| 39 |
+
|
| 40 |
+
functions = [
|
| 41 |
+
{"name": "set_light",
|
| 42 |
+
"description": "Turn a light on or off and set its brightness.",
|
| 43 |
+
"parameters": {"type": "object",
|
| 44 |
+
"properties": {"room": {"type": "string"},
|
| 45 |
+
"state": {"type": "string", "enum": ["on", "off"]},
|
| 46 |
+
"brightness": {"type": "integer"}},
|
| 47 |
+
"required": ["room", "state"]}},
|
| 48 |
+
]
|
| 49 |
+
|
| 50 |
+
model = tact.load() # downloads this repository
|
| 51 |
+
device = model.bind(functions) # encodes the function list once
|
| 52 |
+
device("turn on the kitchen light at 40 percent")
|
| 53 |
+
# [{'name': 'set_light', 'arguments': {'room': 'kitchen', 'state': 'on', 'brightness': 40}}]
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
## Model
|
| 57 |
+
|
| 58 |
+
| | |
|
| 59 |
+
|---|---|
|
| 60 |
+
| Parameters | 7.4 million |
|
| 61 |
+
| Weights | 2.39 MB |
|
| 62 |
+
| Structure | encoder-decoder Transformer, width 512, 8 heads |
|
| 63 |
+
| Depth | one encoder block applied 6 times, one decoder block applied 4 times |
|
| 64 |
+
| Linear weights | ternary, 2 bits each |
|
| 65 |
+
| Embedding | 4096 tokens, 4 bits per value, shared with the output layer |
|
| 66 |
+
| Activations | 8 bits at the input of every linear layer |
|
| 67 |
+
| Language | English |
|
| 68 |
+
|
| 69 |
+
Files: `tact.safetensors` holds the ternary values at 2 bits and the embedding at 4 bits, `tokenizer.model` is a SentencePiece tokenizer with 4096 tokens, and `config.json` gives the dimensions.
|
| 70 |
+
|
| 71 |
+
## Results
|
| 72 |
+
|
| 73 |
+
Accuracy on four device-control test sets, in percent. A request counts as correct when the output calls equal the reference calls in names and in every argument value.
|
| 74 |
+
|
| 75 |
+
| | Held-out | Authored | External-A | External-B | Mean |
|
| 76 |
+
|---|---|---|---|---|---|
|
| 77 |
+
| TACT, mean of three training runs | 76.5 | 82.8 | 83.1 | 78.9 | 80.3 |
|
| 78 |
+
| These weights | 75.1 | 83.3 | 85.4 | 78.9 | 80.7 |
|
| 79 |
+
|
| 80 |
+
The test sets, the evaluation script and a comparison with nine other open function-calling models are in the code repository.
|
| 81 |
+
|
| 82 |
+
## Training data
|
| 83 |
+
|
| 84 |
+
TACT is pretrained on general English text and then trained on 373,897 function-calling records: device-control scenarios generated with DeepSeek-V4.1-Flash, and records from Glaive Function Calling, the xLAM function-calling set, Home Assistant Requests and Mobile Actions.
|
| 85 |
+
|
| 86 |
+
## Scope
|
| 87 |
+
|
| 88 |
+
TACT is built for device control with requests in English. It returns function calls and does not hold a conversation.
|
| 89 |
+
|
| 90 |
+
## Citation
|
| 91 |
+
|
| 92 |
+
```bibtex
|
| 93 |
+
@article{xu2026tact,
|
| 94 |
+
title = {TACT: A Weight-Shared Ternary Transformer Language Model for Function Calling in a Few Megabytes},
|
| 95 |
+
author = {Xu, Dongkun and Wang, Runlong and Ni, Xianpo and Arslan, Tughrul},
|
| 96 |
+
year = {2026}
|
| 97 |
+
}
|
| 98 |
+
```
|
config.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"vocab": 4096,
|
| 3 |
+
"d": 512,
|
| 4 |
+
"heads": 8,
|
| 5 |
+
"enc_iters": 6,
|
| 6 |
+
"dec_iters": 4,
|
| 7 |
+
"ffn_mult": 2,
|
| 8 |
+
"act_bits": 8
|
| 9 |
+
}
|
tact.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7c8503f2db49b1ef489e256bb0e50823e1a540a6ac0f1b8a9160b758ccb70897
|
| 3 |
+
size 2397580
|
tokenizer.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a202bcb6f6c2b6cf0a7345bbf6f5a37289b01cc173aa408c72da603b22757c0a
|
| 3 |
+
size 60404
|