tinydistill-banking77-minilm

A small text classifier distilled from Qwen/Qwen2.5-7B-Instruct into sentence-transformers/all-MiniLM-L6-v2 with tinydistill, exported to ONNX for fast CPU inference.

Labels (77): activate_my_card, age_limit, apple_pay_or_google_pay, atm_support, automatic_top_up, balance_not_updated_after_bank_transfer, balance_not_updated_after_cheque_or_cash_deposit, beneficiary_not_allowed, cancel_transfer, card_about_to_expire, card_acceptance, card_arrival, card_delivery_estimate, card_linking, card_not_working, card_payment_fee_charged, card_payment_not_recognised, card_payment_wrong_exchange_rate, card_swallowed, cash_withdrawal_charge, cash_withdrawal_not_recognised, change_pin, compromised_card, contactless_not_working, country_support, declined_card_payment, declined_cash_withdrawal, declined_transfer, direct_debit_payment_not_recognised, disposable_card_limits, edit_personal_details, exchange_charge, exchange_rate, exchange_via_app, extra_charge_on_statement, failed_transfer, fiat_currency_support, get_disposable_virtual_card, get_physical_card, getting_spare_card, getting_virtual_card, lost_or_stolen_card, lost_or_stolen_phone, order_physical_card, passcode_forgotten, pending_card_payment, pending_cash_withdrawal, pending_top_up, pending_transfer, pin_blocked, receiving_money, Refund_not_showing_up, request_refund, reverted_card_payment?, supported_cards_and_currencies, terminate_account, top_up_by_bank_transfer_charge, top_up_by_card_charge, top_up_by_cash_or_cheque, top_up_failed, top_up_limits, top_up_reverted, topping_up_by_card, transaction_charged_twice, transfer_fee_charged, transfer_into_account, transfer_not_received_by_recipient, transfer_timing, unable_to_verify_identity, verify_my_identity, verify_source_of_funds, verify_top_up, virtual_card_not_working, visa_or_mastercard, why_verify_identity, wrong_amount_of_cash_received, wrong_exchange_rate_for_cash_withdrawal

Usage

from tinydistill import Predictor  # pip install tinydistill

clf = Predictor("hf:Shroomy/tinydistill-banking77-minilm")
clf.predict(["some text"])

Or from the command line:

tinydistill predict hf:Shroomy/tinydistill-banking77-minilm "some text"
tinydistill serve hf:Shroomy/tinydistill-banking77-minilm

Results

Model Device Accuracy Macro-F1 Top-3 accuracy Agreement with teacher Latency, batch 1 (ms) Latency, batch 32 (ms) Throughput (texts/s) Size (MB) Speed-up, batch 1
teacher, 16 similar examples, 4-bit, probe cuda 0.859 0.859 0.946 n/a 155.4 4910.8 6.5 5443 1.0x
student, PyTorch cpu 0.875 ± 0.001 0.875 ± 0.001 0.953 ± 0.003 0.890 ± 0.001 3.7 73.0 438.6 91 41.6x
student, ONNX fp32 cpu 0.875 0.875 0.954 0.889 2.6 71.8 445.5 91 60.7x
student, ONNX int8 cpu 0.872 0.871 0.955 0.885 1.0 33.7 948.8 23 152.9x

Task banking77, 3080 gold-labelled test texts. Teacher: Qwen/Qwen2.5-7B-Instruct. Student: sentence-transformers/all-MiniLM-L6-v2. The teacher's probabilities are averaged with those of a linear probe on its hidden states, fit on 616 gold training texts; fit on 493 of them, teacher accuracy on the other 123 is 78.0% in context, 75.6% for the probe and 78.9% combined. The teacher's prompt shows each text the 16 most similar of 616 gold training examples. The student learns from the teacher's soft labels on all 10003 training texts, plus cross-entropy on 616 gold-labelled texts (8 per class; weight 1.0). Values with ± are the mean and standard deviation over 3 training seeds; the ONNX rows are the exported first-seed model. CPU rows use 2 threads. Latency is the median over repeated runs. Size is the teacher's weights as loaded and the students' model files. The teacher packs several texts into one forward pass; it is timed at batch 32 only when that takes under three minutes, otherwise its throughput is 1 / batch-1 latency. Speed-up is relative to the teacher, 16 similar examples, 4-bit, probe on cuda.

Cascade: student first, unsure texts to the teacher

Share sent to the teacher Student confidence threshold Accuracy Macro-F1 Mean latency per text (ms)
0% 0.125 0.872 0.871 1.0
10% 0.596 0.877 0.877 16.6
20% 0.768 0.874 0.873 32.1
30% 0.856 0.868 0.867 47.6
50% 0.925 0.861 0.860 78.7
100% 1.000 0.859 0.859 156.4

The student answers every text and passes its least confident ones to the teacher. Thresholds are set on the test texts to hit each share; in deployment, set them on a validation split. Latency is the student's batch-1 latency plus the share times the batch-1 latency of the teacher, 16 similar examples, 4-bit, probe on cuda.

License

Check the licences of the student model, the teacher and the training data before using this model. The uploader chose cc-by-4.0.

Downloads last month
697
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Shroomy/tinydistill-banking77-minilm

Dataset used to train Shroomy/tinydistill-banking77-minilm

Space using Shroomy/tinydistill-banking77-minilm 1

Collection including Shroomy/tinydistill-banking77-minilm