Results
Banking77 test split, 3,080 messages, the same prompt for both:
Table with columns: Measure, This adapter, Same base, no adapter| Measure | This adapter | Same base, no adapter |
|---|
| Accuracy | 90.6% | 38.9% |
| Macro-F1 | 90.5% | 36.6% |
| Valid intent name in the output | 100% | 93.0% |
| Median latency per message (Apple M5 Pro) | 97 ms | 75 ms |
A chat with this system message and user message. The intent list is the 77 Banking77 label names, one per line, in the dataset's label order:
system: You are an intent classifier for a retail bank's customer support. Reply with exactly one intent name from the list and nothing else.user: Intents: activate_my_card age_limit ... wrong_exchange_rate_for_cash_withdrawal Customer message: <the customer's message> Intent:
Output: one intent name. Use greedy decoding, up to 24 new tokens, with thinking disabled in the chat template (enable_thinking=False).
import torchfrom datasets import load_datasetfrom transformers import AutoModelForImageTextToText, AutoTokenizerfrom peft import PeftModel base_id = "Qwen/Qwen3.5-0.8B"labels = load_dataset("PolyAI/banking77", split="train").features["label"].namestok = AutoTokenizer.from_pretrained(base_id)model = AutoModelForImageTextToText.from_pretrained(base_id, dtype=torch.bfloat16)model = PeftModel.from_pretrained(model, "TextLayerAI/qwen3.5-0.8b-banking77-intent-lora").eval() SYSTEM = "You are an intent classifier for a retail bank's customer support. Reply with exactly one intent name from the list and nothing else."def classify(text): msgs = [{"role": "system", "content": SYSTEM}, {"role": "user", "content": "Intents:\n" + "\n".join(labels) + f"\n\nCustomer message: {text}\nIntent:"}] p = tok.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True, enable_thinking=False) ids = tok(p, return_tensors="pt") out = model.generate(**ids, max_new_tokens=24, do_sample=False, eos_token_id=tok.eos_token_id) # stop at <|im_end|> return tok.decode(out[0, ids["input_ids"].shape[1]:], skip_special_tokens=True).strip() print(classify("I am still waiting on my card?")) # card_arrival
Use on a Mac with MLX
The mlx/ folder holds the same adapter in mlx-vlm 0.8.0 format:
pip install mlx-vlm==0.8.0python -m mlx_vlm.server --model mlx-community/Qwen3.5-0.8B-bf16 --adapter-path ./mlx
A note on the LoRA scale
This adapter was trained with mlx-tune 0.6.0 on mlx-vlm 0.7.6, which divide alpha by the rank twice. The intended scale was alpha 32 / rank 16 = 2.0; the scale actually applied in training and evaluation was 0.125. Both files here use the real value: lora_alpha 2 with r 16 in the PEFT config, and scale 0.125 in mlx/adapter_config.json. verification.json records the check: on 60 test messages the original model, the MLX copy and the PEFT copy gave identical answers on all 60.
Training
- LoRA rank 16 on the attention and linear-attention projections of the language model (4.0 M parameters).
- 9,503 training messages (Banking77 train, 5% held out for validation), 2 epochs, 1,188 steps, AdamW 2e-4, cosine schedule, batch 4 x 4 accumulation.
- About 4 hours on an Apple M5 Pro, 6 GB peak memory.
Data and licences
- Adapter: Apache 2.0, the same as the base model.
- Training and evaluation data: PolyAI/banking77, CC BY 4.0. Casanueva et al., Efficient Intent Detection with Dual Sentence Encoders, NLP4ConvAI 2020.