TinyTurk v2.7d - English Command Agent
1.1M-parameter English GPT that turns natural language into structured commands. Supports both text and voice input.
Model Description
TinyTurk English Command Agent maps free-form English input (e.g. turn up the volume) to a structured command label (e.g. volume up). It runs locally on CPU or GPU. For voice input, it is paired with OpenAI Whisper (small).
The same 1M-parameter architecture performs near chance on knowledge and abstract syntax tasks. On the command agent task, it reaches 100% accuracy in live text and voice testing.
- Developed by: stunmuffin
- Model type: Decoder-only Transformer (GPT-style), intent classification
- Language: English
- License: Apache 2.0
- Base model: fine-tuned from tinyturk-v2.7d-tinystories-en
Architecture
- Tokenizer: 512 BPE (SentencePiece, English)
- Context length: 64
- Embedding: 128
- Layers: 4
- Heads: 4
- FFN: 128 -> 512 -> 128
- Micro-FFN: 128 -> 256 -> 128 (gated, gate=0.75)
- Position encoding: RoPE
- Normalization: RMSNorm
- Parameters: 1,121,920
Training
- Base model: TinyStories EN (val loss 1.3349)
- Data: 298 generated English examples (train 237 / val 37 / test 24)
- Format:
command: <input> output: <label> - Labels: 16 commands +
unknown - Epochs: 50
- Batch size: 16
- Best val loss: 0.5495
- Training time: ~5 minutes on GTX 1080 Ti
Training data balancing
An earlier version had imbalanced training data (open cmd = 64 examples vs lock = 6). This caused the model to default to the majority class on ambiguous inputs (e.g. turn up the volume -> volume_down). We capped each command at 30 examples, which fixed the issue.
Command Set
| Input example | Output label | Action |
|---|---|---|
| open cmd / launch terminal | open cmd | start cmd.exe |
| open notepad | open notepad | start notepad.exe |
| start calculator | open calc | start calc.exe |
| open browser | open browser | start chrome |
| show file explorer | open explorer | start explorer.exe |
| open paint | open paint | start mspaint.exe |
| open task manager | open taskmgr | start taskmgr.exe |
| turn up the volume | volume up | volume + |
| turn down the volume | volume down | volume - |
| mute the sound | volume mute | mute |
| shut down the computer | shutdown | shutdown /s |
| restart the pc | restart | shutdown /r |
| lock the screen | lock | LockWorkStation |
| take a screenshot | screenshot | (placeholder) |
| show desktop | show desktop | Win+D |
| put computer to sleep | sleep | suspend |
| hello / apple / qwerty | unknown | do nothing |
Evaluation
Text test (22 inputs)
22/22 correct (100%)
Voice test (20 commands, Whisper small)
18/18 valid commands correct, 2/2 out-of-domain correctly rejected.
Sample voice session:
Heard: 'open cmd'
[open_CMD] (conf: 1.000)
-> executed
Heard: 'volume up'
[volume_up] (conf: 1.000)
-> executed
Heard: 'shut down'
[shutdown] (conf: 0.963)
[TEST] shutdown
Voice Agent
Full voice pipeline:
Microphone -> Whisper (small, en) -> this model -> Action
All components run locally. No API.
Whisper prompt (critical)
Whisper hallucinates filler on short clips. We provide an initial_prompt with English command examples:
open cmd, launch notepad, start calculator, open browser,
turn up the volume, turn down the volume, mute the sound,
shut down the computer, restart the pc, lock the screen
Without the prompt, Whisper produces noise on 4-second clips.
Confidence note
The English agent has very high confidence on all inputs (0.88-1.00 for both valid commands and unknown). This is a transfer learning artifact. Do not use a confidence threshold for this model. Use prefix matching only.
Usage
Text
import torch
import sentencepiece as spm
from model import TinyTurkGPTV27, TinyTurkV27Config
tok = spm.SentencePieceProcessor()
tok.load('tokenizer_en_bpe_512.model')
config = TinyTurkV27Config(vocab_size=512, context_length=64)
model = TinyTurkGPTV27(config)
model.load_state_dict(torch.load('pytorch_model.bin', map_location='cpu'))
model.eval()
user_input = 'turn up the volume'
prefix = f'command: {user_input} output:'
prefix_ids = tok.encode(prefix, out_type=int)
ids = list(prefix_ids)
x = torch.tensor([ids], dtype=torch.long)
with torch.no_grad():
for _ in range(15):
logits, _ = model(x[:, -64:])
nid = torch.argmax(logits[0, -1, :]).item()
ids.append(nid)
x = torch.tensor([ids], dtype=torch.long)
output = tok.decode(ids[len(prefix_ids):]).strip()
print(output) # 'volume upen cmdownetic' -> prefix match -> 'volume_up'
Voice
See voice_agent_en.py in the GitHub repo.
Safety
- Destructive commands (
shutdown,restart,lock,sleep) are disabled in the deployment script. - In production: require user confirmation, log every action, never run as admin.
Known Limitations
- 16 commands only
- Single-turn (no multi-step plans)
- No parameter passing
- Confidence threshold does not work for this model (all > 0.9)
Scientific Context
This model is part of the TinyTurk series. The same 1M-parameter architecture was tested on:
| Task | Result |
|---|---|
| TurkishMMLU (knowledge) | near chance |
| BLiMP (abstract syntax) | near chance |
| Command agent (text) | 22/22 |
| Command agent (voice) | 18/18 |
Conclusion: Task selection matters more than model size. Narrow formal tasks are within reach of 1M parameters.
Files
| File | Content |
|---|---|
examples/train.txt |
237 training examples |
examples/val.txt |
37 validation examples |
examples/test.txt |
24 test examples |
Citation
@misc{tinyturk-v27d-agent-en,
title = {TinyTurk v2.7d - English Command Agent},
author = {stunmuffin},
year = {2026},
howpublished = {https://huggingface.co/stunmuffin/tinyturk-v2.7d-agent-en}
}
Related
- Turkish agent: stunmuffin/tinyturk-v2.7d-agent
- Base model (TinyStories EN): stunmuffin/tinyturk-v2.7d-tinystories-en
- Turkish baseline (k_hikaye): stunmuffin/tinyturk-v2.7d-k-hikaye-baseline
- Downloads last month
- 23