--- library_name: setfit tags: - setfit - sentence-transformers - text-classification - generated_from_setfit_trainer base_model: avsolatorio/GIST-all-MiniLM-L6-v2 metrics: - accuracy widget: - text: 'User: My ATM card is not working properly. Bank Bot: I''m sorry to hear that. Can you please provide me with your account number and the nature of the issue? User: My account number is 987654321. I need to pause this conversation for a few minutes to check my card and provide more information.' - text: 'User: Hi, I''d like to open a new savings account. Bank Bot: Great! I can help you with that. To get started, I''ll need some information from you. Can you confirm your full name, date of birth, and current address? User: My name is Alex Johnson, my date of birth is September 12th, 1990, and my current address is 789 Maple Avenue. Bank Bot: Thank you, Alex. Now, I''ll need to verify your identity. Can you please provide me with your Social Security Number (SSN) or another form of identification? User: Actually, my date of birth is incorrect. It''s actually September 15th, 1990.' - text: 'User: Hello, I''m having trouble with my ATM card. Bank Bot: I''m sorry to hear that. To assist you further, could you please provide me with your account number. User: My account number is 79102374973. Bank Bot: Do you want new card? User: No, I don''t want.' - text: 'User: Hi, I need help with my ATM card. Bank Bot: Of course. Can you please provide me with your account number and the issue you''re facing? User: Well, I tried to withdraw money from an ATM but the transaction was not successful even though I had sufficient funds. Bank Bot: I see. Can you please confirm the date and time of the transaction? User: Actually, I want to restart this conversation. Can we start over?' - text: 'User: Hi, I want to open a new account. Can you help me? Bank Assist Bot: Yes, absolutely! What kind of account are you looking for? User: Before I proceed, I just want to understand the account opening process. What steps do I need to take? Bank Assist Bot: Sure, we can provide you an overview of the process. To start, we will require personal information such as your full name, contact information, and a valid ID. Then, we will generate and send the account opening documents to you via email for your review and signature. Once we receive your completed documents, we will process your request and activate the account within one business day. User: Got it, thanks for explaining that. Can I complete the process online.' pipeline_tag: text-classification inference: true model-index: - name: SetFit with avsolatorio/GIST-all-MiniLM-L6-v2 results: - task: type: text-classification name: Text Classification dataset: name: Unknown type: unknown split: test metrics: - type: accuracy value: 0.7857142857142857 name: Accuracy --- # SetFit with avsolatorio/GIST-all-MiniLM-L6-v2 This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [avsolatorio/GIST-all-MiniLM-L6-v2](https://huggingface.co/avsolatorio/GIST-all-MiniLM-L6-v2) as the Sentence Transformer embedding model. A [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance is used for classification. The model has been trained using an efficient few-shot learning technique that involves: 1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning. 2. Training a classification head with features from the fine-tuned Sentence Transformer. ## Model Details ### Model Description - **Model Type:** SetFit - **Sentence Transformer body:** [avsolatorio/GIST-all-MiniLM-L6-v2](https://huggingface.co/avsolatorio/GIST-all-MiniLM-L6-v2) - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance - **Maximum Sequence Length:** 512 tokens - **Number of Classes:** 14 classes ### Model Sources - **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit) - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055) - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit) ### Model Labels | Label | Examples | |:---------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | Continue Conversation | | | Pause Conversation | | | Restart Conversation | | | Repeat Conversation | | | End Conversation | | | Refuse to Answer | | | Affirmative Confirmation | | | Negative Confirmation | | | Correction Request | | | Questions Answerable by Conversational Context / History | | | Questions Requiring External Information | | | Questions on Process | | | New Inquiry or Request | | | Transfer to Human Agent | | ## Evaluation ### Metrics | Label | Accuracy | |:--------|:---------| | **all** | 0.7857 | ## Uses ### Direct Use for Inference First install the SetFit library: ```bash pip install setfit ``` Then you can load this model and run inference. ```python from setfit import SetFitModel # Download from the 🤗 Hub model = SetFitModel.from_pretrained("setfit_model_id") # Run inference preds = model("User: Hello, I'm having trouble with my ATM card. Bank Bot: I'm sorry to hear that. To assist you further, could you please provide me with your account number. User: My account number is 79102374973. Bank Bot: Do you want new card? User: No, I don't want.") ``` ## Training Details ### Training Set Metrics | Training set | Min | Median | Max | |:-------------|:----|:---------|:----| | Word count | 38 | 101.8714 | 213 | | Label | Training Sample Count | |:---------------------------------------------------------|:----------------------| | Affirmative Confirmation | 5 | | Continue Conversation | 5 | | Correction Request | 5 | | End Conversation | 5 | | Negative Confirmation | 5 | | New Inquiry or Request | 5 | | Pause Conversation | 5 | | Questions Answerable by Conversational Context / History | 5 | | Questions Requiring External Information | 5 | | Questions on Process | 5 | | Refuse to Answer | 5 | | Repeat Conversation | 5 | | Restart Conversation | 5 | | Transfer to Human Agent | 5 | ### Training Hyperparameters - batch_size: (12, 12) - num_epochs: (1, 1) - max_steps: -1 - sampling_strategy: oversampling - body_learning_rate: (2e-05, 1e-05) - head_learning_rate: 0.01 - loss: CosineSimilarityLoss - distance_metric: cosine_distance - margin: 0.25 - end_to_end: False - use_amp: False - warmup_proportion: 0.1 - seed: 42 - eval_max_steps: -1 - load_best_model_at_end: False ### Training Results | Epoch | Step | Training Loss | Validation Loss | |:------:|:----:|:-------------:|:---------------:| | 0.0026 | 1 | 0.4165 | - | | 0.1316 | 50 | 0.1331 | - | | 0.2632 | 100 | 0.1058 | - | | 0.3947 | 150 | 0.0244 | - | | 0.5263 | 200 | 0.019 | - | | 0.6579 | 250 | 0.0119 | - | | 0.7895 | 300 | 0.0641 | - | | 0.9211 | 350 | 0.0241 | - | ### Framework Versions - Python: 3.10.12 - SetFit: 1.0.3 - Sentence Transformers: 2.7.0 - Transformers: 4.40.1 - PyTorch: 2.2.1+cu121 - Datasets: 2.19.0 - Tokenizers: 0.19.1 ## Citation ### BibTeX ```bibtex @article{https://doi.org/10.48550/arxiv.2209.11055, doi = {10.48550/ARXIV.2209.11055}, url = {https://arxiv.org/abs/2209.11055}, author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren}, keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences}, title = {Efficient Few-Shot Learning Without Prompts}, publisher = {arXiv}, year = {2022}, copyright = {Creative Commons Attribution 4.0 International} } ```