Command: turn the lights off please
Answer: {"intent":"iot_hue_lightoff","slots":[]}
How to use
The model expects the exact instructions in system_prompt.txt, which list the 60 intents and 55 slot names.
import torchfrom huggingface_hub import hf_hub_downloadfrom peft import PeftModelfrom transformers import AutoModelForImageTextToText, AutoTokenizer repo = "bola23/Qwen3.5-0.8B-LoRA-Voice-Commands-EN-AR"base = "Qwen/Qwen3.5-0.8B"tokenizer = AutoTokenizer.from_pretrained(base)model = AutoModelForImageTextToText.from_pretrained(base)model = PeftModel.from_pretrained(model, repo).merge_and_unload().to("cuda", torch.float16).eval() system = open(hf_hub_download(repo, "system_prompt.txt"), encoding="utf-8").read()messages = [{"role": "system", "content": system}, {"role": "user", "content": "wake me up at seven am"}]text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True, enable_thinking=False)inputs = tokenizer(text, return_tensors="pt", add_special_tokens=False).to("cuda")output = model.generate(**inputs, max_new_tokens=160, do_sample=False, eos_token_id=tokenizer.convert_tokens_to_ids("<|im_end|>"))print(tokenizer.decode(output[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))
Test results
Measured on the MASSIVE 1.1 test split against human labels, with one training run.
Table with columns: Test set, Sentences, Intent correct, Full answer correct, Slot F1, Intent macro-F1, Usable answers| Test set | Sentences | Intent correct | Full answer correct | Slot F1 | Intent macro-F1 | Usable answers |
|---|
| All | 5,948 | 77.4% | 56.8% | 0.692 | 0.762 | 97.6% |
| English | 2,974 | 85.2% | 64.9% | 0.758 | 0.839 | 99.5% |
| Arabic | 2,974 | 69.5% | 48.8% | 0.622 | 0.686 | 95.7% |
| All, without flagged rows | 5,553 | 79.7% | 59.0% | 0.704 | 0.791 | 97.6% |
"Full answer correct" means the intent and every slot match exactly. An answer that is not usable JSON with
known names, and values copied from the command, counts as wrong. "Flagged rows" are sentences marked as
doubtful during data checks.
For comparison, three versions of the same model trained on a teacher model's answers (distillation from
Qwen3.5-9B) reached about 69.5% intent and 36% full answers on the same test set. There is no score for this
base model without fine-tuning.
Training
Table with columns: Setting, Value| Setting | Value |
|---|
| Method | LoRA, rank 16, alpha 32, dropout 0.05, on the language-model projection layers |
| Base weights | Frozen |
| Data | 3,945 English and Arabic sentences with human labels |
| Passes | 3 (741 steps), batch size 16 |
| Learning rate | 0.0003, weight decay 0.01, 10% warmup, gradient clipping 1.0 |
| Loss | Cross-entropy on the answer only |
| Hardware | One NVIDIA T4, about 104 minutes, 7.6 GB peak memory |
| Libraries | torch 2.11.0, transformers 5.20.2, peft 0.21.2 |
Limits
- For learning and research. More than 2 in 10 intents and about 4 in 10 full answers are wrong.
- Arabic is clearly weaker than English.
- Trained on a subset of the data and measured with a single training run.
- Only the listed intents and slots; other requests are forced into one of them.
- Written commands from one dataset; real speech transcripts and other Arabic dialects were not tested.
Data and license
Trained and tested on MASSIVE 1.1 by Amazon, licensed
CC BY 4.0, whose English sentences come from SLURP. The data
was filtered and reformatted for this project. Paper: MASSIVE.
The base model is licensed Apache 2.0, and this adapter is released under Apache 2.0.
Author: Bola Maged.