TWLM Alpha (19M)
TinyWorkLM is a compact action/tool-calling model built by Saqr Corp. It is not a chat model. Given a request and a set of available tool schemas, it is trained to output one structured decision rather than a conversational reply.
This is an alpha release. Read the Limitations section before using this for anything beyond experimentation.
What this model does
Given a prompt in the form:
<|tools|>[{"name": "add_item", "args": {"list": "string", "item": "string"}}]
<|user|>add milk to my shopping list
<|call|>
it produces a single JSON object:
{"outcome": "success", "call": {"name": "add_item", "args": {"list": "shopping", "item": "milk"}}, "message": null, "confidence": 0.9}
outcome is always one of exactly five values: success, no_tool_found, request_input,
invalid_request, tool_error. See the Playground app or the SaqrCorp/twlm-playground repo for
a reference client that constructs this prompt format and parses the response.
Model details
| Parameters | ~19.0M |
| Architecture | Custom dense transformer: GQA + RoPE + sliding-window attention with pinned tool-schema sink tokens, QK-RMSNorm, Canon (depthwise causal conv) layers |
| Context window | 1024 tokens |
| Tokenizer | SentencePiece BPE, 8192-token vocabulary |
| Training | Pretrained from scratch, then supervised fine-tuned (SFT) for structured tool-calling |
| License | Apache 2.0 |
Training
- Pretraining: 40,000 optimizer steps. Final training loss: 1.023198. Data: a mix of function-calling datasets (xLAM, Glaive) and general text (FineWeb-Edu, Arabic Wikipedia).
- SFT: 6,000 optimizer steps, starting from the pretrained checkpoint above.
Final training loss: 0.003. Loss computed only on the target output, not the prompt.
Data: reshaped xLAM/Glaive/tool-failure-recovery examples plus synthetic ambiguous/invalid/no-tool
cases and corrupted-call calibration examples, built with
sft_data.pyin this repo's companion training repository (SaqrCorp/twlm-raw).
Evaluation
- No held-out evaluation has been run yet. The numbers below are training-loss only, not task accuracy. Do not treat this model as benchmarked.
Nothing in this card should be read as a claim that this model matches or beats any other small tool-calling model (e.g. Needle 2, Jev, FunctionGemma). No head-to-head comparison has been run. If you benchmark this model, please share results.
Limitations (read this)
- Alpha release. Behavior may be inconsistent, especially on tool schemas unlike anything in the training mix.
- 19M parameters is very small. Expect this model to work well on narrow, fine-tuned tasks with fixed schemas, and to work poorly on open-ended tool selection among many unfamiliar tools.
- No adversarial or safety red-teaming has been performed. Treat model output as an unvalidated
proposal β always validate the
callfield's arguments against your actual tool's schema before executing anything, and never execute a tool call without an explicit human or policy check in between. This model does not execute anything itself. - Confidence scores are uncalibrated. The
confidencefield is produced by an auxiliary head trained alongside the main model; it has not been separately validated against actual correctness rates. Do not treat a high confidence score as a correctness guarantee.
Usage
See SaqrCorp/twlm-playground for a full reference
runtime, or load directly with the architecture code in
SaqrCorp/twlm-raw (twlm.py).
from twlm import TWLMConfig, TWLMModel, TWLMTokenizer
from safetensors.torch import load_file
cfg = TWLMConfig.from_json("config.json")
model = TWLMModel(cfg)
model.load_state_dict(load_file("model.safetensors"))
tok = TWLMTokenizer("tokenizer.model")
Citation / contact
Built by Saqr Corp, an independent research group based in Egypt. Repository: https://github.com/SaqrCorp/twlm-playground