Views
No views yet
meta-llama/Llama-3.2-1B for support ticket classification.billing — payment, invoice, charge, refund queriestechnical — bugs, errors, product not workingaccount — login, password, profile, access issuesshipping — delivery, tracking, lost package queriesgeneral — feedback, feature requests, and inquiries that don't fit a specific support categoryclaude-sonnet-4-6 — 120 per category. Tickets vary in length (1–5 sentences) and tone (frustrated, polite, confused, urgent). No real customer data was used.general — has a clear positive definition. An earlier version of this dataset used an undefined general category, which caused the generation model to fill it with tickets indistinguishable from the other four categories; this was corrected before the final training run below.| Parameter | Value |
|---|---|
| Base model | meta-llama/Llama-3.2-1B |
| Method | QLoRA (4-bit) |
| LoRA rank | 16 |
| LoRA alpha | 32 |
| Target modules | q_proj, v_proj |
| LoRA dropout | 0.05 |
| Training hardware | Google Colab T4 (free tier) |
| Epochs | 2 |
| Learning rate | 2e-4 |
| Batch size | 8 (train and eval) |
| Experiment tracker | W&B |
| Epoch | Training Loss | Validation Loss | Accuracy | F1 (macro) |
|---|---|---|---|---|
| 1 | 0.249 | 0.376 | 0.943 | 0.945 |
| 2 | 0.015 | 0.248 | 0.951 | 0.953 |
billing, shipping, and general were classified with zero errors. The remaining errors (5 of 120 tickets) were concentrated between technical and account, likely reflecting genuine overlap (e.g. login issues that are also technical errors) rather than a labeling artifact.general category) scored 71.7% accuracy / 0.704 F1 (macro) on the same model architecture and hyperparameters, with most errors concentrated in general misclassifications. This gap was traced to a data generation issue rather than a modeling issue — see Training Data above.technical and account categoriesmeta-llama/Llama-3.2-1B, is subject to Meta's Llama 3.2 Community License, which includes usage restrictions (e.g. on very large-scale commercial deployments and certain use cases). Review the Llama 3.2 license before deploying this adapter.1import torch
2from transformers import AutoModelForSequenceClassification, AutoTokenizer
3from peft import PeftModel
4
5BASE_MODEL = "meta-llama/Llama-3.2-1B"
6ADAPTER = "sheethal00/ticket-classifier-lora"
7
8id2label = {0: "billing", 1: "technical", 2: "account", 3: "shipping", 4: "general"}
9label2id = {v: k for k, v in id2label.items()}
10
11tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL)
12if tokenizer.pad_token is None:
13 tokenizer.pad_token = tokenizer.eos_token
14
15base_model = AutoModelForSequenceClassification.from_pretrained(
16 BASE_MODEL,
17 num_labels=5,
18 id2label=id2label,
19 label2id=label2id,
20 torch_dtype=torch.float16, # use torch.float32 if running on CPU
21)
22base_model.config.pad_token_id = tokenizer.pad_token_id
23
24model = PeftModel.from_pretrained(base_model, ADAPTER)
25model.eval()
26
27# Inference
28text = "I was charged twice for my subscription this month, can you refund the extra charge?"
29inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=128)
30
31with torch.no_grad():
32 logits = model(**inputs).logits
33
34predicted_id = logits.argmax(dim=-1).item()
35print(model.config.id2label[predicted_id]) # -> "billing"base_model with a BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_quant_type="nf4", bnb_4bit_compute_dtype=torch.float16) (requires a CUDA GPU — 4-bit quantization is not supported on CPU).