Lab21 Qwen3.5 Vietnamese Ticket Triage
LoRA adapter by Pham Hoang Trong for Lab 21. It maps Vietnamese customer-support
tickets to JSON with intent, urgency, product, and sentiment.
This is the main correct adapter, not the separate UIT B2 adapter.
Base weights must be downloaded separately from unsloth/Qwen3.5-4B.
Training
The lab's synthetic shopping-ticket corpus contains 250 examples, split into 225 training and 25 validation examples with seed 42. Targets contain JSON labels, not reasoning traces. Loss uses the verified assistant-only mask.
| Setting | Value |
|---|---|
| Base | unsloth/Qwen3.5-4B |
| Placement | text-linear, excluding vision layers |
| Rank / alpha / dropout | 16 / 32 / 0 |
| Learning rate | 0.0001 |
| Epoch budget / optimizer steps | 2 / 30 |
| Maximum sequence length | 1024 |
| Trainable parameters | 32,464,896 |
| Hardware / precision | Colab Tesla T4 / fp16 |
| Training time / peak VRAM | 399.1 seconds / 8.78 GB |
| PEFT version at save | 0.21.1 |
Training code and dependency pins: lab repository. Evidence JSON files included here correspond to the measured main lab run.
Evaluation
Evaluation uses all 50 synthetic target tickets and 15 general-capability questions. Target is mean accuracy across four JSON fields, not whole-ticket exact match. Regression uses keyword recall; format checks valid JSON and required keys. Latency is an observation from one T4 run, not a repeated benchmark.
| Run | Target | Regression | Format | Latency ms/item |
|---|---|---|---|---|
| Base + naive prompt | 0.0000 | 0.7911 | 0.0000 | 3314.5 |
| Base + optimized prompt | 0.7650 | 0.7911 | 1.0000 | 1082.5 |
| LoRA correct + naive prompt | 0.9700 | 0.6111 | 1.0000 | 1377.9 |
Regression gate: FAILED. Target improves by 0.205, but regression decreases by 0.180, beyond the lab tolerance of 0.020. The adapter is an educational experiment. The small synthetic dataset, explicit cues, and keyword-based regression scoring limit generalization claims. Thinking-disabled trace rate is not evidence of reasoning-trace collapse. No real customer data or multimodal performance was tested.
Usage
Install the lab's compatible Transformers, PEFT, Accelerate, and PyTorch versions. Inference needs the 4B base model and suitable memory; no additional training is needed.
import torch
from peft import PeftConfig, PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
adapter_id = "trongph/lab21-qwen35-triage-vi"
config = PeftConfig.from_pretrained(adapter_id)
tokenizer = AutoTokenizer.from_pretrained(adapter_id)
base = AutoModelForCausalLM.from_pretrained(
config.base_model_name_or_path, dtype=torch.float16, device_map="auto"
)
model = PeftModel.from_pretrained(base, adapter_id).eval()
messages = [
{"role": "system", "content": "Phân loại ticket sau."},
{"role": "user", "content": "Shop ơi, chuột không dây bị lỗi. Tôi muốn đổi lại. Gấp."},
]
prompt = tokenizer.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True, enable_thinking=False
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
output = model.generate(**inputs, max_new_tokens=96, do_sample=False)
print(tokenizer.decode(output[0, inputs.input_ids.shape[1]:], skip_special_tokens=True))
The base model declares Apache-2.0: base model card. The adapter is shared under Apache-2.0.