Views
No views yet
| Mode | Dataset | Accuracy |
|---|---|---|
| Zero-Shot (base Qwen3-8B) | 200 stratified samples | 68.00% |
| Fine-Tuned (this model) | 200 stratified samples | 90.00% |
| Fine-Tuned (this model) | Full test set (3,080 samples) | 91.85% |
| Parameter | Value |
|---|---|
| Base model | unsloth/Qwen3-8B |
| Quantization | 4-bit (QLoRA) |
| Max sequence length | 2048 |
| LoRA rank (r) | 16 |
| LoRA alpha | 32 |
| LoRA dropout | 0.05 |
| Epochs | 1 |
| Batch size | 2 (grad accum 4 → effective 8) |
| Learning rate | 2e-4 |
| LR scheduler | cosine |
| Optimizer | adamw_8bit |
1from unsloth import FastLanguageModel
2
3model, tokenizer = FastLanguageModel.from_pretrained(
4 model_name="minhthien/banking-intent-unsloth",
5 max_seq_length=2048,
6 load_in_4bit=True,
7)
8FastLanguageModel.for_inference(model)
9
10INTENT_LABELS = [
11 "Refund_not_showing_up", "activate_my_card", "age_limit",
12 "apple_pay_or_google_pay", "atm_support", "automatic_top_up",
13 # ... (77 labels total, see Banking77 dataset)
14]
15
16SYSTEM_PROMPT = (
17 "You are a banking intent classifier. "
18 "Given a customer message, output exactly one intent label from the list below. "
19 "Output only the label, nothing else.\n\n"
20 "Labels:\n" + "\n".join(f"- {l}" for l in INTENT_LABELS)
21)
22
23def classify(text: str) -> str:
24 messages = [
25 {"role": "system", "content": SYSTEM_PROMPT},
26 {"role": "user", "content": text},
27 ]
28 input_ids = tokenizer.apply_chat_template(
29 messages, tokenize=True, add_generation_prompt=True, return_tensors="pt"
30 ).to("cuda")
31 output = model.generate(input_ids=input_ids, max_new_tokens=32, do_sample=False)
32 decoded = tokenizer.decode(output[0][input_ids.shape[1]:], skip_special_tokens=True)
33 return decoded.strip()
34
35print(classify("I lost my credit card, how do I order a replacement?"))
36# → lost_or_stolen_cardIntentClassification class from the project repo:1import sys
2sys.path.insert(0, "scripts")
3from inference import IntentClassification
4
5clf = IntentClassification("configs/inference.yaml", mode="finetuned")
6result = clf("I lost my credit card, how do I order a replacement?")
7print(result) # → "lost_or_stolen_card"