Gjusev commited on
Commit
b4ca6a9
Β·
verified Β·
1 Parent(s): 40f8da7

docs: expand model card (training details, calibration, escalation, limitations)

Browse files
Files changed (1) hide show
  1. README.md +170 -0
README.md ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: transformers
4
+ base_model:
5
+ - convaiinnovations/laya
6
+ tags:
7
+ - laya
8
+ - system-one
9
+ - ticket-triage
10
+ - banking77
11
+ - hierarchical-classification
12
+ - customer-support
13
+ - routing
14
+ datasets:
15
+ - PolyAI/banking77
16
+ metrics:
17
+ - accuracy
18
+ - f1
19
+ pipeline_tag: text-classification
20
+ ---
21
+
22
+ # laya-triage-banking77
23
+
24
+ A [laya](https://github.com/NandhaKishorM/laya) System 1 decision model (421M) fine-tuned
25
+ for **hierarchical support-ticket triage** on BANKING77: one local forward pass per stage
26
+ returns a department route and a calibrated confidence β€” no API calls, no per-ticket cost.
27
+ Part of the [laya-triage](https://github.com/Gjusev/laya-triage) project (Apache 2.0).
28
+
29
+ | Configuration | Intent accuracy | Macro-F1 |
30
+ |---|---:|---:|
31
+ | zero-shot flat 77-way | 36.5% | 0.284 |
32
+ | zero-shot hierarchical | 51.0% | 0.443 |
33
+ | **fine-tuned hierarchical (this model)** | **90.5%** | **0.848** |
34
+
35
+ 200-ticket seed-13 BANKING77 test sample, identical harness and questions for all three rows.
36
+
37
+ ## How the hierarchy works
38
+
39
+ BANKING77's 77 intents are grouped into 12 clusters of 3-10 intents (kept inside the
40
+ calibrated choice-temperature bucket). Triage is two passes on this checkpoint:
41
+
42
+ 1. **Coarse pass** β€” choose one of the 12 clusters. In production the same pass also scores
43
+ urgency, frustration, churn risk and refund intent (heads inherited from the base model).
44
+ 2. **Fine pass** β€” choose among only the 3-10 intents of the winning cluster.
45
+
46
+ Coarse accuracy on the eval sample: **96.0%**. The two-pass eval ran the
47
+ 200 tickets in 16.1s on one Kaggle T4.
48
+
49
+ ## Training details
50
+
51
+ - **Data**: the BANKING77 train split (10,003 tickets). Each ticket contributes two
52
+ sequences β€” the coarse choice (gold = the intent's cluster) and the fine choice
53
+ restricted to that cluster (gold = the intent) β€” 20,006 training items in total.
54
+ - **Objective**: RLCD policy gradients over a proper scoring rule (log score + spherical +
55
+ ranked-probability for score-type questions) plus a cross-entropy guidance term toward
56
+ the gold answer.
57
+ - **Hyperparameters** (from the committed trainer):
58
+ 3 epochs; micro-batch 8 with gradient accumulation 4 (effective 32 per rank);
59
+ RLCD group size 4 with sigma annealed 0.4 β†’ 0.1 across epochs; AdamW with
60
+ encoder lr 2.5e-5 / head lr 1e-4, weight decay 0.01.
61
+ - **Hardware**: Kaggle 2Γ— Tesla T4, `torchrun` DDP (9,803 items per rank after the
62
+ equal-count trim), about 46 minutes end to end.
63
+ - **Software**: laya 0.3.22, laya-triage 0.1.0, adapted from laya's official 2Γ—T4 notebook.
64
+ - **Notebook**: [`finetune/laya_triage_banking77.ipynb`](https://github.com/Gjusev/laya-triage/blob/main/finetune/laya_triage_banking77.ipynb)
65
+ (opens directly in Kaggle; the committed run is [gjusev/laya-triage-banking77](https://www.kaggle.com/code/gjusev/laya-triage-banking77)).
66
+
67
+ ## Calibration
68
+
69
+ Choice-answer temperature fitted on a held-out calibration split carved from the training
70
+ data **before** training: **3.825** (score and noul heads keep their 1.2 defaults).
71
+ After three epochs on memorized training data the choice logits are sharply overconfident;
72
+ the fitted temperature softens them back so `answer_confidence` remains a usable gate.
73
+
74
+ ## Escalation
75
+
76
+ The operational policy auto-handles a ticket only when every routing decision's calibrated
77
+ confidence clears a threshold. For this checkpoint the 75% accuracy target is met at
78
+ threshold **0.00** with **100% coverage**
79
+ (90.5% accuracy among auto-handled tickets): on this English banking
80
+ sample the calibrated confidence is strong enough that nothing needs escalating β€” a large
81
+ change from the zero-shot checkpoint, whose operating point was 0.84 at ~60% coverage.
82
+ Treat that as a property of this domain/sample, not a universal guarantee.
83
+
84
+ ## What was trained and what was not
85
+
86
+ - **Trained**: the two routing decisions (cluster choice, intent choice).
87
+ - **NOT trained**: the auxiliary signal heads β€” BANKING77 carries no urgency/frustration/
88
+ churn/refund labels. Measured on the project's English hand-labeled subset
89
+ (n=60): urgency MAE **0.701**, frustration MAE
90
+ **0.693** (zero-shot all-language baseline 0.813 / 1.071).
91
+ The routing-only fine-tune did not disturb them.
92
+ - **English only**: the base checkpoint is the English laya model. The repo documents
93
+ per-language coarse-accuracy degradation zero-shot; this fine-tune does not address it.
94
+
95
+ ## Where it fails (top confusions on the eval sample)
96
+
97
+ | Gold | Predicted | Count |
98
+ |---|---|---:|
99
+ | `top_up_failed` | `topping_up_by_card` | 1 |
100
+ | `beneficiary_not_allowed` | `failed_transfer` | 1 |
101
+ | `order_physical_card` | `getting_virtual_card` | 1 |
102
+ | `pin_blocked` | `change_pin` | 1 |
103
+ | `beneficiary_not_allowed` | `transfer_into_account` | 1 |
104
+ | `verify_top_up` | `verify_my_identity` | 1 |
105
+ | `receiving_money` | `fiat_currency_support` | 1 |
106
+ | `wrong_exchange_rate_for_cash_withdrawal` | `cash_withdrawal_charge` | 1 |
107
+ | `declined_transfer` | `transfer_not_received_by_recipient` | 1 |
108
+ | `get_disposable_virtual_card` | `getting_virtual_card` | 1 |
109
+
110
+ Every top confusion is a single-ticket mistake on this sample β€” there is no systematic
111
+ confusion pair at n=200.
112
+
113
+ ## Intended use
114
+
115
+ - Routing customer-support tickets to departments/queues in English banking-style domains.
116
+ - As a drop-in laya checkpoint inside the [laya-triage pipeline](https://github.com/Gjusev/laya-triage),
117
+ which adds multilingual routing, the escalation policy and the signal heads.
118
+
119
+ **Out of scope**: languages other than English (use the zero-shot multilingual pipeline
120
+ instead), non-banking domains, any decision with safety or legal consequences, and use of
121
+ the urgency/frustration scores as anything beyond triage prioritization signals.
122
+
123
+ ## Limitations
124
+
125
+ - Evaluated on a 200-ticket sample (seed 13) of the BANKING77 test split; the full-split
126
+ numbers may differ. Reproduce with the artifact, not the prose.
127
+ - Out-of-domain tickets map to the nearest banking concept when confidence is high enough;
128
+ the repo's smoke test escalated 7 of 8 IT-operations tickets at the zero-shot 0.84 gate.
129
+ - Latency figures (CPU 577.4s / T4 16.1s per 200-ticket two-pass)
130
+ are development measurements, not deployment benchmarks.
131
+
132
+ ## Evaluation methodology and artifacts
133
+
134
+ Sample selection, per-ticket records (predictions, confidences, correctness), the coverage
135
+ curve and every number above live in
136
+ [`evals/results/banking77_finetuned.json`](https://github.com/Gjusev/laya-triage/blob/main/evals/results/banking77_finetuned.json).
137
+ The eval kernel that produced it attaches this checkpoint as a Kaggle dataset and re-runs
138
+ the same seed-13 two-pass as the repo's zero-shot harness
139
+ ([gjusev/laya-triage-ft-eval](https://www.kaggle.com/code/gjusev/laya-triage-ft-eval)).
140
+
141
+ ## Usage
142
+
143
+ ```python
144
+ import laya
145
+ from huggingface_hub import snapshot_download
146
+ from laya_triage import schema
147
+
148
+ agent = laya.Agent(snapshot_download("Gjusev/laya-triage-banking77"), device="cpu")
149
+
150
+ stage1 = agent.predict([{"message": "I was charged twice for the same card payment"}],
151
+ schema.coarse_questions())[0]
152
+ cluster = stage1["answers"]["cluster"]["choice"]
153
+ stage2 = agent.predict([{"message": "I was charged twice for the same card payment"}],
154
+ schema.fine_questions(cluster))[0]
155
+ print(cluster, stage2["answers"]["intent"]["choice"],
156
+ stage2["answers"]["intent"]["answer_confidence"])
157
+ ```
158
+
159
+ The full pipeline (`TriagePipeline`) wraps both passes plus department mapping and the
160
+ escalation gate β€” see the repo README.
161
+
162
+ ## Base model and data
163
+
164
+ Fine-tuned from the Apache-2.0 laya System 1 checkpoint by Convai Innovations
165
+ (`convaiinnovations/laya`), trained on the BANKING77 dataset (PolyAI-LDN). Thanks to both.
166
+
167
+ ## License
168
+
169
+ Apache 2.0. The fine-tune and its evaluation artifacts are part of the
170
+ [laya-triage](https://github.com/Gjusev/laya-triage) project.