Add fine-tuned BERT support ticket classifier
Browse files- README.md +61 -0
- config.json +54 -0
- model.safetensors +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +15 -0
README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
base_model: bert-base-uncased
|
| 5 |
+
pipeline_tag: text-classification
|
| 6 |
+
datasets:
|
| 7 |
+
- Tobi-Bueck/customer-support-tickets
|
| 8 |
+
metrics:
|
| 9 |
+
- f1
|
| 10 |
+
- accuracy
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# Support Ticket Routing Classifier (BERT)
|
| 14 |
+
|
| 15 |
+
`bert-base-uncased` fine-tuned to route English customer support tickets to one of 10 queues.
|
| 16 |
+
|
| 17 |
+
- Code: https://github.com/im-preshanth/support-ticket-classifier
|
| 18 |
+
- Live demo: https://huggingface.co/spaces/preshanth09/support-ticket-classifier-demo
|
| 19 |
+
|
| 20 |
+
## Intended use
|
| 21 |
+
|
| 22 |
+
Suggesting the destination queue for an incoming support ticket (subject + body), ideally as a top-3 suggestion for a human triage agent. Not intended for automated decisions on real customers without retraining and evaluation on in-house data.
|
| 23 |
+
|
| 24 |
+
## Labels
|
| 25 |
+
|
| 26 |
+
Billing and Payments, Customer Service, General Inquiry, Human Resources, IT Support, Product Support, Returns and Exchanges, Sales and Pre-Sales, Service Outages and Maintenance, Technical Support.
|
| 27 |
+
|
| 28 |
+
## Training data
|
| 29 |
+
|
| 30 |
+
English subset of `Tobi-Bueck/customer-support-tickets` (synthetic). 23,745 tickets after cleaning and de-duplication; stratified 80/10/10 split with seed 42 (18,996 / 2,374 / 2,375).
|
| 31 |
+
|
| 32 |
+
## Training procedure
|
| 33 |
+
|
| 34 |
+
- Max sequence length 256, learning rate 3e-5, 700 warmup steps, weight decay 0.01
|
| 35 |
+
- Batch size 16, 6 epochs, fp16, Google Colab T4 GPU (about 19 minutes)
|
| 36 |
+
- Cross-entropy loss with inverse-frequency class weights
|
| 37 |
+
- Best epoch selected by validation macro-F1 (0.595 at epoch 6)
|
| 38 |
+
|
| 39 |
+
## Evaluation (held-out test set, 2,375 tickets)
|
| 40 |
+
|
| 41 |
+
| Model | Accuracy | Macro-F1 | Weighted-F1 |
|
| 42 |
+
|---|---|---|---|
|
| 43 |
+
| TF-IDF + LogReg baseline | 0.504 | 0.507 | 0.505 |
|
| 44 |
+
| This model | 0.531 | 0.579 | 0.528 |
|
| 45 |
+
|
| 46 |
+
Strongest queues: Billing and Payments (F1 0.799), Human Resources (0.731). Weakest: Product Support (0.424), General Inquiry (0.452).
|
| 47 |
+
|
| 48 |
+
## Limitations
|
| 49 |
+
|
| 50 |
+
- Trained on synthetic tickets; performance on real tickets is unknown.
|
| 51 |
+
- Technical Support, IT Support and Product Support overlap heavily and are frequently confused with each other.
|
| 52 |
+
- English only. Single training run and seed.
|
| 53 |
+
|
| 54 |
+
## How to use
|
| 55 |
+
|
| 56 |
+
```python
|
| 57 |
+
from transformers import pipeline
|
| 58 |
+
|
| 59 |
+
clf = pipeline("text-classification", model="preshanth09/support-ticket-classifier", top_k=3)
|
| 60 |
+
clf("I was charged twice for my subscription this month and need a refund.")
|
| 61 |
+
```
|
config.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_cross_attention": false,
|
| 3 |
+
"architectures": [
|
| 4 |
+
"BertForSequenceClassification"
|
| 5 |
+
],
|
| 6 |
+
"attention_probs_dropout_prob": 0.1,
|
| 7 |
+
"bos_token_id": null,
|
| 8 |
+
"classifier_dropout": null,
|
| 9 |
+
"dtype": "float32",
|
| 10 |
+
"eos_token_id": null,
|
| 11 |
+
"gradient_checkpointing": false,
|
| 12 |
+
"hidden_act": "gelu",
|
| 13 |
+
"hidden_dropout_prob": 0.1,
|
| 14 |
+
"hidden_size": 768,
|
| 15 |
+
"id2label": {
|
| 16 |
+
"0": "Billing and Payments",
|
| 17 |
+
"1": "Customer Service",
|
| 18 |
+
"2": "General Inquiry",
|
| 19 |
+
"3": "Human Resources",
|
| 20 |
+
"4": "IT Support",
|
| 21 |
+
"5": "Product Support",
|
| 22 |
+
"6": "Returns and Exchanges",
|
| 23 |
+
"7": "Sales and Pre-Sales",
|
| 24 |
+
"8": "Service Outages and Maintenance",
|
| 25 |
+
"9": "Technical Support"
|
| 26 |
+
},
|
| 27 |
+
"initializer_range": 0.02,
|
| 28 |
+
"intermediate_size": 3072,
|
| 29 |
+
"is_decoder": false,
|
| 30 |
+
"label2id": {
|
| 31 |
+
"Billing and Payments": 0,
|
| 32 |
+
"Customer Service": 1,
|
| 33 |
+
"General Inquiry": 2,
|
| 34 |
+
"Human Resources": 3,
|
| 35 |
+
"IT Support": 4,
|
| 36 |
+
"Product Support": 5,
|
| 37 |
+
"Returns and Exchanges": 6,
|
| 38 |
+
"Sales and Pre-Sales": 7,
|
| 39 |
+
"Service Outages and Maintenance": 8,
|
| 40 |
+
"Technical Support": 9
|
| 41 |
+
},
|
| 42 |
+
"layer_norm_eps": 1e-12,
|
| 43 |
+
"max_position_embeddings": 512,
|
| 44 |
+
"model_type": "bert",
|
| 45 |
+
"num_attention_heads": 12,
|
| 46 |
+
"num_hidden_layers": 12,
|
| 47 |
+
"pad_token_id": 0,
|
| 48 |
+
"position_embedding_type": "absolute",
|
| 49 |
+
"tie_word_embeddings": true,
|
| 50 |
+
"transformers_version": "5.23.0",
|
| 51 |
+
"type_vocab_size": 2,
|
| 52 |
+
"use_cache": false,
|
| 53 |
+
"vocab_size": 30522
|
| 54 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b664f54b569b6bfb1971832bd0dfe8a4a57bf2e8e13b549b9150a534cf85f8aa
|
| 3 |
+
size 437983232
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"backend": "tokenizers",
|
| 3 |
+
"cls_token": "[CLS]",
|
| 4 |
+
"do_lower_case": true,
|
| 5 |
+
"is_local": false,
|
| 6 |
+
"local_files_only": false,
|
| 7 |
+
"mask_token": "[MASK]",
|
| 8 |
+
"model_max_length": 512,
|
| 9 |
+
"pad_token": "[PAD]",
|
| 10 |
+
"sep_token": "[SEP]",
|
| 11 |
+
"strip_accents": null,
|
| 12 |
+
"tokenize_chinese_chars": true,
|
| 13 |
+
"tokenizer_class": "BertTokenizer",
|
| 14 |
+
"unk_token": "[UNK]"
|
| 15 |
+
}
|