--- tags: - setfit - sentence-transformers - text-classification - generated_from_setfit_trainer widget: - text: I was charged twice for the same service on my last billing cycle. Can you help me confirm this? - text: Can you tell me if the ATM is available 24/7 at this location? - text: Can you explain how my account balance affects the service fees I’m being charged? - text: I need to know the outstanding amount on my education loan. - text: Can you break down how interest rates affect my monthly payments for a home equity loan? metrics: - accuracy pipeline_tag: text-classification library_name: setfit inference: true datasets: - rbojja/labelled_bank_support_dataset base_model: BAAI/bge-small-en-v1.5 model-index: - name: SetFit with BAAI/bge-small-en-v1.5 results: - task: type: text-classification name: Text Classification dataset: name: rbojja/labelled_bank_support_dataset type: rbojja/labelled_bank_support_dataset split: test metrics: - type: accuracy value: 0.8640988372093024 name: Accuracy --- # SetFit with BAAI/bge-small-en-v1.5 This is a [SetFit](https://github.com/huggingface/setfit) model trained on the [rbojja/labelled_bank_support_dataset](https://huggingface.co/datasets/rbojja/labelled_bank_support_dataset) dataset that can be used for Text Classification. This SetFit model uses [BAAI/bge-small-en-v1.5](https://huggingface.co/BAAI/bge-small-en-v1.5) 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:** [BAAI/bge-small-en-v1.5](https://huggingface.co/BAAI/bge-small-en-v1.5) - **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:** 10 classes - **Training Dataset:** [rbojja/labelled_bank_support_dataset](https://huggingface.co/datasets/rbojja/labelled_bank_support_dataset) ### 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 | |:------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 1 | | | 2 | | | 3 | | | 10 | | | 9 | | | 4 | | | 7 | | | 6 | | | 0 | | | 8 | | ## Evaluation ### Metrics | Label | Accuracy | |:--------|:---------| | **all** | 0.8641 | ## 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("rbojja/ft-intent-bank") # Run inference preds = model("I need to know the outstanding amount on my education loan.") ``` ## Training Details ### Training Set Metrics | Training set | Min | Median | Max | |:-------------|:----|:-------|:----| | Word count | 7 | 15.322 | 31 | | Label | Training Sample Count | |:------|:----------------------| | 0 | 7 | | 1 | 797 | | 2 | 29 | | 3 | 18 | | 4 | 1 | | 6 | 15 | | 7 | 7 | | 8 | 6 | | 9 | 63 | | 10 | 57 | ### Training Hyperparameters - batch_size: (16, 16) - num_epochs: (1, 16) - max_steps: 3450 - 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 - l2_weight: 0.01 - seed: 42 - eval_max_steps: -1 - load_best_model_at_end: False ### Training Results | Epoch | Step | Training Loss | Validation Loss | |:------:|:----:|:-------------:|:---------------:| | 0.0003 | 1 | 0.2179 | - | | 0.0145 | 50 | 0.2598 | - | | 0.0290 | 100 | 0.2349 | - | | 0.0435 | 150 | 0.2019 | - | | 0.0580 | 200 | 0.1686 | - | | 0.0725 | 250 | 0.1375 | - | | 0.0870 | 300 | 0.1265 | - | | 0.1014 | 350 | 0.0954 | - | | 0.1159 | 400 | 0.0794 | - | | 0.1304 | 450 | 0.065 | - | | 0.1449 | 500 | 0.0731 | - | | 0.1594 | 550 | 0.0547 | - | | 0.1739 | 600 | 0.043 | - | | 0.1884 | 650 | 0.0327 | - | | 0.2029 | 700 | 0.027 | - | | 0.2174 | 750 | 0.0285 | - | | 0.2319 | 800 | 0.0201 | - | | 0.2464 | 850 | 0.0151 | - | | 0.2609 | 900 | 0.0131 | - | | 0.2754 | 950 | 0.0076 | - | | 0.2899 | 1000 | 0.0147 | - | | 0.3043 | 1050 | 0.0122 | - | | 0.3188 | 1100 | 0.0109 | - | | 0.3333 | 1150 | 0.0126 | - | | 0.3478 | 1200 | 0.0108 | - | | 0.3623 | 1250 | 0.009 | - | | 0.3768 | 1300 | 0.0072 | - | | 0.3913 | 1350 | 0.0051 | - | | 0.4058 | 1400 | 0.0057 | - | | 0.4203 | 1450 | 0.0056 | - | | 0.4348 | 1500 | 0.0079 | - | | 0.4493 | 1550 | 0.0076 | - | | 0.4638 | 1600 | 0.0029 | - | | 0.4783 | 1650 | 0.0039 | - | | 0.4928 | 1700 | 0.003 | - | | 0.5072 | 1750 | 0.0037 | - | | 0.5217 | 1800 | 0.0022 | - | | 0.5362 | 1850 | 0.0032 | - | | 0.5507 | 1900 | 0.0034 | - | | 0.5652 | 1950 | 0.006 | - | | 0.5797 | 2000 | 0.0046 | - | | 0.5942 | 2050 | 0.0026 | - | | 0.6087 | 2100 | 0.0031 | - | | 0.6232 | 2150 | 0.0041 | - | | 0.6377 | 2200 | 0.0049 | - | | 0.6522 | 2250 | 0.0015 | - | | 0.6667 | 2300 | 0.0053 | - | | 0.6812 | 2350 | 0.0033 | - | | 0.6957 | 2400 | 0.0055 | - | | 0.7101 | 2450 | 0.0044 | - | | 0.7246 | 2500 | 0.0036 | - | | 0.7391 | 2550 | 0.0038 | - | | 0.7536 | 2600 | 0.0038 | - | | 0.7681 | 2650 | 0.0027 | - | | 0.7826 | 2700 | 0.0028 | - | | 0.7971 | 2750 | 0.0038 | - | | 0.8116 | 2800 | 0.0033 | - | | 0.8261 | 2850 | 0.0035 | - | | 0.8406 | 2900 | 0.002 | - | | 0.8551 | 2950 | 0.0034 | - | | 0.8696 | 3000 | 0.0053 | - | | 0.8841 | 3050 | 0.0035 | - | | 0.8986 | 3100 | 0.0016 | - | | 0.9130 | 3150 | 0.0021 | - | | 0.9275 | 3200 | 0.0021 | - | | 0.9420 | 3250 | 0.005 | - | | 0.9565 | 3300 | 0.0031 | - | | 0.9710 | 3350 | 0.0038 | - | | 0.9855 | 3400 | 0.0029 | - | | 1.0 | 3450 | 0.0019 | - | ### Framework Versions - Python: 3.10.12 - SetFit: 1.1.1 - Sentence Transformers: 3.3.1 - Transformers: 4.47.1 - PyTorch: 2.5.1+cu124 - Datasets: 3.2.0 - Tokenizers: 0.21.0 ## 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} } ```